predict.basad: Basad prediction

Description Usage Arguments Value Author(s) References Examples

View source: R/predict.basad.R

Description

Predict the values of a dependent variable using basad on new test data.

Usage

1
2
  ## S3 method for class 'basad'
predict(object, newdata = NULL, ...)

Arguments

object

An object of class basad.

newdata

Data frame or x-matrix for which to evaluate predictions.

...

Further arguments passed to or from other methods.

Value

A vector of predicted values for a dependent variable in new test data.

Author(s)

Qingyan Xiang (qyxiang@bu.edu)

Naveen Narisetty (naveen@illinois.edu)

References

Narisetty, N. N., & He, X. (2014). Bayesian variable selection with shrinking and diffusing priors. The Annals of Statistics, 42(2), 789-817.

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
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)
  

basad documentation built on Nov. 18, 2021, 1:12 a.m.

Related to predict.basad in basad...