smPtFCRegCoef {fdaconcur}R Documentation

Smooth the concurrent effects functions in a ptFCReg object using local linear regression. The local linear regression is implemented using the function Lwls1D.

Description

Smooth the concurrent effects functions in a ptFCReg object using local linear regression. The local linear regression is implemented using the function Lwls1D.

Usage

smPtFCRegCoef(object, bw, kernel_type)

Arguments

object

An object of class ptFCReg returned by the function ptFCReg.

bw

Scalar holding the bandwidth.

kernel_type

Character holding the kernel type (see Lwls1D for supported kernels).

Value

An object of class ptFCReg, where the fields beta0 and beta hold the smoothed intercept functions and concurrent effects functions, respectively. See ptFCReg for a complete list of the fields.

Examples

set.seed(1)
n <- 50
nGridIn <- 101
tGrid <- seq(0, 1, length.out=nGridIn) # Functional data support
muX1 <- tGrid * 2 # mean function for X_1
sigma <- 1
beta0 <- 0
beta <- rbind(cos(tGrid), 1.5 + sin(tGrid))
Z <- MASS::mvrnorm(n, rep(0, 2), diag(2))
X_1 <- Z[, 1, drop=FALSE] %*% matrix(1, 1, nGridIn) + matrix(muX1, n, nGridIn, byrow=TRUE)
epsilon <- rnorm(n, sd=sigma)
Y <- t(sapply(seq_len(n), function(i) {
  beta0 + beta[1,] * X_1[i, ] + beta[2,] * Z[i, 2] + epsilon[i]
}))
dat <- list(X1=X_1, Z1=Z[, 2], Y=Y)
res <- ptFCReg(tGrid = tGrid, dat = dat)
smres <- smPtFCRegCoef(res, bw = 2.5 / (nGridIn-1), kernel_type = 'epan')

[Package fdaconcur version 0.1.3 Index]