NR.rho: Outer Newton-Raphson algorithm for smoothing parameters...

View source: R/survPenV1_60.r

NR.rhoR Documentation

Outer Newton-Raphson algorithm for smoothing parameters estimation via LCV or LAML optimization

Description

Applies Newton-Raphson algorithm for smoothing parameters estimation. Two specific modifications aims at guaranteeing convergence : first the hessian is perturbed whenever it is not positive definite and second, at each step, if LCV or -LAML is not minimized, the step is halved until it is.

Usage

NR.rho(
  build,
  rho.ini,
  data,
  formula,
  max.it.beta = 200,
  max.it.rho = 30,
  beta.ini = NULL,
  detail.rho = FALSE,
  detail.beta = FALSE,
  nb.smooth,
  tol.beta = 1e-04,
  tol.rho = 1e-04,
  step.max = 5,
  method = "LAML"
)

Arguments

build

list of objects returned by model.cons

rho.ini

vector of initial log smoothing parameters; if it is NULL, all log lambda are set to -1

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

max.it.rho

maximum number of iterations to reach convergence in the smoothing parameters; default is 30

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.rho

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

detail.beta

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

nb.smooth

number of smoothing parameters

tol.beta

convergence tolerance for regression parameters; default is 1e-04

tol.rho

convergence tolerance for smoothing parameters; default is 1e-04

step.max

maximum absolute value possible for any component of the step vector (on the log smoothing parameter scale); default is 5

method

LCV or LAML; default is LAML

Details

If we note val the current LCV or LAML value, val.old the previous one and grad the gradient vector of LCV or LAML with respect to the log smoothing parameters, the algorithm goes on while(abs(val-val.old)>tol.rho|any(abs(grad)>tol.rho))

Value

object of class survPen (see survPen.fit 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=0,expected.name=NULL,type="overall",n.legendre=20,
cl="survPen(form,data,t1=time,event=event)",beta.ini=NULL)
 
# Estimating the smoothing parameter and the regression parameters
# we need to apply a reparameterization to model.c before fitting
constructor <- repam(model.c)$build # model constructor
constructor$optim.rho <- 1 # we tell it we want to estimate the log smoothing parameters (rho)
Newton2 <- NR.rho(constructor,rho.ini=-1,data,form,nb.smooth=1,detail.rho=TRUE)


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