Learn R Programming

eigenmodel (version 1.11)

eigenmodel_mcmc: Approximate the posterior distribution of parameters in an eigenmodel

Description

Construct approximate samples from the posterior distribution of the parameters and latent variables in an eigenmodel for symmetric relational data.

Usage

eigenmodel_mcmc(Y, X = NULL, R = 2, S = 1000, seed = 1, Nss = min(S,
  1000), burn = 100)

Arguments

Y

an n x n symmetric matrix with missing diagonal entries. Off-diagonal missing values are allowed.

X

an n x n x p array of regressors

R

the rank of the approximating factor matrix

S

number of samples from the Markov chain

seed

a random seed

Nss

number of samples to be saved

burn

number of initial scans of the Markov chain to be dropped

Value

a list with the following components:

Z_postmean

posterior mean of the latent variable in the probit specification

ULU_postmean

posterior mean of the reduced-rank approximating matrix

Y_postmean

the original data matrix with missing values replaced by posterior means

L_postsamp

samples of the eigenvalues

b_postsamp

samples of the regression coefficients

Y

original data matrix

X

original regressor array

S

number of scans of the Markov chain

Examples

Run this code
# NOT RUN {

data(YX_Friend)

fit<-eigenmodel_mcmc(Y=YX_Friend$Y,X=YX_Friend$X,R=2,S=50,burn=50)

# in general you  should run the Markov chain longer than 50 scans

plot(fit)

#fit<-eigenmodel_mcmc(Y=Y_Gen,R=3,S=10000)

#fit<-eigenmodel_mcmc(Y=Y_Pro,R=3,S=10000)


# }

Run the code above in your browser using DataLab