varmod {earth} | R Documentation |
Variance models for estimating prediction intervals
Description
A variance model estimates the variance of predicted values.
It can be used to estimate prediction intervals.
See the interval
argument of predict.earth
.
A variance model is built by earth
if earth
's
varmod.method
argument is specified.
Results are stored in the $varmod
field of the earth
model.
See the vignette “Variance models in earth” for details.
You probably won't need to directly call
print.varmod
or summary.varmod
.
They get called internally by summary.earth
.
Usage
## S3 method for class 'varmod'
summary(
object = stop("no 'object' argument"),
level = .95,
style = "standard",
digits = 2,
newdata = NULL,
...)
Arguments
object |
A |
level |
Same as |
style |
Determines how the coefficients of the |
digits |
Number of digits to print. Default is |
newdata |
Default |
... |
Dots are passed on. |
Note
A "varmod"
object has the following fields:
call
The call used internally in the parent model to build thevarmod
object.parent
The parentearth
model.method
Copy of thevarmod.method
argument to the parent model.package
NULL, unlessmethod="gam"
, in which case either"gam"
or"mgcv"
.exponent
Copy of thevarmod.exponent
argument to the parent model.lambda
Currently always 1, meaning use absolute residuals.rmethod
Currently always "hc2", meaning correct the residuals with1/(1-h_ii)
.converged
Did the residual submodel IRLS converge?iters
Number of residual model IRLS iterations (1 to 50).residmod
The residual submodel. So for example, ifvarmod.method="lm"
, this will be anlm
object.min.sd
The predicted residual standard deviation is clamped so it will always be at least this value. This prevents prediction of negative or absurdly small variances. Seeearth
'svarmod.clamp
argument. Clamping takes place inpredict.varmod
, which is called bypredict.earth
when estimating prediction intervals.model.var
An n x 1 matrix. Themodel.var
for an observation is the estimated model variance for that observation over all datasets, and is estimated with repeated cross validation. It is the variance of the mean out-of-fold prediction for that observation overncross
repetitions.abs.resids
An n x 1 matrix. The absolute residuals used to build the residual model.parent.x
An n x p matrix. Parent earth modelx
.parent.y
An n x 1 matrix. Parent earth modely
.iter.rsq
Weighted R-Squared of residual submodelresidmod
, after IRLS iteration.iter.stderr
Standard errors of the coefficients of the residual submodelresidmod
, after IRLS iteration.
See Also
Examples
data(ozone1)
set.seed(1) # optional, for cross validation reproducibility
# note: should really use ncross=30 below but for a quick demo we don't
earth.mod <- earth(O3~temp, data=ozone1, nfold=10, ncross=3, varmod.method="lm")
print(summary(earth.mod)) # note additional info on the variance model
old.mfrow <- par(mfrow=c(2,2), mar=c(3, 3, 3, 1), mgp=c(1.5, 0.5, 0))
plotmo(earth.mod, do.par=FALSE, response.col=1, level=.90, main="earth model: O3~temp")
plot(earth.mod, which=3, level=.90) # residual plot: note 90% pred and darker conf intervals
par(par=old.mfrow)