factorQR: A Bayesian factor model for quantile regression

Description Arguments Value Author(s)

View source: R/factorQR.R

Description

factorQR is an MCMC sampler to fit a Bayesian factor model for quantile regression.

Arguments

factorForm

A formula of the form factorForm = Y ~ X1 + X2, where Y is the response and variables on the right-hand side are manifest variables related to the latent factors on which we are regressing Y. The right-hand side variables will be centered automatically, though they are not scaled.

nonFactorForm

An optional formula of the form nonFactorForm = ~ X3 + X4. These covariates are used to model Y, but they do not relate to any of the latent factors.

dataSet

An optional data frame, list, or environment containing the variables in the model.

pQuant

Response quantile to model. Defaults to pQuant=0.5.

whichFactor

Vector of indicators to show factor grouping. E.g., if whichFactor=c(1,1,1,2,2,2), it would mean the first three variables in the right-hand side of factorForm group and the last three group together in two factors. If whichFactor = NULL, a single latent factor will be assumed.

nSamp

Number of MCMC iterations, with a default of 5000.

burn

Iterations of burn-in, with a default of 0.

thin

Number of iterations to skip between stored values in the chain, with a default of 0.

cTau0

Prior shape for τ, which is the inverse scale of the response. Defaults to 1.

dTau0

Prior scale for τ.

cPsi0

Prior shape for Ψ, the inverse scale of the manifest variables related to the factors. Defaults to 1.

dPsi0

Prior rate for Ψ. Defaults to 1.

sig0

Hyperparameter for scale of free Λ_{-s} variables, which is rows of the factor loading matrix that do not correspond to the response. Defaults to 1.

mu0

Prior mean for Λ_{-s} components. Defaults to 1.

R0

Prior scale of Φ^{-1}. If not specified, defaults to the identity matrix.

nu0

Prior degrees of freedom for inverse Wishart associated with Φ. Must be an integer greater than or equal to the dimension of Φ, but defaults to one greater than that dimension.

B0s

Prior precision (i.e., inverse variance) for Λ_{s}. Default is a diagonal matrix with non-zero values of 0.01. May be left at NULL, or changed to a non-negative scalar, a vector with length equal to the number of latent factors, or a symmetric, positive definite matrix with dimension equal to the number of latent factors.

B0Beta

Prior precision for regression coefficients related to nonFactorForm. Default is a diagonal matrix with non-zero values of 0.01. May be left at NULL, or changed to a non-negative scalar, a vector with length equal to the number of covariates not related to the latent factors, or a symmetric, positive definite matrix with that dimension.

betaZero

Starting value for β.

PhiZero

Initial value of Φ.

invPsiZero

initial value of Ψ^{-1}.

LambdaZero

Initial value of Λ_{-s}. Must be a scalar or vector with length equal to the number of manifest variables in the right-hand side of factorForm. Will be expanded to its matrix form internally, and elements that should be fixed at 1 will be adjusted if necessary, with warning.

LambdaSZero

Initial value of last row of Λ, i.e. the part that models the left-hand side of factorForm. If specified, must either be a scalar or vector with length equal to the number of latent factors being modeled. Defaults to 0.1

OmegaZero

Initial value for latent Ω.

verbose

If TRUE, prints progress updates in Gibbs sampler.

storeOmega

If TRUE, stores the sampled Ω values.

latentInteract

If TRUE, interacts the first two latent factors. More latent/latent interactions are not currently supported.

interactX

If supplied, a matrix of variables with which to interact the latent factors. Repeated columns are allowed.

whichFactorInteract

A vector that indicates which factors to interact with the columns of interactX. For example, whichFactorInteract = c(1,1) would indicate that the two columns of interactX are to be interacted with the first latent factor.

Value

Returns an item of the class factorQR composed of the following components:

param

Matrix of sampled parameter values.

call

The matched call.

nReg

The number of regression parameters.

betLen

The number of β components.

nObs

The number of observations.

burn

The number of Gibbs iterations before samples were stored.

thin

The number of Gibbs iterations between stored values.

nSamp

The total number of Gibbs iterations.

nFact

The number of modeled latent factors.

nFactorX

The number of manifest variables related to the factors.

omega

Sampled Ω values, if storeOmega is TRUE.

nFactInt

Number of factor/manifest variable interactions.

Author(s)

Lane F. Burgette, Department of Statistical Science, Duke University. [email protected]


factorQR documentation built on May 30, 2017, 7:20 a.m.