Title: | Estimating Regularized Multi-state Models Using L1 Penalties |
---|---|
Description: | Structured fusion Lasso penalized estimation of multi-state models with the penalty applied to absolute effects and absolute effect differences (i.e., effects on transition-type specific hazard rates). |
Authors: | Holger Reulen |
Maintainer: | Holger Reulen <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.99 |
Built: | 2025-03-07 03:03:04 UTC |
Source: | https://github.com/cran/penMSM |
This function calculates the risksets needed to calculate the partial likelihood of a multistate model, and/or it's derivatives.
buildrisksets(entry, exit, trans, event, trace)
buildrisksets(entry, exit, trans, event, trace)
entry |
vector with entry times. |
exit |
vector with exit times. |
trans |
vector with transition types. |
event |
vector with noncensoring event indicators. |
trace |
logical triggering printout of status information during the fitting process. |
This function calculates risksets.
A list of length 2 with elements Ci
and Ri
, each
vectors of length n
.
Holger Reulen
This function calculates the first derivative of the locally quadratic approximated penalty.
dapproxpenalty(psv, beta, constant)
dapproxpenalty(psv, beta, constant)
psv |
penalty structure vector that determines the l-th penalty component when multyplied with |
beta |
vector of regression coefficients. |
constant |
constant that is needed for the locally (in the neighborhood of 0) quadratical approximation of the absolute value function. |
This function calculates the first derivative of the locally quadratic approximated penalty.
The value of the derivative.
Holger Reulen
## Not run: almatrix(psv, beta, constant)
## Not run: almatrix(psv, beta, constant)
Second partial derivative of the log partial likelihood with respect to the linear predictor.
ddlpl(b, X, Ri, Ci)
ddlpl(b, X, Ri, Ci)
b |
vector of regression coefficients. |
X |
design matrix. |
Ri |
list of length |
Ci |
list of length |
This function calculates the second partial derivative of the log partial likelihood.
A vector with second gradients.
Holger Reulen
## Not run: ddlpl(b, X, Ri, Ci)
## Not run: ddlpl(b, X, Ri, Ci)
Calculates the first partial derivative of the log partial likelihood with respect to the linear predictor.
dlpl(event, b, X, Ri, Ci)
dlpl(event, b, X, Ri, Ci)
event |
non-censoring event indicator. |
b |
vector of regression coefficients |
X |
design matrix |
Ri |
list of length |
Ci |
list of length |
This function calculates the first derivative of the log partial likelihood of a Cox type multistate model.
A vector with the values of the partial first derivatives of the log partial likelihood with respect to the regression effects.
Holger Reulen
## Not run: dlpl(event, b, X, Ri, Ci)
## Not run: dlpl(event, b, X, Ri, Ci)
This function implements the first derivative of the penalty function.
dpenaltyfunction(psv, beta)
dpenaltyfunction(psv, beta)
psv |
penalty structure vector. |
beta |
estimated regression effects. |
This function implements the first derivative of the penalty function with respect to the penalty. The term 'penalty function' is described in detail on p. 4 in Oelker, Tutz (2013): A General Family of Penalties for Combining Differing Types of Penalties in Generalized Structured Models.
Value of the first derivative of the penalty function (note: this is always 1, since the penalty fucntion p(xi)=xi is just the identity).
Holger Reulen
## Not run: dpenaltyfunction(psv, beta)
## Not run: dpenaltyfunction(psv, beta)
This function provides a fast implementation for the calculation of the Fisher information matrix needed for the estimation of fusion lasso penalized multi-state models in a piece-wise exponential framework.
fishercpp(Xcpp, mucpp)
fishercpp(Xcpp, mucpp)
Xcpp |
... |
mucpp |
... |
...
...
Holger Reulen
## Not run: fishercpp(Xcpp, mucpp)
## Not run: fishercpp(Xcpp, mucpp)
This function calculates the Fisher information matrix needed for the estimation of multistate models using the Fisher scoring algorithm.
fisherinfo(beta, X, risksetlist, event)
fisherinfo(beta, X, risksetlist, event)
beta |
vector of regression coefficients. |
X |
design matrix. |
risksetlist |
list of length |
event |
non-censoring event indicator. |
This function implements the Fisher scoring matrix (i.e., the
second partial derivative of the log partial likelihood with respect
to the components of the regression effect vector beta
).
Fisher information matrix info
.
Holger Reulen
## Not run: fisherinfo(beta, X, risksetlist, event)
## Not run: fisherinfo(beta, X, risksetlist, event)
This function calculates the Fisher information matrix needed for the estimation of multistate models using the Fisher scoring algorithm.
fisherinfoP(mu, X)
fisherinfoP(mu, X)
mu |
mu. |
X |
design matrix. |
This function implements the Fisher scoring matrix (i.e., the
second partial derivative of the log partial likelihood with respect
to the components of the regression effect vector beta
).
Fisher information matrix info
.
Holger Reulen
## Not run: fisherinfo(mu, X)
## Not run: fisherinfo(mu, X)
Calculates the log likelihood for poisson regression.
llP(beta, X, event, offset)
llP(beta, X, event, offset)
beta |
vector of regression coefficients. |
X |
design matrix. |
event |
non-censoring event indicator. |
offset |
offset. |
This function calculates the Poisson log likelihood.
The values of the Poisson log likelihood.
Holger Reulen
## Not run: llP(beta, X, event, offset)
## Not run: llP(beta, X, event, offset)
Calculates the log partial likelihood.
lpl(beta, X, risksetlist, event)
lpl(beta, X, risksetlist, event)
beta |
vector of regression coefficients. |
X |
design matrix. |
risksetlist |
list of length |
event |
non-censoring event indicator. |
This function calculates the log partial likelihood of a Cox-type multistate model.
The values of the spell-specific log partial likelihood contributions.
Holger Reulen
## Not run: lpl(beta, X, risksetlist, event)
## Not run: lpl(beta, X, risksetlist, event)
This builds up a penalty matrix needed for the penalized estimation of multistate models.
penaltymatrix(lambda, PSM, beta, w, constant)
penaltymatrix(lambda, PSM, beta, w, constant)
lambda |
vector with penalty parameters for the respective penalty components. |
PSM |
penalty structure matrix containing the penalty structure vectors |
beta |
vector of regression coefficients. |
w |
vector containing weights for the respective penalty components. |
constant |
constat that is needed for the locally (in the neighborhood of 0) quadratical approximation of the absolute value function. |
This function calculates the penalty matrix needed for the penalized estimation of multistate models.
A penalty matrix plambda
.
Holger Reulen
## Not run: penaltymatrix(lambda, PSM, beta, w, constant)
## Not run: penaltymatrix(lambda, PSM, beta, w, constant)
L1 penalized estimation of multistate models.
penMSM(type = "fused", d, X, PSM1, PSM2, lambda1, lambda2, w, betastart, nu = 0.5, tol = 1e-10, max.iter = 50, trace = TRUE, diagnostics = TRUE, family = "coxph", poissonresponse = NULL, poissonoffset = NULL, constant.approx = 1e-8)
penMSM(type = "fused", d, X, PSM1, PSM2, lambda1, lambda2, w, betastart, nu = 0.5, tol = 1e-10, max.iter = 50, trace = TRUE, diagnostics = TRUE, family = "coxph", poissonresponse = NULL, poissonoffset = NULL, constant.approx = 1e-8)
type |
character defining the type of penalty, either |
d |
data set with variables (mandatory) |
X |
design matrix. |
PSM1 |
penalty structure matrix containing the penalty structure vectors |
PSM2 |
penalty structure matrix containing the penalty structure vectors |
lambda1 |
vector with penalty parameters for the respective penalty components (lasso part). |
lambda2 |
vector with penalty parameters for the respective penalty components (fusion part). |
w |
vector containing weights for the respective penalty components. |
betastart |
vector containing starting values for beta. |
nu |
numeric value denoting the weight, i.e. a value between 0 and 1, of the Fisher scoring updates. |
tol |
relative update tolerance for stopping of the estimation algorithm. |
max.iter |
number of maximum iterations if tlerance is not reached. |
trace |
logical triggering printout of status information during the fitting process. . |
diagnostics |
logical triggering that Fisher matrix, score vector, and approximated penalty matrix are returned with the results. |
family |
character defining the likelihood to be used. |
poissonresponse |
response values for poisson likelihood (if used). |
poissonoffset |
offset values for poisson likelihood (if used). |
constant.approx |
constant for locally squared approximation of the absolute value penalty function. |
This function is the core function of this package. It implements L1 penalized estimation of multistate models, with the penalty applied to absolute effects and absolute effect differences on transition-type specific hazard rates.
A list with elements B
(matrix with estimated
effects), aic
(Akaike Information Criterion), gcv
(GCV
criterion), df
(degrees of freedom), and (if diagnostics
are requested)
F
(Fisher matrix), s
(score vector), and
A
(approximated penalty matrix).
Holger Reulen
## Not run: penMSMtype = "fused", d, X, PSM1, PSM2, lambda1, lambda2, w, betastart, nu = 0.5, tol = 1e-10, max.iter = 50, trace = TRUE, diagnostics = TRUE, family = "coxph", poissonresponse = NULL, poissonoffset = NULL, constant.approx = 1e-8) ## End(Not run)
## Not run: penMSMtype = "fused", d, X, PSM1, PSM2, lambda1, lambda2, w, betastart, nu = 0.5, tol = 1e-10, max.iter = 50, trace = TRUE, diagnostics = TRUE, family = "coxph", poissonresponse = NULL, poissonoffset = NULL, constant.approx = 1e-8) ## End(Not run)
This function establishes the single vectors that set up
the penalty matrix in function penaltymatrix
.
plmatrix(psv, beta, constant)
plmatrix(psv, beta, constant)
psv |
index vector that determines the l-th penalty component
when multiplied with |
beta |
vector of regression coefficients. |
constant |
constant that is needed for the locally (in the neighborhood of 0) quadratical approximation of the absolute value function. |
This function calculates the value of the l-th penalty component, which is a locally (in the neighborhood of 0) quadratical approximation of the absolute value of a regression coefficient, or the difference between two coefficients, respectively.
The object result
takes the value of the l-th penalty
component.
Holger Reulen
## Not run: plmatrix(psv, beta, constant)
## Not run: plmatrix(psv, beta, constant)
This function calculates the score vector needed for the estimation of multistate models using the Fisher scoring algorithm.
scorevector(beta, X, risksetlist, event)
scorevector(beta, X, risksetlist, event)
beta |
vector of regression coefficients. |
X |
design matrix. |
risksetlist |
list of length |
event |
non-censoring event indicator. |
This function implements the score vector (i.e., the
first partial derivative of the log partial likelihood with respect
to the components of the regression effect vector beta
).
Score vector scorevector
.
Holger Reulen
## Not run: scorevector(beta, X, risksetlist, event)
## Not run: scorevector(beta, X, risksetlist, event)
This function calculates the score vector needed for the estimation of multistate models using the Fisher scoring algorithm.
scorevectorP(mu, X, event)
scorevectorP(mu, X, event)
mu |
mu. |
X |
design matrix. |
event |
non-censoring event indicator. |
This function implements the score vector (i.e., the
first partial derivative of the Poisson log likelihood with respect
to the components of the regression effect vector beta
).
Score vector scorevector
.
Holger Reulen
## Not run: scorevectorP(beta, X, event)
## Not run: scorevectorP(beta, X, event)
This function calculates the score vector and the Fisher information matrix needed for the estimation of multistate models using the Fisher scoring algorithm.
sF(mu, X, event)
sF(mu, X, event)
mu |
mu. |
X |
design matrix. |
event |
non-censoring event indicator. |
This function implements the score vector and Fisher information matrix.
s and F.
Holger Reulen
## Not run: sF(mu, X, event)
## Not run: sF(mu, X, event)