FLM1: Functional Linear Models New

View source: R/FLM1.R

FLM1R Documentation

Functional Linear Models New

Description

Functional linear models for scalar or functional responses and functional predictors.

Usage

FLM1(Y, X, XTest = NULL, optnsListY = NULL, optnsListX = NULL, nPerm = NULL)

Arguments

Y

Either an n-dimensional vector whose elements consist of scalar responses, or a list which contains functional responses in the form of a list LY and the time points LT at which they are observed (i.e., list(Ly = LY,Lt = LT)).

X

A list of either (1) lists which contains the observed functional predictors list Lxj and the time points list Ltj at which they are observed. It needs to be of the form list(list(Ly = Lx1,Lt = Lxt1),list(Ly = Lx2,Lt = Lxt2),...); (2) a matrix containing one or more scalar covariates; or (3) a mix of (1) and (2), in which case the scalar covariates must come after the functional ones(TODO).

XTest

A list which contains the values of functional predictors for a held-out testing set.

optnsListY

A list of options control parameters for the response specified by list(name=value). See ‘Details’ in FPCA.

optnsListX

Either (1) A list of options control parameters for the predictors specified by list(name=value); or (2) A list of list of options, e.g. list(list(name1=value1), list(name2=value2)). See ‘Details’ in FPCA.

nPerm

If this argument is specified, perform a permutation test to obtain the (global) p-value for the test of regression relationship between X and Y. Recommend to set to 1000 or larger if specified.

Value

A list of the following:

alpha

A length-one numeric if the response Y is scalar. Or a vector of length(workGridY) of the fitted constant alpha(t) in the linear model if Y is functional.

betaList

A list of fitted beta(s) vectors, one entry per functional predictor and one entry for all scalar predictors, if Y is scalar. Each of dimension length(workGridX[[j]]).

Or a list of fitted beta(s,t) matrices, one per predictor, if Y is functional. Each of dimension length(workGridX[[j]]) times length(workGridY).

R2

The functional R2

pv

Permutation p-value based on the functional R2. NA if nPerm is NULL

yHat

A length n vector if Y is scalar.

Or an n by length(workGridY) matrix of fitted Y's from the model if Y is functional.

yPred

Same as YHat if XTest is not provided.

Or a length length(XTest[[1]]$Ly) vector of predicted Y's if Y is scalar.

Or a length(XTest[[1]]$Ly) by length(workGridY) matrix of predicted Y's if Y is functional.

estXi

A list of n by k_j matrices of estimated functional principal component scores of predictors, where k_j is the number of eigenfunctions selected for each predictor.

testXi

A list of n by k_j matrices of estimated functional principal component scores of predictors in XTest, with eigenfunctions fitted only with X.

lambdaX

A length sum_j k_j vector of estimated eigenvalues for predictors.

workGridX

A list of vectors, each is a working grid for a predictor.

optnsListX

A list of list of options actually used by the FPCA for the predictor functions

optnsListY

A list of options actually used by the FPCA for the response functions

phiY

A length(workGridY) by k_y the estimated eigenfunctions of Y's, where k_y is number of eigenfunctions selected for Y. NULL if Y is scalar.

workGridY

A vector of working grid of the response Y's. NULL if Y is scalar

muY

The mean or the mean function of the response


fdapace documentation built on Aug. 16, 2022, 5:10 p.m.