Learn R Programming

sbgcop (version 0.980)

sbgcop.mcmc: Semiparametric Bayesian Gaussian copula estimation and imputation

Description

sbgcop.mcmc is used to semiparametrically estimate the parameters of a Gaussian copula. It can be used for posterior inference on the copula parameters, and for imputation of missing values in a matrix of ordinal and/or continuous values.

Usage

sbgcop.mcmc(Y, S0 = diag(dim(Y)[2]), n0 = dim(Y)[2] + 2, nsamp = 100,
  odens = max(1, round(nsamp/1000)), impute = any(is.na(Y)),
  plugin.threshold = 100, plugin.marginal = (apply(Y, 2, function(x) {    
  length(unique(x)) }) > plugin.threshold), seed = 1, verb = TRUE)

Arguments

Y

an n x p matrix. Missing values are allowed.

S0

a p x p positive definite matrix

n0

a positive integer

nsamp

number of iterations of the Markov chain.

odens

output density: number of iterations between saved samples.

impute

save posterior predictive values of missing data(TRUE/FALSE)?

plugin.threshold

if the number of unique values of a variable exceeds this integer, then plug-in the empirical distribution as the marginal.

plugin.marginal

a logical of length p. Gives finer control over which margins to use the empirical distribution for.

seed

an integer for the random seed

verb

print progress of MCMC(TRUE/FALSE)?

Value

An object of class psgc containing the following components:

C.psamp

an array of size p x p x nsamp/odens, consisting of posterior samples of the correlation matrix.

Y.pmean

the original datamatrix with imputed values replacing missing data

Y.impute

an array of size n x p x nsamp/odens, consisting of copies of the original data matrix, with posterior samples of missing values included.

LPC

the log-probability of the latent variables at each saved sample. Used for diagnostic purposes.

Details

This function produces MCMC samples from the posterior distribution of a correlation matrix, using a scaled inverse-Wishart prior distribution and an extended rank likelihood. It also provides imputation for missing values in a multivariate dataset.

References

http://www.stat.washington.edu/hoff/

Examples

Run this code
# NOT RUN {
fit<-sbgcop.mcmc(swiss)
summary(fit)
plot(fit)

# }

Run the code above in your browser using DataLab