plotRegion {DALSM}R Documentation

Plot a credible region for a curve together with its point estimates

Description

Plot a credible region (in grey) for a curve together with its point estimates.

Usage

plotRegion(x,mat,
       add=FALSE, xlim=range(x), ylim=range(mat),
       lwd=2, xlab="", ylab="", main="", ...)

Arguments

x

vector of values where the curve is evaluated.

mat

cbind(f.hat,f.low,f.up) is a matrix containing the point estimates <f.hat> and the liming values <f.low> and <f.up> for the credible region.

add

Logical indicating if the plot must be added to the active plot (Default: FALSE).

xlim

range of <x> values for which the plot should be provided.

ylim

range of curve values that should be considered for the plot.

lwd

line width for the plot (Default: 2).

xlab

x-label.

ylab

y-label.

main

main title.

...

optional plotting parameters.

Value

No returned value (just a plot)

Author(s)

Philippe Lambert p.lambert@uliege.be

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>

See Also

DALSM, DALSM.object.

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)
## par(mfrow=c(1,2),mar=c(4,5,1,1))
with(obj$f.loc.grid$age, plotRegion(x, y.mat,
     xlab="age", ylab=expression('f'[1]^{~mu}*(age))))
with(obj$f.disp.grid$age, plotRegion(x, y.mat,
     xlab="age", ylab=expression('f'[1]^{~sigma}*(age))))

[Package DALSM version 0.9.1 Index]