nlFRindex {Qindex}R Documentation

Nonlinear Functional Regression Indices

Description

Functions explained in this documentation are,

nlFRindex()

to compute the non-linear functional regression indices based on the functional predictors.

predict.FRindex()

to compute the predicted values based on functional regression indices model.

Usage

nlFRindex(
  formula,
  data,
  xarg = as.double(colnames(X)),
  family,
  fit = TRUE,
  ...
)

## S3 method for class 'nlFRindex'
predict(object, newdata, ...)

Arguments

formula

a two-sided formula.

Left-hand-side

is the name of the response y. Supported types of responses are double, logical and Surv.

Right-hand-side

is the name of the tabulated double matrix X of functional predictor values. Each row of X represents the tabulated values for a subject. All rows/subjects are tabulated on a common grid xarg. Each column of X represents the tabulated values at a point on the common grid for each subject.

data

data.frame, with the response y and the tabulated functional predictor values X specified in formula. If the functional predictor is the quantile function, then data is preferably the returned object of clusterQp().

xarg

numeric vector. The default argument comes from the column names of the matrix of tabulated functional predictor values X. This is particularly convenient when the functional predictor is the quantile function, and data is the returned object of function clusterQp(). The user-provided xarg will be checked such that

  1. xarg is a numeric vector without missingness

  2. length of xarg is the same as the number of columns of matrix X

  3. xarg must be strictly sorted (see is.unsorted)

Otherwise, an error message will be returned.

family

..

fit

logical scalar, see gam

...

additional parameters, currently not in use

object

an nlFRindex object for the predict method, the returned object from function nlFRindex()

newdata

data.frame, with at least the tabulated functional predictor values X^{new} based on object@formula

Details

Functional regression indices & weights model

Function nlFRindex() fits a non-linear functional regression model to the response y using the functional predictor X, with values tabulated on a same grid xarg for all subjects (Cui et al, 2021).

Predict method for non-linear functional regression indices

Function predict.nlFRindex() computes non-linear functional regression indices based on the tabulated functional predictors X^{new} in a new sets of subjects. It's important that the new tabulation grid must be exactly the same as the model tabulation grid object@xarg.

Value

Functional regression indices & weights model

Function nlFRindex() returns an S4 nlFRindex object. The slots of S4 class nlFRindex are described in section Slots.

Predict method for non-linear functional regression indices

Function predict.nlFRindex() returns a double vector, which is the predicted non-linear functional regression indices.

Slots

formula,data,xarg

see explanations in section Arguments

gam

gam object

p.value

numeric scalar, p-value for the test of significance of the functional predictor

index

double vector, functional regression indices.

References

Cui, E., Crainiceanu, C. M., & Leroux, A. (2021). Additive Functional Cox Model. Journal of Computational and Graphical Statistics. doi:10.1080/10618600.2020.1853550

Examples

pt = unique(Ki67$PATIENT_ID)
length(pt) # 622
# set.seed if necessary
train_pt = sample(pt, size = 500L)
Ki67q = clusterQp(Marker ~ ., data = Ki67, exclude = c('tissueID','inner_x','inner_y'))
train_q = subset(Ki67q, PATIENT_ID %in% train_pt)
test_q = subset(Ki67q, !(PATIENT_ID %in% train_pt))
train_q$Marker = log1p(train_q$Marker)
test_q$Marker = log1p(test_q$Marker)

# using Cox model
m = nlFRindex(Surv(RECFREESURV_MO, RECURRENCE) ~ Marker, data = train_q)
m@p.value # test significance of `Marker` as a functional predictor
train_index = predict(m, newdata = train_q) # non-linear FR index of training data
# stopifnot(identical(train_index, m@index))
predict(m, newdata = test_q) # non-linear FR index of test data

# using logistic regression model
nlFRindex(RECURRENCE ~ Marker, data = train_q)

# using Gaussian model
nlFRindex(RECFREESURV_MO ~ Marker, data = train_q)


[Package Qindex version 0.1.5 Index]