A simulated dataset for longitudinal data analysis.
A data frame with 540 observations on the following 4 variables.
time points. A factor with levels
numeric. outcome variable
subject group. A factor with levels
The dataset is generated from the following mixed effects model for repeated measures:
yij=beta0i+beta1*tj + beta2*grp2i + beta3*grp3i + beta4*(tj*grp2i) + beta5*(tj*grp3i)+epsilonij,
where yij is the outcome value for the i-th subject measured at j-th time point tj, grp2i is a dummy variable indicating if the i-th subject is from group 2, grp3i is a dummy variable indicating if the i-th subject is from group 3, beta0i ~ N(beta0, sigmab^2) , epsilonij ~ N(0, sigmae^2) , i=1, ..., n, j=1, ..., m, n is the number of subjects, and m is the number of time points.
When t_j=0, the expected outcome value is
E(yij)=beta0+beta2*dose2i + beta3*dose3i.
Hence, we have at baseline
E(yij)=beta0, for dose 1 group.
E(yij)=beta0+beta2, for dose 2 group.
E(yij)=beta0+beta2, for dose 3 group.
For dose 1 group, the expected outcome values across time is
We also can get the expected difference of outcome values between dose 2 group and dose 1 group, between dose 3 group and dose 1 group, and between dose 3 group and dose 2 group:
E(yij - yi'j) =beta2+beta4*tj, for subject i in dose 2 group and subject i' in dose 1 group,
E(ykj - yi'j) =beta3+beta5*tj, for subject k in dose 3 group and subject i' in dose 1 group,
E(ykj - yij) =(beta3-beta2)+(beta5-beta4)*tj, for subject k in dose 3 group and subject i in dose 2 group.
We set n=90, m=6, beta0=5, beta1=0, beta2=0, beta3=0, beta4=2, beta5=-2, sigmae=1, sigmab=0.5, and tij=j, j=1, ..., m.
That is, the trajectories for dose 1 group are horizontal with mean intercept at 5, the trajectories for dose 2 group are linearly increasing with slope 2 and mean intercept 5, and the trajectories for dose 3 group are linearly decreasing with slope -2 and mean intercept 5.
1 2 3 4 5 6 7 8 9 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.