cumbasehaz {plsmselect}R Documentation

Cumulative Baseline Hazard of a gamlasso object

Description

This is only used when with family="cox"

Usage

cumbasehaz(object)

Arguments

object

fitted model object of the class gamlasso as produced by gamlasso

Value

This function returns the cumulative baseline hazard function of a gamlasso object if fitted using family = "cox". More specifically, cumbasehaz(object) is the cumulative baseline hazard function corresponding to the linear predictor predict(object).

See Also

gamlasso

Examples

library(plsmselect)

data(simData)

## Fit Cox gamlasso model using the formula approach:
## (L1-penalty both on X terms and smooth terms (bs="ts"))
simData$X = model.matrix(~x1+x2+x3+x4+x5+x6+x7+x8+x9+x10, data=simData)[,-1]

cfit = gamlasso(time ~ X +
                  s(z1, bs="ts", k=5) +
                  s(z2, bs="ts", k=5) +
                  s(z3, bs="ts", k=5) +
                  s(z4, bs="ts", k=5),
                data = simData,
                family = "cox",
                weights="status",
                seed=1)

## Obtain and plot predicted cumulative baseline hazard:
H0.pred <- cumbasehaz(cfit)

time.seq <- seq(0, 60, by=1)
plot(time.seq, H0.pred(time.seq), type="l", ylab="Predicted Cumulative Baseline Hazard")

## Obtain predicted survial probabilities at month 1 and 2 (days 30 & 60):

lp <- predict(cfit) # estimated linear predictor

S.pred <- cbind(exp(-H0.pred(30)*exp(lp)), exp(-H0.pred(60)*exp(lp)))

## Obtain predicted survival at month 1 and 2 directly:
S.pred2 <- predict(cfit, type="response", new.event.times=c(30,60))

## Confirm that the two arrived at the same values:
all.equal(S.pred, S.pred2)

# See ?gamlasso for an example fitting a gaussian response model
# See ?summary.gamlasso for an example fitting a binomial response model
# See ?predict.gamlasso for an example fitting a poisson response model

[Package plsmselect version 0.2.0 Index]