FunRegPoISim: FunRegPoISim

View source: R/FunRegPoISim.R

FunRegPoISimR Documentation

FunRegPoISim

Description

Data-Simulation following the Functional Linear Model with Points of Impact. FunRegPoISim generates data following the functional linear model with scalar response with additional points of impact (see Kneip et al. 2016). The random curves are draws of a Brownian Motion process.

Usage

FunRegPoISim(N, grd, DGP = c("Easy", "Complicated", "NoPoI", "OnlyPoI"),
  error_sd = 0.125, mean_X = 0, sd_X = 1)

Arguments

N

Size of drawn sample (hence, N curves are drawn as well as N corresponding observations of the scalar response variable).

grd

The grid where the functions are evaluated.

DGP

One of "Easy" , "Complicated" , "NoPoI" , "OnlyPoI". See details below.

error_sd

Standard deviation of the error term in the functional linear model.

mean_X

Numeric specifying the mean of the brownian motions.

sd_X

Numeric specifying the standard deviation of the Brownian Motion increments.

Details

FunRegPoISim simulates a sample of curves and corresponding observations of a scalar response variable following the functional linear model with points of impact. Such data can be used in the function FunRegPoI (see example below). The model is given by

Y = \int_0^1 β(t) X(t) \mathrm{d}t + ∑_{s=1}^S β_s X(τ_s) + ε.

The curves are draws from a Brownian Motion and the implementation currently permits to simulate four differend DGPs, named "Easy", "Complicated", "NoPoI" and "OnlyPoI". Their specification is as follows:

Easy

The beta function of the functional part is a polynomial of order 3: β(t) = -(t-1)^2 + 2 together with two points of impact which are located at 0.3 and 0.6 with coefficients -3 and 3.

Complicated

The beta function of the functional part is a polynomial of order 4: β(t) = -5(t-0.5)^3 - t + 1 together with three points of impact are located at 0.3, 0.4 and 0.6 with coefficients -3, 3 and 3.

NoPoI

The beta function of the functional part is the same as in Easy but the DGP does not include any further points of impact.

OnlyPoI

Only the points of impact of Easy are included.

Value

A list with entries

Y

A numeric vector of length N with the scalar outcome.

X

A p \times N matrix holding trajectories of the curves.

trueBetaPoI

A vector with the true values of the PoI-coefficients.

trueBetaCurve

A vector of length p with the evaluated beta-curve.

trueTauGrd

A vector with true values of the PoI-locations.

trueTauInd

A vector with indices of the true PoI-locations in grd.

Author(s)

Dominik Liebl, Stefan Rameseder and Christoph Rust

References

Kneip A., Poss, D., Sarda, P. (2016) Functional Linear Regression with Points of Impact. The Annals of Statistics, 44(1), 1-30.

See Also

FunRegPoI

Examples

## Not run: 
library(FunRegPoI)

## Define Parameters for Simulation
DGP_name    <- "Easy"
k_seq       <- c(1,seq(2, 62, 4))
error_sd    <- 0.125
N           <- 500
p           <- 300
domain      <- c(0,1)
grd         <- seq(domain[1],domain[2],length.out = p)

set.seed(1)
## simulate some data:
PoISim      <- FunRegPoISim(N = N , grd, DGP = DGP_name , error_sd = error_sd)

# PESES
EstPeses    <- FunRegPoI(Y = PoISim$Y , X_mat = PoISim$X , grd, estimator = "PESES", k_seq = k_seq)

# KPS
EstKPS      <- FunRegPoI(Y = PoISim$Y , X_mat = PoISim$X , grd, estimator = "KPS", k_seq = k_seq)

# CKS
EstCKS      <- FunRegPoI(Y = PoISim$Y , X_mat = PoISim$X , grd, estimator = "CKS")

par(mfrow=c(3,1))
plot(EstPeses, main = "PESES")
lines(x = grd , y = PoISim$trueBetaCurve , col ="red")
abline( v = PoISim$trueTauGrd , col ="red" , lwd = 2)
plot(EstKPS, main = "KPS")
lines(x = grd , y = PoISim$trueBetaCurve , col ="red")
abline( v = PoISim$trueTauGrd , col ="red" , lwd = 2)
plot(EstCKS, main = "KPS")
lines(x = grd , y = PoISim$trueBetaCurve , col ="red")
abline( v = PoISim$trueTauGrd , col ="red" , lwd = 2)
dev.off()

## End(Not run)


christophrust/FunRegPoI documentation built on April 10, 2022, 2:22 p.m.