runSHG: Runs Smoking History Generator

Description Usage Arguments Examples

View source: R/runSHG.R

Description

The SHG is written in Python and is maintained seperately from this package by CISNET. This function calls the SHG from within R, creates the SHG output_19X0.out file, and also returns the SHG cohort. The SHG needs to be installed properly prior to use. To use runSHG(), you pass it the directory where the SHG is installed. Tested using SHG6.3.4 and Python v2.7.10 on MacOSX. SHG6.3.4.zip was obtained from cisnet.flexkb.net, see their readme.md for setup instructions. In python, you'll likely want these dependencies: six, ipdb, enum, ipython_genutils, ipython. To install the SHG, run install.sh. To run the SHG from R, run: (1) python run_tests.py directly, or use this R wrapper function to create a custom 'run_custom_tests.py'. No object is returned by this wrapper function. You will be prompted to look for the appropriate output_19X0.out, input_19X0.txt, and errors_19X0.txt in the SHG directory. If you do not wish to use the SHG, you can load a processed smoking history dataset by typing: data(smkhist) that is included with this package. The smkhist dataset is for a 1950 birth cohort of 10000 men from SHG3.6.4.

Usage

1
runSHG(path, n, gender, birth_cohort, seed)

Arguments

path

a string indicating the directory that the SHG is installed in (ie: "~/SHG6.3.4")

n

the size of the cohort (ie: 10000)

gender

the gender (ie: "M" == 0 or "F" == 1)

birth_cohort

the year of birth for the cohort (ie: 1950 or 1960)

seed

the seed for random number generator

Examples

1
2
3
4
library(LCRFsim)
runSHG("~/SHG3.6.4", 10000, "F", 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

ekhco/LCsim documentation built on Nov. 4, 2019, 11:50 a.m.