survPen.fit: (Excess) hazard model with multidimensional penalized splines...

View source: R/survPenV1_60.r

survPen.fitR Documentation

(Excess) hazard model with multidimensional penalized splines for given smoothing parameters

Description

Fits an (excess) hazard model. If penalized splines are present, the smoothing parameters are specified.

Usage

survPen.fit(
  build,
  data,
  formula,
  max.it.beta = 200,
  beta.ini = NULL,
  detail.beta = FALSE,
  method = "LAML",
  tol.beta = 1e-04
)

Arguments

build

list of objects returned by model.cons

data

an optional data frame containing the variables in the model

formula

formula object specifying the model

max.it.beta

maximum number of iterations to reach convergence in the regression parameters; default is 200

beta.ini

vector of initial regression parameters; default is NULL, in which case the first beta will be log(sum(event)/sum(t1)) and the others will be zero (except if there are "by" variables or if there is a piecewise constant hazard specification in which cases all betas are set to zero)

detail.beta

if TRUE, details concerning the optimization process in the regression parameters are displayed; default is FALSE

method

criterion used to select the smoothing parameters. Should be "LAML" or "LCV"; default is "LAML"

tol.beta

convergence tolerance for regression parameters; default is 1e-04. See NR.beta for details

Value

Object of class "survPen" (see survPenObject for details)

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)
	
# Setting up the model before fitting
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)
 
# fitting
mod <- survPen.fit(model.c,data,form)


survPen documentation built on Sept. 14, 2023, 1:06 a.m.