regress | R Documentation |
This function runs a Metropolis-Hastings MCMC simulation to estimate the parameters of a specified regression model with chronological uncertainty propagation.
regress(
Y,
X,
model = "nb",
startvals = NULL,
niter = NULL,
adapt = T,
adapt_amount = 0.1,
adapt_interval = 50,
adapt_window = c(0.21, 0.25),
scales = NULL,
priors = NULL
)
Y |
Matrix containing integer event-counts. Each column should contain one probable event-count sequence. The number of columns needs to be equal to or greater than the number of desired MCMC iterations. |
X |
A matrix containing the covariates for the model (independent variables). The matrix will be comprise blocks, each of which contains N columns where N is the number of covariates including an intercept column if desired. Thus, the total number of columns in X must be a multiple of the number of covariates (with intercept) and the number of desired MCMC iterations. |
model |
A string specifying the type of model to use. Currently only Negative-Binomial ('nb') and Poisson ('pois') models are supported. |
startvals |
A numeric vector of starting values for the MCMC. |
niter |
(optional) An integer scalar indicating the number of MCMC iterations if different from the number of columns in Y. |
adapt |
A numeric vector of starting values for the MCMC |
adapt_amount |
A scalar containing the ratio by which the proposal variance is changed during the MCMC adapt step when adapt=T—e.g., adapt_amount=0.1 (default) grows/shrinks the variance by 10%. |
adapt_interval |
A numeric scalar indicating the the n-th mcmc iteration during which the simulation will attempt to adapt the proposal variances. |
adapt_window |
A numeric vector with two elements that define the lower and upper bounds of the target acceptance value for the MCMC. This is only used when adapt=T. |
scales |
A numeric vector of scales for the proposal distributions. The
order is important. Each element refers to the scale of a proposal function
for the model parameters in the following order: (b_1, b_2, ..., b_nX, p_1,
p_2, ..., p_n), where |
priors |
A numeric vector of parameter values for the model priors—the
order is important and corresponds to order of appearance of the prior
density functions in the source code for the |
If adapt=T, returns a list that includes the mcmc samples, acceptance rates for all model parameters, and the proposal function scales for all parameters.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.