mydata: Generate A Longitudinal Data Set

Description Usage Arguments Value Examples

View source: R/gen_dat.R

Description

Generate A Longitudinal Data Set

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
mydata(
  n = 80,
  model = "logist",
  p = 2,
  bb0 = 0.1,
  bb = 0.5,
  x.sd = 0.5,
  v1 = 5,
  v2 = 7,
  dist = "normal",
  eps.sd = 0.05,
  u.sd = 0.05
)

Arguments

n

number of sample size.

model

a character string for a nonlinear model: "logist" or "arctan".

p

a parameter for the dimension of coefficients in the log-normal model for the inflection point.

bb0

a parameter for the true intercept term of the log-normal model for the inflection point.

bb

a (p-1)-length of the true coefficient vector of subject specific covariates.

x.sd

a parameter for the standard deviation of time points (log-transformed ages).

v1

a parameter for the smallest visit number among all subjects have made.

v2

a parameter for the largest visit number among all subjects have made.

dist

a character string for the distribution of the within-subject error term in the longitudinal model. Default is "normal".

eps.sd

a true scale parameter of the within-subject error term in the longitudinal model.

u.sd

a true scale parameter of the random error term in the inflection point model.

Value

A data frame of the longitudinal data with 7 variables:

The number of rows for the returned data frame is determined by the number of subjects' visits, where 5, 6, and 7 visits are randomly assigned to all patients. For example, the first subject made 5 visits and the second subject made 7 visits. Then the size of the data frame containing these two subjects' longitudinal data is 12 by 7.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(HDChangePoint)
# How to Generate Simulated Data using mydata() #
n=80; model="logist"; p=2; bb0=0.5;bb=0.1; x.sd=0.3; v1=8; v2=10;
dist="normal"; eps.sd=0.05;u.sd=0.05;

## Specify parameters for the multi-stage nonparametric procedure
num.interp=45;newl=45; k1=20; k2=20; tolerance=0.009; iter=0; time.length=20;

set.seed(22)
## Data generation under the logistic model
outdat<-mydata(n=n, model=model, p=p, bb0=bb0, bb=bb, x.sd=x.sd,
dist=dist,v1=v1, v2=v2, eps.sd=eps.sd, u.sd=u.sd) #

## Multi-stage nonparametric estimation
results<-sim.nonpara(n=n, model=model, dist=dist, k1=k1, k2=k2,
num.interp=num.interp, newl=newl, eps.sd=eps.sd, mean.diff=1, tolerance=tolerance,
itermax=50, iter=iter, time.length=time.length, dat=outdat)

unkyunglee/HDChangePoint documentation built on Nov. 27, 2021, 2:57 p.m.