Description Usage Arguments Examples
View source: R/riskFactorSimulator.R
For a given SHG cohort with a specific birth year, for a given gender ("F" or "M"), for a range of ages (ie: 45:90), this function will return a simulated set of risk factors for lung cancer (BMI, family history, personal history, COPD) for each individual in the SHG cohort, conditioned on their smoking histories provided by runSHG(). Use this function after you have created a SHG cohort using runSHG(). You can also load a sample processed dataset of the SHG by typing data(smkhist). smkhist is a processed SHG data frame of 10000 men born in 1950 simulated using SHG3.6.4. This function requires a processed SHG object (SHG_out) that is created by processsSHG(). If you have your own simulated SHG cohort (as an output_19X0.out file), you can process that using processSHG() to create a data.frame that can be inputted into this function.
1 | riskFactorSimulator(gender, birth_cohort, SHG_out, ages, seed)
|
gender |
the gender (ie: "M" or "F") |
birth_cohort |
the birth year of the cohort (ie: 1950) |
SHG_out |
the name of the object that is the output from the SHG |
ages |
the range of longitudinal ages to be passed to reformatSHG (ie: 45:90) |
seed |
the randomization seed |
1 2 3 4 5 6 7 | library(LCRFsim)
library(splines)
runSHG("~/SHG3.6.4", 10000, "M", 1950, 1) # runs SHG to create output_1950.out in SHG directory
smoking_history <- processSHG(file = "~/SHG3.6.4/output_1950.out", birth_cohort = 1950)
data(smkhist) # or you can load a sample processed SHG output of 10K men born in 1950
ANS_m <- riskFactorSimulator(gender="M", birth_cohort = 1950, SHG_out = smkhist, ages = 45:90, seed = 1618)
summary(ANS_m$outputOnly[,1:5]) # look at results of simulation
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.