Learn R Programming

longke (version 0.1.0)

datagen: Simulate longitudinal data

Description

Function used to simulate sample sparse and irregular longitudinal data

Usage

datagen(ntotal,ntest,t_all,t_split,seed)

Value

A list containing two elements

train

A long format data matrix containing one functional response (yy) and two functional predictors (xx,zz) with (ntotal-ntest) subjects

test

A long format data matrix containing one functional response (yy) and two functional predictors (xx,zz) with (ntest) subjects

Arguments

ntotal

Number of total longitudinal subjects

ntest

Number of total longitudinal subjects in the testing set

t_all

Vector of discrete measurement time (i.e 1,2,3,4,...)

t_split

A measurement time where the longitudinal response is of interest to predict after this t_split

seed

Seed to derive replicable data

Examples

Run this code
data = datagen(ntotal=350,ntest=50,t_all=1:50,t_split=25,seed=1)
data$test
data$train

Run the code above in your browser using DataLab