lmPredict: lmPredict

Description Usage Arguments Value Examples

View source: R/lmPredict.R

Description

Use the fitted linear model to predict value for a new observation.

Usage

1
lmPredict(model, newX)

Arguments

model

input fitted linear model

newX

input indicator variable matrix, without intercept 1. one-dimension vector works as well.

Value

the estimated Y-value

Examples

1
2
3
4
5
6
7
n = 1e3
p = 20
Y = runif(n,-5,5)
X = matrix(rnorm(n*p,0,1),n,p)
newX = matrix(rnorm(p),ncol=p)
model = linearFit(X,Y)
lmPredict(model,newX)

xietian99/LinearModel documentation built on Nov. 27, 2019, 12:31 a.m.