| shape | R Documentation |
Tool that supports the estimation of the shape parameter in semi-parametric or multiple linear accelerated failure time model with generalized log-gamma errors under the presence of censored data. The estimation is based on the profiled likelihood function for the shape parameter of the model.
shape(formula, npc, data, interval, semi = FALSE, step = 0.05)
formula |
a symbolic description of the systematic component of the model to be fitted. |
npc |
a data frame with potential nonparametric variables of the systematic part of the model to be fitted. |
data |
a data frame which contains the variables in the model. |
interval |
an optional numerical vector of length 2. In this interval is the maximum likelihood estimate of the shape parameter of the model. By default is [0.05,1.5]. |
semi |
a logical value. TRUE means that the model has a non-parametric component. By default is FALSE. |
step |
an optional positive value. This parameter represents the length of the step of the partition of the interval parameter. By default is 0.05. |
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>
Carlos Alberto Cardozo Delgado, Semi-parametric generalized log-gamma regression models. Ph. D. thesis. Sao Paulo University.
rows <- 200
columns <- 2
t_beta <- c(0.5, 2)
t_sigma <- 1
t_lambda <- 1
set.seed(8142031)
x1 <- rbinom(rows, 1, 0.5)
x2 <- runif(rows, 0, 1)
X <- cbind(x1,x2)
s <- t_sigma^2
a <- 1/s
t_ini1 <- exp(X %*% t_beta) * rweibull(rows, scale = s, shape = a)
cens.time <- rweibull(rows, 0.75, 20)
delta <- ifelse(t_ini1 > cens.time, 1, 0)
obst1 = t_ini1
obst1[delta==1] <- cens.time[delta==1]
example <- data.frame(obst1,delta,X)
lambda <- shape(Surv(log(obst1),delta) ~ x1 + x2 - 1, data=example)
lambda
# To obtain even better estimates we can change the interval and/or step options
shape(Surv(log(obst1),delta) ~ x1 + x2 - 1, data=example, interval=c(0.945,0.97), step=0.001)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.