Computes fitted means and standard errors at new data values after fitting a model with biglm or bigglm.

# S3 method for class 'bigglm'
predict(object, newdata, type = c("link", "response"), 
se.fit = FALSE, make.function = FALSE, ...)
# S3 method for class 'biglm'
predict(object, newdata=NULL,  se.fit = FALSE, make.function = FALSE, ...)

Arguments

object

fitted model

newdata

data frame with variables for new values

type

link is on the linear predictor scale, response is the response

se.fit

Compute standard errors?

make.function

If TRUE return a prediction function, see Details below

...

not used

Details

When make.function is TRUE, the return value is either a single function that computes the fitted values or a list of two functions that compute the fitted values and standard errors. The input to these functions is the design matrix, without the intercept column. This allows the relatively time-consuming calls to model.frame() and model.matrix() to be avoided.

Value

Either a vector of predicted values or a data frame with predicted values and standard errors.

References

~put references to the literature/web site here ~

Author

based on code by Christophe Dutang

Examples

example(biglm)
#> 
#> biglm> data(trees)
#> 
#> biglm> ff<-log(Volume)~log(Girth)+log(Height)
#> 
#> biglm> chunk1<-trees[1:10,]
#> 
#> biglm> chunk2<-trees[11:20,]
#> 
#> biglm> chunk3<-trees[21:31,]
#> 
#> biglm> a <- biglm(ff,chunk1)
#> 
#> biglm> a <- update(a,chunk2)
#> 
#> biglm> a <- update(a,chunk3)
#> 
#> biglm> summary(a)
#> Large data regression model: a <- biglm(ff,chunk1)
#> Sample size =  31 
#>                Coef    (95%     CI)     SE p
#> (Intercept) -6.6316 -8.2312 -5.0320 0.7998 0
#> log(Girth)   1.9826  1.8326  2.1327 0.0750 0
#> log(Height)  1.1171  0.7082  1.5260 0.2044 0
#> 
#> biglm> deviance(a)
#> [1] 0.1854634
#> 
#> biglm> AIC(a)
#> [1] 48.18546
predict(a,newdata=trees)
#>        [,1]
#> 1  2.310270
#> 2  2.297879
#> 3  2.308547
#> 4  2.807900
#> 5  2.976888
#> 6  3.022580
#> 7  2.802931
#> 8  2.945736
#> 9  3.035777
#> 10 2.981461
#> 11 3.057130
#> 12 3.031349
#> 13 3.031349
#> 14 2.974906
#> 15 3.118250
#> 16 3.246641
#> 17 3.401459
#> 18 3.475068
#> 19 3.319702
#> 20 3.218167
#> 21 3.467691
#> 22 3.524097
#> 23 3.478455
#> 24 3.643019
#> 25 3.754853
#> 26 3.929478
#> 27 3.965974
#> 28 3.983197
#> 29 3.994242
#> 30 3.994242
#> 31 4.355446
f<-predict(a,make.function=TRUE)
X<- with(trees, cbind(log(Girth),log(Height)))
f(X)
#>           [,1]
#>  [1,] 2.310270
#>  [2,] 2.297879
#>  [3,] 2.308547
#>  [4,] 2.807900
#>  [5,] 2.976888
#>  [6,] 3.022580
#>  [7,] 2.802931
#>  [8,] 2.945736
#>  [9,] 3.035777
#> [10,] 2.981461
#> [11,] 3.057130
#> [12,] 3.031349
#> [13,] 3.031349
#> [14,] 2.974906
#> [15,] 3.118250
#> [16,] 3.246641
#> [17,] 3.401459
#> [18,] 3.475068
#> [19,] 3.319702
#> [20,] 3.218167
#> [21,] 3.467691
#> [22,] 3.524097
#> [23,] 3.478455
#> [24,] 3.643019
#> [25,] 3.754853
#> [26,] 3.929478
#> [27,] 3.965974
#> [28,] 3.983197
#> [29,] 3.994242
#> [30,] 3.994242
#> [31,] 4.355446