varSumPredictNlmeGnls

Description

Variance of the sum of predictions taking care of covariances between single predictions.

Usage

1
varSumPredictNlmeGnls(object, newdata, pred = FALSE, retComponents = FALSE)

Arguments

object

the model fit object used for predictions, treated by attachVarPrep

newdata

dataframe of new predictors and covariates

pred

if TRUE, the predicted value (sum of predictions) is returned in attribute pred

retComponents

if TRUE, the sum of the error components (fixed, random, noise) are returned in attributes "varFix","varRan","varResid"

Details

Variance calculation is based on Taylor series expansion as described in appendix A2 by Wutzler08.

Performance of this function scales with n^2. So do not apply for too many records.

Value

named vector

pred

sum of predictions

sdPred

standard deviation of pred

varFix

variance component due to uncertainty in fixed effects

varRan

variance component due to random effects

varResid

variance component due to residual variance

Author(s)

Thomas Wutzler

References

Wutzler, T.; Wirth, C. & Schumacher, J. (2008)

Generic biomass functions for Common beech (Fagus sylvatica L.) in Central Europe - predictions and components of uncertainty.

Canadian Journal of Forest Research, 38, 1661-1675

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
data(modExampleStem)	# load the model, which has already been prepared for prediction


#-- prediction on with varying number of records


data(Wutzler08BeechStem)


(resNlme <- varSumPredictNlmeGnls(modExampleStem, head( Wutzler08BeechStem, n=10 )))	


(resNlme2 <- varSumPredictNlmeGnls(modExampleStem, head( Wutzler08BeechStem, n=180 )))


# plotting relative error components


barplot(c(sqrt(resNlme[-(1:2)])/resNlme[1], sqrt(resNlme2[-(1:2)])/resNlme2[1]) )


# note how the residual error declines with record number, 


# while the fixed and random error does does not decline