regmixMH | R Documentation |
Return Metropolis-Hastings (M-H) algorithm output for mixtures of multiple regressions with arbitrarily many components.
regmixMH(y, x, lambda = NULL, beta = NULL, s = NULL, k = 2, addintercept = TRUE, mu = NULL, sig = NULL, lam.hyp = NULL, sampsize = 1000, omega = 0.01, thin = 1)
y |
An n-vector of response values. |
x |
An nxp matrix of predictors. See |
lambda |
Initial value of mixing proportions. Entries should sum to
1. This determines number of components. If NULL, then |
beta |
Initial value of |
s |
k-vector of standard deviations. If NULL, then 1/\code{s}^2 has
random standard exponential entries. If |
k |
Number of components. Ignored unless all of |
addintercept |
If TRUE, a column of ones is appended to the x matrix before the value of p is calculated. |
mu |
The prior hyperparameter of same size as |
sig |
The prior hyperparameter of same size as |
lam.hyp |
The prior hyperparameter of length |
sampsize |
Size of posterior sample returned. |
omega |
Multiplier of step size to control M-H acceptance rate. Values closer to zero result in higher acceptance rates, generally. |
thin |
Lag between parameter vectors that will be kept. |
regmixMH
returns a list of class mixMCMC
with items:
x |
A nxp matrix of the predictors. |
y |
A vector of the responses. |
theta |
A ( |
k |
The number of components. |
Hurn, M., Justel, A. and Robert, C. P. (2003) Estimating Mixtures of Regressions, Journal of Computational and Graphical Statistics 12(1), 55–79.
regcr
## M-H algorithm for NOdata with acceptance rate about 40%. data(NOdata) attach(NOdata) set.seed(100) beta <- matrix(c(1.3, -0.1, 0.6, 0.1), 2, 2) sigma <- c(.02, .05) MH.out <- regmixMH(Equivalence, NO, beta = beta, s = sigma, sampsize = 2500, omega = .0013) MH.out$theta[2400:2499,]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.