Description Usage Arguments Value Author(s) References Examples
View source: R/predict.basad.R
Predict the values of a dependent variable using basad
on new test data.
1 2 |
object |
An object of class |
newdata |
Data frame or x-matrix for which to evaluate predictions. |
... |
Further arguments passed to or from other methods. |
A vector of predicted values for a dependent variable in new test data.
Qingyan Xiang (qyxiang@bu.edu)
Naveen Narisetty (naveen@illinois.edu)
Narisetty, N. N., & He, X. (2014). Bayesian variable selection with shrinking and diffusing priors. The Annals of Statistics, 42(2), 789-817.
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 26 27 28 |
#-----------------------------------------------------------
#Generate Data: The simulated high dimensional data
#-----------------------------------------------------------
n = 100; p = 499; nz = 5
rho1=0.25; rho2=0.25; rho3=0.25 ### correlations
Bc = c(0, seq(0.6, 3, length.out = nz), array(0, p - nz))
covr1 = (1 - rho1) * diag(nz) + array(rho1, c(nz, nz))
covr3 = (1 - rho3) * diag(p - nz) + array(rho3, c(p - nz, p - nz))
covr2 = array(rho2, c(nz, p - nz))
covr = rbind(cbind(covr1, covr2), cbind(t(covr2), covr3))
covE = eigen(covr)
covsq = covE$vectors %*% diag(sqrt(covE$values)) %*% t(covE$vectors)
Xs = matrix(rnorm(n * p), nrow = n); Xn = covsq %*% t(Xs)
X = cbind(array(1, n), t(Xn))
Y = X %*% Bc + rnorm(n); X <- X[, 2:ncol(X)]
#-----------------------------------------------------------
#Run the algorithm and then predict
#-----------------------------------------------------------
obj <- basad(x = X, y = Y)
predict(obj, newdata = X)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.