Difference between revisions of "SMHS DataSimulation"
(→Scientific Methods for Health Sciences - Data Simulation) |
(→Scientific Methods for Health Sciences - Data Simulation) |
||
Line 38: | Line 38: | ||
|} | |} | ||
</center> | </center> | ||
+ | |||
+ | ===Testing section=== | ||
+ | |||
+ | summary(data_1) | ||
+ | |||
+ | x.norm <- rnorm(n=200, m=10, sd=20) | ||
+ | hist(x.norm, main="N(10,20) Histogram") | ||
+ | hist(x.norm, main="N(10,20) Histogram") | ||
+ | mean(data_1$age) | ||
+ | sd(data_1$age) | ||
Revision as of 12:11, 20 January 2016
Scientific Methods for Health Sciences - Data Simulation
Importing observed data for exploratory analytics
Using the SOCR Health Evaluation and Linkage to Primary (HELP) Care Dataset we can extract some sample data (00_Tiny_SOCR_HELP_Data_Simmulation.csv).
# data_1 <- read.csv('C:\\Users\\Dinov\\Desktop\\00_Tiny_SOCR_HELP_Data_Simmulation.csv',as.is=T, header=T) # data_1 = read.csv(file.choose( )) # data_1 <- read.table('C:\\Users\\Dinov\\Desktop\\00_Tiny_SOCR_HELP_Data_Simmulation.csv', header=TRUE, sep=",", row.names="ID") attach(data_1) # to ensure all variables are accessible within R, e.g., using “age” instead of data_1$age # i2 maximum number of drinks (standard units) consumed per day (in the past 30 days range 0–184) see also i1 # treat randomization group (0=usual care, 1=HELP clinic) # pcs SF-36 Physical Component Score (range 14-75) # mcs SF-36 Mental Component Score(range 7-62) # cesd Center for Epidemiologic Studies Depression scale (range 0–60) # indtot Inventory of Drug Use Con-sequences (InDUC) total score (range 4–45) # pss_fr perceived social supports (friends, range 0–14) see also dayslink # drugrisk Risk-Assessment Battery(RAB) drug risk score (range0–21) # satreat any BSAS substance abuse treatment at baseline (0=no,1=yes)
ID | i2 | age | treat | homeless | pcs | mcs | cesd | indtot | pss_fr | drugrisk | sexrisk | satreat | female | substance | racegrp |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0 | 25 | 0 | 0 | 49 | 7 | 46 | 37 | 0 | 1 | 6 | 0 | 0 | cocaine | black |
2 | 18 | 31 | 0 | 0 | 48 | 34 | 17 | 48 | 0 | 0 | 11 | 0 | 0 | alcohol | white |
3 | 39 | 36 | 0 | 0 | 76 | 9 | 33 | 41 | 12 | 19 | 4 | 0 | 0 | heroin | black |
… | |||||||||||||||
100 | 81 | 22 | 0 | 0 | 37 | 17 | 19 | 30 | 3 | 0 | 10 | 0 | 0 | alcohol | other |
Testing section
summary(data_1) x.norm <- rnorm(n=200, m=10, sd=20) hist(x.norm, main="N(10,20) Histogram") hist(x.norm, main="N(10,20) Histogram") mean(data_1$age) sd(data_1$age)
- SOCR Home page: http://www.socr.umich.edu
Translate this page: