Learn R Programming

covreg (version 1.0)

covreg.mcmc: Bayesian estimation of the covariance regressioin model

Description

covreg.mcmc is used to estimate the parameters in the covariance regression model providing Bayesian estimates.

Usage

covreg.mcmc(fmean, fcov, data = NULL, R = 1, niter = 10000, 
nthin = 10, nsave = niter/nthin, verb = T)

Arguments

fmean
an object of class "formula", model for the mean regression.
fcov
an object of class "formula", model for the covariance regression. Can be different from the mean model.
data
data frame containing variables in the model.
R
a positive integer, rank of the model.
niter
number of MCMC iterations.
nthin
number of thinning.
nsave
number of output iterations, calualted as niter/nthin.
verb
print progress of MCMC(TRUE/FALSE).

Value

  • B1.psampan array containing the MCMC samples of the mean regression coefficients
  • B2.psampan array containing the MCMC samples of the covariance regression coefficients
  • A.psampan array containing the MCMC samples of the baseline covariance matrix
  • matrix.meanthe design matrix of the mean regression
  • matrix.covthe design matrix of the covariance regression

Examples

Run this code
## load FEV data ##
data(fev)
## specify mean and cov models ##
library(splines)
fmean=as.formula(cbind(fev,height)~bs(age,knots=11))
fcov=as.formula(cbind(fev,height)~sqrt(age)+age)
## fit model ##
fit<-covreg.mcmc(fmean,fcov,data=fev,R=2,niter=100,nthin=1)
## summarize MCMC samples ##
M.psamp=m.psamp(fit)
S.psamp=cov.psamp(fit)

Run the code above in your browser using DataLab