GLSME.predict {GLSME} | R Documentation |
Prediction for a new observation using parameters estimated by the GLSME
function
Description
The function takes parameters estimated by the GLSME
function and predicts the response
for a new observation of predictors. It also returns confidence intervals on the prediction.
The function is still under development.
Usage
GLSME.predict(xo, glsme.estimate, vy, vx, alpha = 0.95)
Arguments
xo |
The new observed predictors. In a intercept is in the model then a 1 has to be included for it. |
glsme.estimate |
The output of the |
vy |
Residual variance, both biological and measurement error. |
vx |
Biological variance in predictor, NOT observation variance of predictor. If there is a predictor in the model then a 0 row and column have to included for it. |
alpha |
Level for confidence interval. |
Value
BiasCorr |
Prediction using the bias corrected estimate.
|
BiasUncorr |
Prediction using the bias uncorrected estimate.
|
Author(s)
Krzysztof Bartoszek
References
Hansen, T.F. and Bartoszek, K. (2012) Interpreting the evolutionary regression: the interplay between observational and biological errors in phylogenetic comparative studies. Systematic Biology 61(3):413-425.
Examples
set.seed(12345)
n<-3 ## number of species
apetree<-ape::rtree(n)
### Define Brownian motion parameters to be able to simulate data under the Brownian motion model.
BMparameters<-list(vX0=matrix(0,nrow=2,ncol=1),Sxx=rbind(c(1,0),c(0.2,1)))
### Now simulate the data and remove the values corresponding to the internal nodes.
xydata<-mvSLOUCH::simulBMProcPhylTree(apetree,X0=BMparameters$vX0,Sigma=BMparameters$Sxx)
xydata<-xydata[(nrow(xydata)-n+1):nrow(xydata),]
x<-xydata[,1]
y<-xydata[,2]
yerror<-diag((stats::rnorm(n,mean=0,sd=0.1))^2) #create error matrix
y<-mvtnorm::rmvnorm(1,mean=y,sigma=yerror)[1,]
xerror<-diag((stats::rnorm(n,mean=0,sd=0.1))^2) #create error matrix
x<-mvtnorm::rmvnorm(1,mean=x,sigma=xerror)[1,]
glsme.res<-GLSME(y=y, CenterPredictor=TRUE, D=cbind(rep(1, n), x), Vt=ape::vcv(apetree),
Ve=yerror, Vd=list("F",ape::vcv(apetree)), Vu=list("F", xerror),OutputType="long")
GLSME.predict(c(1,1), glsme.res, vy=1, vx=rbind(c(0,0),c(0,1)))