The folder simulation contains code to reproduce Figure 1-5 presented in Section: Simulation.
SIM_THMS.R
- Simulate data using the generative model proposed in Section 2.2: Generation of the Longitudinal EHR Feature Occurrences.
- Calculate the empirical and low-rank PMI estimator and estimate their entry-wise standard deviation.
- Used in Figure 1 Middle and Right, Figure 5
PMITable1_241230.R
- Calculate the p-values under the global null hypothesis. (used to plot Figure 4)
PMI_discourse_robust_T.R
- Simulate data using different distribution for the discourse vectors.
- Calculate the Max norm distances between EHR entity embeddings and PMI estimators for each distribution (used to plot Figure 2)
- Figure 1: Max norm distances between EHR entity embeddings and PMI estimators. Generated by
Fig1Left.RmdandFigure1MiddleRight_and_Figure5.Rmd - Figure 2: Max norm distances between EHR entity embeddings and PMI estimators. Generated by
Figure2_4.ipynb - Figure 3: Relation between the max-norm difference and
n,T. Generated byFigure2_4.ipynb - Figure 4: Power Analysis. Comparison of our proposed method with and without patient-level data under the global null hypothesis. Generated by
Figure2_4.ipynb - Figure 5: Average half width of 95% confidence interval of the first ten entries respectively constructed by the empirical estimator and the low-rank estimator. Generated by
Figure1MiddleRight_and_Figure5.Rmd
The folder RealData contains the code for generating the tables and figures presented in Section: Applications to Electronic Health Records.
construct_KG.R
Estimates the SVD-SPPMI embeddings and computes the variance of the estimator.
RealData.R
Generates the following outputs:
- Table 2: AUC of detecting known relation pairs with different methods
- Table 3: Power of detecting known relation pairs
- Table 4: Spearman rank correlation between scores and GPT ratings
- Figure 6: Estimated low-rank PMI with the smallest p-values when quantifying their relationships with AD
- Figure 7: t-SNE visualization of embeddings
Evaluate_cos.R and related helper files
Provide the key functions used to evaluate cosine similarities, compute AUC, power, correlations, and generate plots.