# predict20x: Model Predictions for a Linear Model In s20x: Functions for University of Auckland Course STATS 201/208 Data Analysis

## Description

Uses the main output and some error messages from R function 'predict' but gives you more output. (Error messages are not reliable when used in Splus.)

## Usage

 `1` ```predict20x(object, newdata, cilevel = 0.95, digit = 3, print.out = TRUE, ...) ```

## Arguments

 `object` an `lm` object, i.e. the output from `lm`. `newdata` prediction data frame. `cilevel` confidence level of the interval. `digit` decimal numbers after the point. `print.out` if `TRUE`, print out the prediction matrix. `...` optional arguments that are passed to the generic 'predict'

## Details

Note: The data frame, newdata, must have the same column order and data types (e.g. numeric or factor) as those used in fitting the model.

## Value

 `frame` vector or matrix including predicted values, confidence intervals and predicted intervals. `fit` prediction values. `se.fit` standard error of predictions. `residual.scale` residual standard deviations. `df` degrees of freedom for residual. `cilevel` confidence level of the interval.

## Note

This function is deprecated. It will be removed in future versions of the package.

this function is deprecated as it is never used in class any more. We prefer the standard `predict` method.

`predict`, `predict.lm`, `as.data.frame`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```# Zoo data data(zoo.df) zoo.df = within(zoo.df, {day.type = factor(day.type)}) zoo.fit = lm(log(attendance) ~ time + sun.yesterday + nice.day + day.type + tv.ads, data = zoo.df) pred.zoo = data.frame(time = 8, sun.yesterday = 10.8, nice.day = 0, day.type = factor(3), tv.ads = 1.181) predict20x(zoo.fit, pred.zoo) # Peruvian Indians data data(peru.df) peru.fit = lm(BP ~ age + years + I(years^2) + weight + height, data = peru.df) pred.peru = data.frame(age = 21, years = 2, `I(years^2)` = 2, weight = 71, height = 1629) predict20x(peru.fit, pred.peru) ```