Description Usage Arguments Details Value Author(s) References See Also Examples

Refits the solution path given by BayesPen.

1 | ```
BayesPen.refit(y, x, fit, joint, max.refit, ...)
``` |

`y` |
A n-vector of responses. If fit is a list from BayesPen.lm or BayesPen.lm.confounders then y is not required. |

`x` |
A n x p design matrix that includes all potential covariates. In the confounder selection case this includes the exposures and confounders, i.e. cbind(x,u). If fit is a list from BayesPen.lm or BayesPen.lm.confounders then x is not required. |

`fit` |
A list returned from BayesPen, BayesPen.lm, or BayesPen.lm.confounders. |

`joint` |
For variable selection this indicates if the joint or marginal solution path should be used. Joint must be TRUE for confounder selection. |

`max.refit` |
The maximum number of models to be refit. |

`...` |
These are additional terms passed to glm to refit a glm other than linear. The default is linear. |

This refits each model in the solution path with the frequentist model using the glm function.

`coefs ` |
A matrix of regression coefficients for each model in the solution path. The regression coefficients for parameters omitted from a model are set to 0. |

`SSE ` |
SSE of each refitted model. |

`dev ` |
Deviance of each refitted model. |

`df ` |
Error degrees of freedom from each refitted model. |

`joint ` |
Returns the logical joint. |

Ander Wilson, Howard D. Bondell, and Brian J. Reich

Bondell, H. D. and Reich, B. J. (2012). Consistent high-dimensional Bayesian variable selection via penalized credible regions. *J. Am. Statist. Assoc*. 107, 1610-1624.

Wilson A., Reich B. J. (2014). Confounder selection via penalized credible regions. *Biometrics* 70: 852-861.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
######################
#Variable Selection
set.seed(1234)
dat <- SimExample(500,model="BR1")
X <- dat$X
y <- dat$y
#fit the full model assuming flat priors on beta
betahat <- solve(t(X)%*%X) %*% t(X) %*% y
cov <- solve(t(X)%*%X) * sum((X%*%betahat-y)^2)/(length(y)-length(betahat))
#find solution path
fit.BayesPen <- BayesPen(beta=betahat, beta_cov=cov)
#refit the model
refit <- BayesPen.refit(y,X,fit.BayesPen)
#plot it
BayesPen.plot(refit)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.