Learn R Programming

sglg (version 0.2.2)

ssurvglg: Fitting semi-parametric generalized log-gamma regression models under the presence of right censored data.

Description

ssurvglg is used to fit a semi-parametric regression model in which the response variable is continuous, strictly positive, asymmetric and there are right censored observations. In this setup, the location parameter of the logarithm of the variable is explicitly modeled by semi-parametric functions, whose nonparametric components may be approximated by natural cubic splines or cubic P-splines.

Usage

ssurvglg(formula, npc, basis, data, shape, alpha0, Maxiter, Tolerance)

Value

mu a vector of parameter estimates asociated with the location parameter.

sigma estimate of the scale parameter associated with the model.

lambda estimate of the shape parameter associated with the model.

interval estimate of a 95% confidence interval for each estimate parameters associated with the model.

Deviance the deviance associated with the model.

Arguments

formula

a symbolic description of the systematic component of the model to be fitted. See details for further information.

npc

a data frame with potential nonparametric variables of the systematic part of the model to be fitted.

basis

a name of the cubic spline basis to be used in the model. Supported basis include deBoor and Gu basis which are a B-spline basis and a natural cubic spline basis, respectively.

data

an optional data frame, list containing the variables in the model.

shape

an optional value for the shape parameter of the model.

alpha0

is a vector of initial values for the smoothing parameter alpha.

Maxiter

an optional positive integer giving the maximal number of iterations for the estimating process. Default value is 1e03.

Tolerance

an optional positive value, which represents the convergence criterion. Default value is 1e-04.

Author

Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>

References

Carlos A. Cardozo, G. Paula and L. Vanegas. Semi-parametric accelerated failure time models with generalized log-gamma erros: Censored case. In preparation.

Cardozo C.A., Paula G., and Vanegas L. (2022). Generalized log-gamma additive partial linear models with P-spline smoothing. Statistical Papers.

Examples

Run this code
require(survival)
rows    <- 150
columns <- 2
t_beta  <- c(0.5, 2)
t_sigma <- 0.5
t_lambda <- 1
set.seed(8142030)
x1 <- rbinom(rows, 1, 0.5)
x2 <- runif(rows, 0, 1)
X <- cbind(x1,x2)
t_knot1 <- 6
ts1 <- seq(0, 1, length = t_knot1)
t_g1 <- 0.4 * sin(pi * ts1)
BasisN <- function(n, knot) {
N <- matrix(0, n, knot)
m <- n/knot
block <- rep(1,m)
for (i in 1:knot) {
   l <- (i - 1) * m + 1
 r <- i * m
  N[l:r, i] <- block }
return(N)
 }
s_N1 <- BasisN(rows, length(ts1))
x3 <- s_N1 %*% ts1
colnames(x3) <- 'x3'
sys       <- X %*% t_beta + s_N1%*%t_g1
t_ini1    <- exp(sys) * rweibull(rows,1/t_sigma,1)
cens.time <- rweibull(rows, 1.5, 14)
delta     <- ifelse(t_ini1 > cens.time, 1, 0)
obst1 = t_ini1
for(i in 1:rows) {
   if (delta[i] == 1) {
       obst1[i] = cens.time[i]
      }
}
d_example <- data.frame(obst1, delta, X, x3)
fit4 <- ssurvglg(Surv(log(obst1),delta)~ x1 + x2 - 1,npc=x3,data = d_example,shape=0.9)
summary(fit4)

Run the code above in your browser using DataLab