model.cons {survPen}R Documentation

Design and penalty matrices for the model

Description

Sets up the model before optimization. Builds the design matrix, the penalty matrix and all the design matrices needed for Gauss-Legendre quadrature.

Usage

model.cons(
  formula,
  lambda,
  data.spec,
  t1,
  t1.name,
  t0,
  t0.name,
  event,
  event.name,
  expected,
  expected.name,
  type,
  n.legendre,
  cl,
  beta.ini
)

Arguments

formula

formula object identifying the model

lambda

vector of smoothing parameters

data.spec

data frame that represents the environment from which the covariate values and knots are to be calculated

t1

vector of follow-up times

t1.name

name of t1 in data.spec

t0

vector of origin times (usually filled with zeros)

t0.name

name of t0 in data.spec

event

vector of censoring indicators

event.name

name of event in data.spec

expected

vector of expected hazard

expected.name

name of expected in data.spec

type

"net" or "overall"

n.legendre

number of nodes for Gauss-Legendre quadrature

cl

original survPen call

beta.ini

initial set of regression parameters

Value

List of objects with the following items:

cl

original survPen call

type

"net" or "overall"

n.legendre

number of nodes for Gauss-Legendre quadrature. If is.pwcst is TRUE, for simplicity of implementation, n.legendre actually corresponds to the number of sub-intervals

n

number of individuals

p

number of parameters

X.para

design matrix associated with fully parametric parameters (unpenalized)

X.smooth

design matrix associated with the penalized parameters

X

design matrix for the model

is.pwcst

TRUE if there is a piecewise constant (excess) hazard specification. In that case the cumulative hazard can be derived without Gauss-Legendre quadrature

pwcst.breaks

if is.pwcst is TRUE, vector of breaks defining the sub-intervals on which the hazard is constant. Otherwise NULL.

pwcst.weights

if is.pwcst is TRUE, matrix of weights giving the time contribution of each individual on each sub-interval. Otherwise NULL.

leg

list of nodes and weights for Gauss-Legendre integration on [-1;1] as returned by gauss.quad

X.GL

list of matrices (length(X.GL)=n.legendre) for Gauss-Legendre quadrature

S

penalty matrix for the model. Sum of the elements of S.list

S.scale

vector of rescaling factors for the penalty matrices

rank.S

rank of the penalty matrix

S.F

balanced penalty matrix as described in section 3.1.2 of (Wood,2016). Sum of the elements of S.F.list

U.F

Eigen vectors of S.F, useful for the initial reparameterization to separate penalized ad unpenalized subvectors. Allows stable evaluation of the log determinant of S and its derivatives

S.smf

List of penalty matrices associated with all "smf" calls

S.tensor

List of penalty matrices associated with all "tensor" calls

S.tint

List of penalty matrices associated with all "tint" calls

S.rd

List of penalty matrices associated with all "rd" calls

smooth.name.smf

List of names for the "smf" calls associated with S.smf

smooth.name.tensor

List of names for the "tensor" calls associated with S.tensor

smooth.name.tint

List of names for the "tint" calls associated with S.tint

smooth.name.rd

List of names for the "rd" calls associated with S.rd

S.pen

List of all the rescaled penalty matrices redimensioned to df.tot size. Every element of pen noted pen[[i]] is made from a penalty matrix returned by smooth.cons and is multiplied by the factor S.scale=norm(X,type="I")^2/norm(pen[[i]],type="I")

S.list

Equivalent to S.pen but with every element multiplied by its associated smoothing parameter

S.F.list

Equivalent to S.pen but with every element divided by its Frobenius norm

lambda

vector of smoothing parameters

df.para

degrees of freedom associated with fully parametric terms (unpenalized)

df.smooth

degrees of freedom associated with penalized terms

df.tot

df.para + df.smooth

list.smf

List of all smf.smooth.spec objects contained in the model

list.tensor

List of all tensor.smooth.spec objects contained in the model

list.tint

List of all tint.smooth.spec objects contained in the model

nb.smooth

number of smoothing parameters

Z.smf

List of matrices that represents the sum-to-zero constraints to apply for smf splines

Z.tensor

List of matrices that represents the sum-to-zero constraints to apply for tensor splines

Z.tint

List of matrices that represents the sum-to-zero constraints to apply for tint splines

beta.ini

initial set of regression parameters

Examples


library(survPen)

# standard spline of time with 4 knots

data <- data.frame(time=seq(0,5,length=100),event=1,t0=0)

form <- ~ smf(time,knots=c(0,1,3,5))

t1 <- eval(substitute(time), data)
t0 <- eval(substitute(t0), data)
event <- eval(substitute(event), data)

# The following code sets up everything we need in order to fit the model
model.c <- model.cons(form,lambda=0,data.spec=data,t1=t1,t1.name="time",
t0=rep(0,100),t0.name="t0",event=event,event.name="event",
expected=NULL,expected.name=NULL,type="overall",n.legendre=20,
cl="survPen(form,data,t1=time,event=event)",beta.ini=NULL)


[Package survPen version 1.6.0 Index]