View source: R/RFGLS_predict.R
RFGLS_predict | R Documentation |
The function RFGLS_predict
predicts the mean function at a given set of covariates.
It uses a fitted RF-GLS model in Saha et al. 2020 to obtain the predictions.
Some code blocks are borrowed from the R package: randomForest: Breiman and Cutler's Random
Forests for Classification and Regression
https://CRAN.R-project.org/package=randomForest .
RFGLS_predict(RFGLS_out, Xtest, h = 1, verbose = FALSE)
RFGLS_out |
an object obtained from |
Xtest |
an |
h |
number of core to be used in parallel computing setup for bootstrap samples. If |
verbose |
if |
A list comprising:
predicted_matrix |
an |
predicted |
preducted values at the |
Arkajyoti Saha arkajyotisaha93@gmail.com,
Sumanta Basu sumbose@cornell.edu,
Abhirup Datta abhidatta@jhu.edu
Saha, A., Basu, S., & Datta, A. (2020). Random Forests for dependent data. arXiv preprint arXiv:2007.15421.
Andy Liaw, and Matthew Wiener (2015). randomForest: Breiman and Cutler's Random
Forests for Classification and Regression. R package version 4.6-14.
https://CRAN.R-project.org/package=randomForest
rmvn <- function(n, mu = 0, V = matrix(1)){
p <- length(mu)
if(any(is.na(match(dim(V),p))))
stop("Dimension not right!")
D <- chol(V)
t(matrix(rnorm(n*p), ncol=p)%*%D + rep(mu,rep(n,p)))
}
set.seed(2)
n <- 200
x <- as.matrix(rnorm(n),n,1)
sigma.sq <- 1
rho <- 0.5
set.seed(3)
b <- rho
s <- sqrt(sigma.sq)
eps = arima.sim(list(order = c(1,0,0), ar = b),
n = n, rand.gen = rnorm, sd = s)
y <- eps + 10*sin(pi * x[,1])
estimation_result <- RFGLS_estimate_timeseries(y, x, ntree = 10)
Xtest <- matrix(seq(0,1, by = 1/1000), 1001, 1)
RFGLS_predict <- RFGLS_predict(estimation_result, Xtest)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.