predict.qlss {Qtools}R Documentation

Predictions from Conditional LSS Objects

Description

This function computes predictions based on fitted conditional QLSS objects.

Usage

## 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


## Not run: 
# Fit QLSS object
trees2 <- trees[order(trees$Height),]
fit <- qlss(Volume ~ Height, data = trees2)

## Predict using newdata. Calculate confidence intervals using 200 bootstrap replications
# large confidence intervals for shape index due to small IQR at low values of height
#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")

# 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


## End(Not run)

[Package Qtools version 1.5.9 Index]