# pacbpred

### 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. The method is fully described in Guedj and Alquier (2013), 'PAC-Bayesian Estimation and Prediction in Sparse Additive Models', see http://projecteuclid.org/DPubS?service=UI&version=1.0&verb=Display&handle=euclid.ejs/1359041592.

### Usage

1 2 3 |

### Arguments

`niter` |
Mandatory. The number of MCMC iterations. |

`burnin` |
Optional. How many iterations should be discarded in the beginning of the chain? |

`Xtrain` |
Mandatory. The design matrix of the training sample. |

`Xtest` |
Optional. The design matrix of the test sample. |

`Y` |
Mandatory. The vector of responses corresponding to |

`K` |
Optional. The maximal order of the development on the trigonometric basis. |

`cst` |
Optional. A numerical constant bounding from above the sup norm of true regression function. |

`sigma2` |
Optional. The variance of the proposal density along the algorithm. |

`alpha` |
Optional. The penalization term over the complexity of a model. |

`delta` |
Optional. The inverse temperature parameter. |

### Details

See Guedj and Alquier (2013), 'PAC-Bayesian Estimation and Prediction in Sparse Additive Models' on http://projecteuclid.org/DPubS?service=UI&version=1.0&verb=Display&handle=euclid.ejs/1359041592.

### Value

A list composed of the following items.

`predict` |
If |

`estimates` |
The vector of estimates over the trigonometric basis. |

`ratio.mcmc` |
A vector of the MCMC ratio for each iteration. |

`accept` |
A logical vector whose length is the number of iterations. For each iteration, has the proposed move been accepted ? |

`models.mcmc` |
The current models all along the MCMC chain. |

### Note

This is still an early stage development. Use at your own risk !

### Author(s)

Benjamin Guedj

### 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-package

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