gmrfdpgrow {growfunctions} | R Documentation |
Bayesian instrinsic Gaussian Markov Random Field model for dependent time-indexed functions
Description
Estimates a collection of time-indexed functions under intrinsic Gaussian Markov random field prior formulations where a Dirichlet process mixture allows sub-groupings of the functions to share the same iGMRF precision parameter. The iGMRF formulation supports any number of additive precision terms, expressing either or both of multiple trend and seasonality.
Usage
gmrfdpgrow(
y,
ksi,
E,
ipr,
q_order,
q_type,
q_shape,
q_rate,
tau_shape,
tau_rate,
dp_shape,
dp_rate,
M_init,
w_star,
n.iter,
n.burn,
n.thin,
nu,
Rep,
progress,
jitter,
kappa_fast,
stable_launch
)
Arguments
y |
A multivariate continuous response, specified as an N x T matrix, where |
ksi |
An N x P matrix of N observations of P predictors to be used
in prior probability of co-clustering of set of N, T x 1 observations.
Defaults to |
E |
A multivariate offset variable, specified as an N x T matrix, in the case
that |
ipr |
An optional input vector of inclusion probabilities for each observation unit
in the case the observed data were acquired through an informative sampling design, so
that unbiased inference about the population requires adjustments to the observed sample
Defaults to |
q_order |
An integer vector of length |
q_type |
A vector of length |
q_shape |
The value (in (0,infty)) for the shape hyperparameter for the Gamma base distribution for
the iGMRF scale parameters, |
q_rate |
The rate parameter of the Gamma base distribution on |
tau_shape |
The value (in (0,infty)) for the shape hyperparameter for the Gamma prior on the error
precision parameter. Defaults to |
tau_rate |
The rate parameter of the Gamma prior distribution on |
dp_shape |
The shape parameter for the Gamma prior on the DP concentration parameter,
|
dp_rate |
The rate parameter for the Gamma prior on the DP concentration parameter,
|
M_init |
Starting number of clusters of |
w_star |
Integer value denoting the number of cluster locations to sample ahead of
observations in the auxiliary Gibbs sampler used to sample the number of clusters
and associated cluster assignments. A higher value reduces sampling auto-correlation,
but increases computational burden. Defaults to |
n.iter |
Total number of MCMC iterations. |
n.burn |
Number of MCMC iterations to discard.
|
n.thin |
Gap between successive sampling iterations to save. |
nu |
The degree of freedom parameter for the Huang and Wand prior on precision
|
Rep |
The number of times to draw samples of the |
progress |
A boolean value denoting whether to display a progress bar during model execution.
Defaults to |
jitter |
A scalar double indicating amount of jitter to subract from the posterior
rate and shape hyperparameters of |
kappa_fast |
Boolean for whether to generate rate hyperparameter from full conditionals
versus joint Gaussian (on random effects, |
stable_launch |
A boolean indicator on whether to generate initial values for
|
Value
S3 gmrfdpgrow
object, for which many methods are available to return and view results.
Generic functions applied to an object, res
of class gmrfdpgrow
, includes:
plot(res) |
returns results plots, including fit functions versus data and allocation of fitted functions into clusters |
samples(res) |
contains ( |
resid(res) |
contains the model residuals. |
Note
The intended focus for this package are data composed of observed noisy functions (each of
length T
) for a set of experimental units where the functions may express dependence
among the experimental units
Author(s)
Terrance Savitsky tds151@gmail.com Daniell toth danielltoth@yahoo.com
References
T. D. Savitsky and D. Toth (2014) Bayesian Non-parametric Models for Collections of Time- indexed Functions. submitted to: JRSS Series A (Statistics in Society).
T. D. Savitsky (2014) Bayesian Non-parametric Functional Mixture Estimation for Time-indexed data. submitted to: Annals of Applied Statistics.
T. D. Savitsky (2014) Bayesian Non-Parametric Mixture Estimation for Time-Indexed Functional
Data for R
. Submitted to: Journal of Statistical Software.
See Also
Examples
{
library(growfunctions)
## load the monthly employment count data for a collection of
## U.S. states from the Current
## Population Survey (cps)
data(cps)
## subselect the columns of N x T, y, associated
## with the years 2008 - 2013
## to examine the state level employment levels
## during the "great recession"
y_short <- cps$y[,(cps$yr_label %in% c(2008:2013))]
## Run the DP mixture of iGMRF's to estimate posterior
## distributions for model parameters
## Under default RW2(kappa) = order 2 trend
## precision term
## Run for 1500 iterations, with half as burn-in for a
## more useful (converged) result.
res_gmrf <- gmrfdpgrow(y = y_short,
n.iter = 40,
n.burn = 20,
n.thin = 1)
## 2 plots of estimated functions: 1. faceted by cluster and fit;
## 2. data for experimental units.
## for a group of randomly-selected functions
fit_plots_gmrf <- cluster_plot( object = res_gmrf,
units_name = "state",
units_label = cps$st,
single_unit = FALSE,
credible = TRUE )
}