Learn R Programming

pacbpred (version 0.92.2)

pacbpred-package: PAC-Bayesian Estimation and Prediction in Sparse Additive Models

Description

This package is intended to perform estimation and prediction in high-dimensional additive models, using a PAC-Bayesian point of view and a MCMC algorithm.

Arguments

Details

Package:
pacbpred
Type:
Package
Version:
0.92.2
Date:
2013-02-05
License:
GPL (>= 2)

References

http://www.lsta.upmc.fr/doct/guedj/index.html Guedj and Alquier (2013), 'PAC-Bayesian Estimation and Prediction in Sparse Additive Models'. Electronic Journal of Statistics, 7, 264--291. DOI:10.1214/13-EJS771. Available on http://projecteuclid.org/DPubS?service=UI&version=1.0&verb=Display&handle=euclid.ejs/1359041592.

See Also

pacbpred

Examples

Run this code
ndata <- 100
ntrain <- 80
ntest <- ndata - ntrain
p <- 10
Y <- numeric(ndata)
X <- matrix(nr = ndata, nc = p, data = 2*runif(n = ndata*p) - 1)
for(i in 1:ndata)
  {
    Y[i] <- X[i,1]^3+sin(pi*X[i,2])
  }

Xtrain <- X[1:ntrain,]
Xtest <- X[(ntrain+1):ndata,]
Ytrain <- Y[1:ntrain]
Ytest <- Y[(ntrain+1):ndata]

niter <- 100
cst <- Inf
alpha <- .1
sigma2 <- .1
delta <- ntrain/2

res <- pacbpred(niter = niter, Xtrain = Xtrain, Xtest = Xtest, Y =
Ytrain, cst = cst,
sigma2 = sigma2, delta = delta, alpha = alpha)

print(cbind(res$predict,Ytest))

Run the code above in your browser using DataLab