expectreg.ipc {dirttee}  R Documentation 
This function extends expectile regression with inverse probability of censoring (IPC) weights to rightcensored data.
expectreg.ipc(
formula,
data = NULL,
smooth = c("schall", "ocv", "aic", "bic", "cvgrid", "lcurve", "fixed"),
lambda = 1,
expectiles = NA,
LAWSmaxCores = 1,
IPC_weights = c("IPCRR", "IPCKM"),
KMweights = NULL,
ci = FALSE,
hat1 = FALSE
)
formula 
A formula object, with the response on the left of the ‘~’
operator, and the terms on the right. The response must be a

data 
Optional data frame containing the variables used in the model, if the data is not explicitly given in the formula. 
smooth 
The smoothing method that shall be used.
There are different smoothing algorithms that should prevent overfitting. The ' 
lambda 
The fixed penalty can be adjusted. Also serves as starting value for the smoothing algorithms. 
expectiles 
In default setting, the expectiles (0.01,0.02,0.05,0.1,0.2,0.5,0.8,0.9,0.95,0.98,0.99) are calculated. You may specify your own set of expectiles in a vector. 
LAWSmaxCores 
How many cores should maximally be used by parallelization. Currently only implemented for Unixlike OS. 
IPC_weights 
Denotes the kind of IPC weights to use. 
KMweights 
Custom IPC weights can be supplied here. This argument is used by 
ci 
If TRUE, calculates the covariance matrix 
hat1 
If TRUE, the hat matrix for the last asymetry level is calculated. This argument is mainly used by 
Fits least asymmetrically weighted squares (LAWS) for each expectile. This function is intended
for rightcensored data. For uncensored data, expectreg.ls
should be used instead.
This function modifies expectreg.ls
by adding IPC weights. See Seipp et al. (2021) for details on
the IPC weights. Psplines can be used with rb
. The Schall algorithm is used for choosing the penalty.
A list with the following elements.
lambda 
The final smoothing parameters for all expectiles and for all effects in a list. 
intercepts 
The intercept for each expectile. 
coefficients 
A matrix of all the coefficients, for each base element a row and for each expectile a column. 
values 
The fitted values for each observation and all expectiles, separately in a list for each effect in the model, sorted in order of ascending covariate values. 
response 
Vector of the response variable. 
covariates 
List with the values of the covariates. 
formula 
The formula object that was given to the function. 
asymmetries 
Vector of fitted expectile asymmetries as given by argument 
effects 
List of characters giving the types of covariates. 
helper 
List of additional parameters like neighbourhood structure for spatial effects or 
design 
Complete design matrix. 
bases 
Bases components of each covariate. 
fitted 
Fitted values. 
covmat 
Covariance matrix. 
diag.hatma 
Diagonal of the hat matrix. Used for model selection criteria. 
data 
Original data. 
smooth_orig 
Unchanged original type of smoothing. 
KMweights 
Vector with IPC weights used in fitting. 
aic 
Area under the AIC, approximated with a Riemannian sum. 
hat 
The hat matrix for the last asymmetry level. This is used by 
Seipp, A, Uslar, V, Weyhe, D, Timmer, A, OttoSobotka, F. Weighted expectile regression for rightcensored data. Statistics in Medicine. 2021; 40(25): 5501 5520. https://doi.org/10.1002/sim.9137
data(colcancer)
# linear effect
expreg < expectreg.ipc(Surv(logfollowup, death) ~ sex + age, data = colcancer,
expectiles = c(0.05, 0.2, 0.5, 0.8, 0.95))
coef(expreg)
# with psplines, smoothing parameter selection with schall algorithm
expreg2 < expectreg.ipc(Surv(logfollowup, death) ~ sex + rb(age), data = colcancer)
# smoothing parameter selection with AIC
expreg3 < expectreg.ipc(Surv(logfollowup, death) ~ sex + rb(age), data = colcancer, smooth = "aic")
# manually selected smoothing parameter
expreg4 < expectreg.ipc(Surv(logfollowup, death) ~ sex + rb(age), data = colcancer,
smooth = "fixed", lambda = 2)
plot(expreg2)
plot(expreg3)
plot(expreg4)