1.6 KiB
Exercise: Power simulation for longitudinal data
Risperidone vs. haloperidol and schizophrenia
dat <- read.table("../data/moeller.csv", header = TRUE, sep = ",")
dat$id <- factor(dat$id)
dat$treat <- factor(dat$treat, levels = c("risp", "halo"))
lattice::xyplot(pans ~ week, data = dat, groups = treat, type = c("g", "p", "a"), auto.key = TRUE)
-
Analyze the original data from moeller.csv:
-
pans: Positive and Negative Symptom Scale for schizophrenia -
treat: medication grouprisp: atypical neuroleptic risperidonehalo: conventional neuroleptic haloperidol
-
What is the sample size in each treatment group?
-
Estimate the by-group random-slope model.
-
What are the estimates for the fixed effects and variance components?
-
Interpret the interaction effect.
-
Test the interaction effect.
-
-
Run a power simulation for a replication study:
-
Set up a data frame containing the study design and sample size.
-
Specify the minimum relevant effect.
-
Set the fixed effects and variance components to plausible values.
-
How many participants are required for the test of the interaction to detect the specified effect with a power of 80%?
-
Recover the parameters of the by-group random-slope model for one simulated data set.
-
-
Create a renderable R script or an R Markdown file that includes
- a header with title, author, date
- at least one section head line
- the questions from above and your answers
- the R code, output, and plots (if any)
Render the R or Rmd file to HTML.