Last updated: 2023-05-09
Checks: 5 2
Knit directory: multistate/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown file has staged changes. To know which version of the
R Markdown file created these results, you’ll want to first commit it to
the Git repo. If you’re still working on the analysis, you can ignore
this warning. When you’re finished, you can run
wflow_publish
to commit the R Markdown file and build the
HTML.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20230211)
was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.
absolute | relative |
---|---|
~/multistate/ | . |
~/multistate/output/allcovariates.rds | output/allcovariates.rds |
~/multistate/output/aprs.rds | output/aprs.rds |
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 9fdb1b6. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: output/allcovariates+withsex.rds
Ignored: output/allcovariates.rds
Ignored: output/aprs.rds
Ignored: output/hypertension_meds.rds
Ignored: output/statin_meds.rds
Unstaged changes:
Modified: .DS_Store
Modified: code/plotcode.R
Staged changes:
Modified: .DS_Store
New: analysis/lipidstatin.Rmd
Modified: analysis/modeglm.Rmd
Modified: code/fitarray.R
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/modeglm.Rmd
) and HTML
(docs/modeglm.html
) files. If you’ve configured a remote
Git repository (see ?wflow_git_remote
), click on the
hyperlinks in the table below to view the files as they were in that
past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 9fdb1b6 | Your Name | 2023-04-10 | Update |
html | 9fdb1b6 | Your Name | 2023-04-10 | Update |
Rmd | 88de0be | Your Name | 2023-04-04 | update |
Rmd | 380c7d7 | Your Name | 2023-03-13 | Update |
html | 380c7d7 | Your Name | 2023-03-13 | Update |
Rmd | d51abfe | Your Name | 2023-03-01 | update |
html | d51abfe | Your Name | 2023-03-01 | update |
Rmd | 4c0c86b | Your Name | 2023-03-01 | update |
html | 4c0c86b | Your Name | 2023-03-01 | update |
Rmd | 036cafd | Your Name | 2023-03-01 | update |
html | 036cafd | Your Name | 2023-03-01 | update |
Rmd | 875375e | Your Name | 2023-02-23 | Update |
html | 875375e | Your Name | 2023-02-23 | Update |
Rmd | 28318c8 | Your Name | 2023-02-22 | Update |
html | 28318c8 | Your Name | 2023-02-22 | Update |
Rmd | 647ce3e | Your Name | 2023-02-19 | Update |
html | 647ce3e | Your Name | 2023-02-19 | Update |
Rmd | 4c7c751 | Your Name | 2023-02-17 | update |
html | 4c7c751 | Your Name | 2023-02-17 | update |
Rmd | 1cb237c | Your Name | 2023-02-17 | update |
html | 1cb237c | Your Name | 2023-02-17 | update |
Rmd | bdb99ac | Your Name | 2023-02-17 | update |
html | bdb99ac | Your Name | 2023-02-17 | update |
Rmd | b960902 | Your Name | 2023-02-16 | Update |
html | b960902 | Your Name | 2023-02-16 | Update |
Rmd | dbae012 | Your Name | 2023-02-15 | Update |
Rmd | 882f744 | Your Name | 2023-02-12 | update |
html | 882f744 | Your Name | 2023-02-12 | update |
html | 42ae266 | Your Name | 2023-02-12 | Build site. |
html | 8fe4799 | Your Name | 2023-02-12 | Build site. |
Rmd | ed5535f | Your Name | 2023-02-12 | wflow_publish("analysis/modeglm.Rmd") |
Rmd | ef0a879 | Your Name | 2023-02-11 | update |
html | ef0a879 | Your Name | 2023-02-11 | update |
Rmd | 385bef9 | Your Name | 2023-02-11 | update |
html | 385bef9 | Your Name | 2023-02-11 | update |
People are complicated. Look at this transition through lifestages for an individual based on diagnostic codes, lab data, and biomarkers. We look at this example overlaying biomarkers for Diabetes.
We can think of these life transitions as progressing through a variety of states:
Here we plot transition OR by PRS quantile from each state to CAD for example.
Now, we plot just from one two and three risk factor condensed to CAD. We remove all transitions with NAR < 10.
Now we plot the raw rates
Absolute Risk (intercept)
Version | Author | Date |
---|---|---|
9fdb1b6 | Your Name | 2023-04-10 |
aprsall = fitfunc(df_frame = dfp,nstates = nstates,ages = ages,mode = "binomial",covariates ="cad.prs+yearsinstate+statin_now+antihtn_now+f.31.0.0+dm2.prs+ldl.prs+htn.prs")
absrisk=function(age,start,stop,cad.prs,yearsinstate,statin,bpmed,sex,dmprs,ldlprs,htnprs){
agename=as.character(age)
mod=aprsall$model_list[[agename]][[stop]][[start]]
if (start=="Health") {
new.frame=as.matrix(data.frame(1,cad.prs,statin,bpmed,sex,dmprs,ldlprs,htnprs))
} else {
new.frame=as.matrix(data.frame(1,cad.prs,yearsinstate,statin,bpmed,sex,dmprs,ldlprs,htnprs))
}
## x%*%B to get log(p/1-p)
pover1minp=exp(new.frame%*%mod[,1])
return(pover1minp/(1+pover1minp))
}
## doesn't make sense
absrisk(age = 50,start = "Dm",stop="Cad",yearsinstate = 10,statin = 0,sex = 1,dmprs = 1,cad.prs = 3,ldlprs = 1,bpmed = 0,htnprs =1)
[,1]
[1,] 0.01388373
absrisk(age = 50,start = "Health",stop="Cad",yearsinstate = 10,statin = 0,sex = 1,dmprs = 1,cad.prs = 3,ldlprs = 1,bpmed = 0,htnprs =1)
[,1]
[1,] 0.01185995
absrisk(age = 50,start = "Ht",stop="Cad",yearsinstate = 10,statin = 0,sex = 1,dmprs = 1,cad.prs = 3,ldlprs = 1,bpmed = 0,htnprs =1)
[,1]
[1,] 0.009333437
absrisk(age = 60,start = "Ht",stop="Cad",yearsinstate = 10,statin = 0,sex = 1,dmprs = 1,cad.prs = 3,ldlprs = 1,bpmed = 0,htnprs =1)
[,1]
[1,] 0.008989289
absrisk(age = 40,start = "Ht",stop="Cad",yearsinstate = 10,statin = 0,sex = 1,dmprs = 1,cad.prs = 3,ldlprs = 1,bpmed = 0,htnprs =1)
[,1]
[1,] 0.007015785
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur ... 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] plotly_4.10.1 dplyr_1.1.2 RColorBrewer_1.1-3 gridExtra_2.3
[5] ggplot2_3.4.2 data.table_1.14.8
loaded via a namespace (and not attached):
[1] Rcpp_1.0.10 lattice_0.21-8 tidyr_1.3.0 rprojroot_2.0.3
[5] digest_0.6.31 utf8_1.2.3 R6_2.5.1 plyr_1.8.8
[9] evaluate_0.20 httr_1.4.5 highr_0.10 pillar_1.9.0
[13] rlang_1.1.1 lazyeval_0.2.2 rstudioapi_0.14 whisker_0.4.1
[17] jquerylib_0.1.4 Matrix_1.5-4 rmarkdown_2.21 labeling_0.4.2
[21] splines_4.2.1 stringr_1.5.0 htmlwidgets_1.6.2 munsell_0.5.0
[25] compiler_4.2.1 httpuv_1.6.9 xfun_0.39 pkgconfig_2.0.3
[29] mgcv_1.8-42 htmltools_0.5.5 tidyselect_1.2.0 tibble_3.2.1
[33] workflowr_1.7.0 fansi_1.0.4 viridisLite_0.4.1 withr_2.5.0
[37] later_1.3.0 nlme_3.1-162 jsonlite_1.8.4 gtable_0.3.3
[41] lifecycle_1.0.3 git2r_0.32.0 magrittr_2.0.3 scales_1.2.1
[45] cli_3.6.1 stringi_1.7.12 cachem_1.0.8 farver_2.1.1
[49] reshape2_1.4.4 fs_1.6.2 promises_1.2.0.1 bslib_0.4.2
[53] ellipsis_0.3.2 generics_0.1.3 vctrs_0.6.2 tools_4.2.1
[57] glue_1.6.2 purrr_1.0.1 crosstalk_1.2.0 fastmap_1.1.1
[61] yaml_2.3.7 colorspace_2.1-0 knitr_1.42 sass_0.4.5