Learn R Programming

dfrr (version 0.1.5)

simulate_simple_dfrr: Simulating a Simple dfrr Model

Description

Simulation from a simple dfrr model: $$Y_{i}(t)=I(\beta_0(t)+\beta_1(t)*x_{i}+\varepsilon_{i}(t)+\epsilon_{i}(t)\times\sigma^2>0),$$ where \(I(.)\) is the indicator function, \(\varepsilon_{i}\) is a Gaussian random function, and \(\epsilon_{i}(t)\) are iid standard normal for each \(i\) and \(t\) independent of \(\varepsilon_{i}\). For demonstration purpose only.

Usage

simulate_simple_dfrr(
  beta0 = function(t) {
     cos(pi * t + pi)
 },
  beta1 = function(t) {
     2 * t
 },
  X = rnorm(50),
  time = seq(0, 1, length.out = 24),
  sigma2 = 0.2
)

Value

This function returns a martix of binary values of dimension NxM where N denotes the length of X and M stands for the length of time.

Arguments

beta0, beta1

(optional) functional intercept and slope parameters

X

an (optional) vector consists of scalar covariate

time

an (optional) vector of time points for which, each sample curve is observed at.

sigma2

variance of the measurement error in the dfrr model

Examples

Run this code
N<-50;M<-24
X<-rnorm(N,mean=0)
time<-seq(0,1,length.out=M)
Y<-simulate_simple_dfrr(beta0=function(t){cos(pi*t+pi)},
                        beta1=function(t){2*t},
                        X=X,time=time)

Run the code above in your browser using DataLab