predict.regr: Prediction Methods for 'regr' Objects

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/regr.R

Description

Calculates predicted values for regr objects. The possible results depend on the class of the fitted model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## S3 method for class 'regr'
predict(object, newdata = NULL, scale = object$sigma,
  type = NULL, ...)

## S3 method for class 'polr'
predict(object, newdata=NULL,
  type = c("class", "probs", "link"), ...)

## S3 method for class 'mlm'
predict(object, newdata=NULL, se.fit = FALSE,
  scale = NULL, df = Inf,
    interval = c("none", "confidence", "prediction"), level = 0.95,
    type = c("response", "terms"), terms = NULL, na.action = na.pass,
    pred.var = NULL, weights = 1, ...)

Arguments

object

Object of class regr

newdata

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

se.fit

if TRUE, standard errors will be calculated if possible

scale

Scale parameter for std.err. calculation

df

Degrees of Freedom to be used, if se.fit is false, for quantiles defining intervals

interval

Type of interval requested

level

Confidence level

type

Type of prediction: response or model term
For glm or ordered regression, type link gives estimated values of the linear predictor.

terms

If type="terms", which terms (default is all terms)

na.action

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

pred.var, weights

see lm

...

further arguments passed to specific methods

Details

regr is a "super class" which includes many specific model classes such as "lm", "glm", "polr", ... . predict.regr is a wrapper function that calls the specific methods corresponding to the specific model class.

Value

vector of predictions, or matrix with columns fit, lwr, and upr if interval is set.

If se.fit is TRUE, a list with the following components is returned:

fit

vector or matrix as above

se.fit

standard error of predicted means

residual.scale

residual standard deviations

df

degrees of freedom for residual~Describe the value returned

Author(s)

Werner A. Stahel, ETH Zurich

See Also

predict.lm, residuals.polr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(d.blast)
r.blast <- regr(log10(tremor)~location+log10(distance)+log10(charge),
            data=d.blast)
t.pr <- predict(r.blast)
showd(t.pr)

data(d.fossiles)
r.mregr <-
  regr(cbind(sAngle,lLength,rWidth)~SST.Mean+Salinity+lChlorophyll+region+N,
                data=d.fossiles)
t.pr <- predict(r.mregr)
showd(t.pr)

regr0 documentation built on May 31, 2017, 2:26 a.m.