longitudinal assignment final.doc

longitudinal assignment final.doc - CHRISTINE MUTONO NZINGA...

This preview shows page 1 - 3 out of 37 pages.

CHRISTINE MUTONO NZINGA DPS/PHD/004/17 MOI UNIVERSITY DEPARMENT OF STATISTICS AND COMPUTER SCIENCE Ph.D. (Biostatistics) STA 931 APPLIED LONGITUDINAL ANNALYSIS HW3 June 2018. Due 17 th July 2018 Purpose: To provide an introduction to the analysis of response profiles for longitudinal data. Instructions: 1. For each question requiring data analysis, support your conclusions by including only the relevant R output in your answer. 2. Include your R program as an appendix to your solutions. Analysis of Response Profiles: Study of effects of treatment on rheumatoid arthritis A randomized clinical trial was completed to compare the effectiveness of 2 rheumatoid arthritis treatments. The grip strength was measured on each of the patients at 4 time points: week 0, week 1, week 2 and week 3. Grip strength is a continuous outcome. The data set is complete and balanced. Note that only a subset of patients is included in the data set for this assignment. We are most interested in determining the association between treatment and grip strength. The data are stored in an ASCII file: compgrip.txt. Each row of the data set contains the following six variables: subject ID number, treatment indicator (1=treatment A and 2=treatment B), Y 0 , Y 1 , Y 2 , Y 3 . ## Parallel backend library ( doMC ) # parallel backend to foreach/plyr registerDoMC () # Turn on multicore processing ## Prepare dataset compgrip <- read.table ( " " ) names ( compgrip ) <- c ( "id" , "tx" , "y0" , "y1" , "y2" , "y3" ) ## Wide to long compgrip.long <- reshape ( data = compgrip , varying = c ( "y0" , "y1" , "y2" , "y3" ) , timevar = "time" , idvar = "id" , direction = "long" , sep = "" ) compgrip.long <- compgrip.long [ with ( compgrip.long , order ( id , time )) , ] compgrip.long <- within ( compgrip.long , { time.cat <- factor ( time ) tx <- factor ( tx , 1 : 2 , c ( "A" , "B" )) })
Image of page 1

Subscribe to view the full document.

1. Obtain the sample size, and the sample means and standard deviations of the grip strengths at each occasion for each treatment group. On the same graph, plot the mean grip strength versus time (in weeks) for each of the two treatment groups. Describe the general characteristics of the time trends for the two groups. ## Summarize library ( plyr ) summary.compgrip.long <- ddply ( .data = compgrip.long , .variables = c ( "tx" , "time" ) , .fun = summarize , n = length ( ! is.na ( y )) , mean = mean ( y ) , sd = sd ( y )) summary.compgrip.long tx time n mean sd 1 A 0 26 134.6 71.29 2 A 1 26 145.5 68.94 3 A 2 26 153.8 70.94 4 A 3 26 159.2 71.41 5 B 0 32 134.8 72.71 6 B 1 32 137.1 75.03 7 B 2 32 138.6 71.45 8 B 3 32 138.6 73.55 ## Plot library ( ggplot2 ) ggplot ( data = summary.compgrip.long , mapping = aes ( x = time , y = mean , group = tx , color = tx )) + layer ( geom = "point" ) + layer ( geom = "line" ) + ## layer(geom = "errorbar", mapping = aes(ymax = mean + (sd)/sqrt(n), ymin = mean - (sd)/sqrt(n)), width = 0.1) + theme_bw () + theme ( legend.key = element_blank ())
Image of page 2
2. With baseline (month 0) and the treatment A as the reference group, write out the complete definition of the regression model for the analysis of response profiles for mean grip strength. In this model, let β denote the vector of parameters in the model for the means and assume an unstructured variance covariance structure.
Image of page 3
You've reached the end of this preview.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern