Predictions from Conditional LSS Objects

Share:

Description

This function computes predictions based on fitted conditional QLSS objects.

Usage

1
2
3
## S3 method for class 'qlss'
predict(object, newdata, interval = FALSE, level = 0.95, R = 200,
	na.action = na.pass, trim = 0.05, ...)

Arguments

object

an object as returned by qlss.formula.

newdata

an optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

interval

logical flag. If TRUE, confidence intervals for predictions are computed by bootstrap.

level

nominal coverage level of the confidence interval.

R

number of bootstrap replications used to compute confidence intervals.

na.action

function determining what should be done with missing values in newdata. The default is to predict NA.

trim

proportion of extreme bootstrap replications to be trimmed before standard errors are computed.

...

not used.

Author(s)

Marco Geraci

See Also

qlss.formula

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Fit QLSS object
trees2 <- trees[order(trees$Height),]
fit <- qlss(Volume ~ Height, data = trees2)

## Predict using newdata. Calculate confidence intervals using 200 bootstrap replications

xx <- seq(min(trees2$Height), max(trees2$Height), length = 100)
new <- data.frame(Height = xx)
set.seed(121)
fit.pred <- predict(fit, newdata = new, interval = TRUE, level = 0.95, R = 200)
plot(fit.pred, z = xx, interval = TRUE, xlab = "height")
# large confidence intervals for shape index due
# to small IQR at low values of height

# Restrict range for Height

xx <- seq(65, 87, length = 100)
new <- data.frame(Height = xx)
set.seed(121)
fit.pred <- predict(fit, newdata = new, interval = TRUE, level = 0.95, R = 200)
plot(fit.pred, z = xx, interval = TRUE, xlab = "height") # better

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.