# longDat: A Simulated Dataset for Longitudinal Data Analysis In statVisual: Statistical Visualization Tools

## Description

A simulated dataset for longitudinal data analysis.

## Usage

 `1` ```data("longDat") ```

## Format

A data frame with 540 observations on the following 4 variables.

`sid`

subject id

`time`

time points. A factor with levels `time1` `time2` `time3` `time4` `time5` `time6`

`y`

numeric. outcome variable

`grp`

subject group. A factor with levels `grp1` `grp2` `grp3`

## Details

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

E(yij)=beta0+beta1*tj.

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.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```data(longDat) print(dim(longDat)) print(longDat[1:3,]) print(table(longDat\$time, useNA = "ifany")) print(table(longDat\$grp, useNA = "ifany")) print(table(longDat\$sid, useNA = "ifany")) print(table(longDat\$time, longDat\$grp)) ```

statVisual documentation built on Feb. 21, 2020, 1:08 a.m.