model.cons | R Documentation |
Sets up the model before optimization. Builds the design matrix, the penalty matrix and all the design matrices needed for Gauss-Legendre quadrature.
model.cons(
formula,
lambda,
data.spec,
t1,
t1.name,
t0,
t0.name,
event,
event.name,
expected,
expected.name,
type,
n.legendre,
cl,
beta.ini
)
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 |
t0 |
vector of origin times (usually filled with zeros) |
t0.name |
name of |
event |
vector of censoring indicators |
event.name |
name of event in |
expected |
vector of expected hazard |
expected.name |
name of expected in |
type |
"net" or "overall" |
n.legendre |
number of nodes for Gauss-Legendre quadrature |
cl |
original |
beta.ini |
initial set of regression parameters |
List of objects with the following items:
cl |
original |
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 |
X.GL |
list of matrices ( |
S |
penalty matrix for the model. Sum of the elements of |
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 |
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 |
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 |
|
list.smf |
List of all |
list.tensor |
List of all |
list.tint |
List of all |
nb.smooth |
number of smoothing parameters |
Z.smf |
List of matrices that represents the sum-to-zero constraints to apply for |
Z.tensor |
List of matrices that represents the sum-to-zero constraints to apply for |
Z.tint |
List of matrices that represents the sum-to-zero constraints to apply for |
beta.ini |
initial set of regression parameters |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.