Learn R Programming

htree (version 0.1.1)

predict_hrf: Prediction

Description

Prediction functions for hrf and htb.

Usage

predict_htb(object,x=NULL,yindx=NULL,time=NULL,id=NULL,
	ntrees=NULL,type="response",se=FALSE)
predict_hrf(object,x=NULL,yindx=NULL,time=NULL,id=NULL,
	all.trees=FALSE,se=FALSE)

Arguments

object

an object of class htree.

x

a data frame or matrix containing new data. If NULL then training data in object is used.

yindx

column number corresponding response.

time

observation times.

id

subject identifiers

ntrees

number of trees to use in prediction.

type

If response then prediction on same scale as response.

all.trees

If TRUE then prediction for each tree is returned. Only for hrf.

se

If TRUE then standard errors of predictions are returned.

Value

Returns predictions.

See Also

hrf,htb

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# -- random intercept example --- #

p=5;sigma_e=.5;sigma_a=.5;v=rep(1,p);n=500;pnoise=2
random_intercept=rnorm(n,sd=sigma_a)
random_intercept=as.numeric(matrix(random_intercept,nrow=p,ncol=n,byrow=TRUE))
x=random_intercept+rnorm(n*p,sd=sigma_e)
id=sort(rep(1:n,p))
time<-rep(1:p,n)
znoise=matrix(rnorm(n*p*pnoise),ncol=pnoise)
xx=cbind(time,x,znoise)

# fit historical random forest
hb=hrf(x=xx,time=time,id=id,yindx=2,ntrees=100,mtry=4,nsamp=5,se=TRUE,B=50)

# get predictions with standard errors
pred=predict_hrf(hb,se=TRUE)
# }

Run the code above in your browser using DataLab