Extraction of the estimated additive terms in a DALSM.object
Extraction of the estimated additive terms in a DALSM.object
Extract the estimated additive terms with their standard errors from a DALSM.object resulting from the fit of a DALSM model. In addition to the estimated functions in the location and dispersion submodels, their values on a regular grid covering the observed covariate values are reported together with credible intervals. The mean effective coverage of these pointwise credible intervals for the additive terms with respect to given (optional) reference functions (such as the ones for the 'true' additive terms used to generate data in a simulation study) can also be computed.
ngrid: (optional) grid size of covariate values where the additive terms are calculated (default: 101).
true.loc: (optional) list of functions containing the 'true' additive terms in the location sub-model.
true.disp: (optional) list of functions containing the 'true' additive terms in the dispersion sub-model.
ci.level: (optional) level of credible intervals.
verbose: logical indicating whether the computed corverages should be printed out (default: TRUE).
Returns
It returns an invisible list containing:
J1 : number of additive terms in the location sub-model.
labels.loc : labels of the additive terms in the location sub-model.
f.loc.grid : list of length J1 with, for each additive term, a list of length 3 with elements 'x': a vector of ngrid values for the covariate ; 'y.mat': a matrix with 3 columns (est,low,up) giving the additive term and its pointwise credible region ; se: the standard error of the additive term on the x-grid.
f.loc : a list of length J1 with, for each additive term <x>, a list with f.locx:afunctioncomputingtheadditivetermf.loc(x)foragivencovariatevalue′x′;attributes(f.locx): support, label, range.
se.loc : a list of length J1 with, for each additive term <x>, a list with se.locx:afunctioncomputingthes.e.off(x)foragivencovariatevalue′x′;attributes(se.locx): support, label, range.
coverage.loc : if true.loc is provided: a vector of length J1 giving the average effective coverage of pointwise credible intervals for each of the additive terms in the location sub-model.
J2 : number of additive terms in the dispersion sub-model.
labels.disp : labels of the additive terms in the dispersion sub-model.
f.disp.grid : list of length J2 with, for each additive term, a list of length 3 with elements 'x': a vector of ngrid values for the covariate ; 'y.mat': a matrix with 3 columns (est,low,up) giving the additive term and its pointwise credible region ; se: the standard error of the additive term on the x-grid.
f.disp : a list of length J2 with, for each additive term <x>, a list with f.dispx:afunctioncomputingtheadditivetermf.disp(x)foragivencovariatevalue′x′;attributes(f.dispx): support, label, range.
se.disp : a list of length J2 with, for each additive term <x>, a list with se.dispx:afunctioncomputingthes.e.off(x)foragivencovariatevalue′x′;attributes(se.dispx): support, label, range.
coverage.disp : if <true.disp> is provided: a vector of length J2 giving the average effective coverage of pointwise credible intervals for each of the additive terms in the dispersion sub-model.
Examples
require(DALSM)data(DALSM_IncomeData)resp = DALSM_IncomeData[,1:2]fit = DALSM(y=resp, formula1 =~twoincomes+s(age)+s(eduyrs), formula2 =~twoincomes+s(age)+s(eduyrs), data = DALSM_IncomeData)obj = DALSM_additive(fit)str(obj)## Visualize the estimated additive terms for Age## ... in the location submodelwith(obj$f.loc.grid$age, matplot(x,y.mat, xlab="Age",ylab="f.loc(Age)", type="l",col=1,lty=c(1,2,2)))## ... and in the dispersion submodelwith(obj$f.disp.grid$age, matplot(x,y.mat, xlab="Age",ylab="f.disp(Age)", type="l",col=1,lty=c(1,2,2)))## Also report their values for selected age valuesobj$f.loc$age(c(30,40,50)); obj$f.disp$age(c(30,40,50))## ... together with their standard errorsobj$se.loc$age(c(30,40,50)); obj$se.disp$age(c(30,40,50))
References
Lambert, P. (2021). Fast Bayesian inference using Laplace approximations in nonparametric double additive location-scale models with right- and interval-censored data. Computational Statistics and Data Analysis, 161: 107250. doi:10.1016/j.csda.2021.107250