Learn R Programming

amen (version 1.0)

ame: AME model fitting routine

Description

An MCMC routine providing a fit to an additive and multiplicative effects (AME) regression model to relational data of various types

Usage

ame(Y, Xdyad=NULL, Xrow=NULL, Xcol=NULL, rvar = !(model=="rrl") ,
cvar = TRUE, dcor = TRUE, R = 0, model="nrm",
intercept=!is.element(model,c("rrl","ord")),
odmax=rep(max(apply(Y>0,1,sum,na.rm=TRUE)),nrow(Y)), seed = 1, nscan =
50000, burn = 500, odens = 25, plot=TRUE, print = TRUE, gof=TRUE)

Arguments

Y
an n x n square relational matrix of relations. See model below for various data types.
Xdyad
an n x n x pd array of covariates
Xrow
an n x pr matrix of nodal row covariates
Xcol
an n x pc matrix of nodal column covariates
rvar
logical: fit row random effects?
cvar
logical: fit column random effects?
dcor
logical: fit a dyadic correlation?
R
integer: dimension of the multiplicative effects (can be zero)
model
character: one of "nrm","bin","ord","cbin","frn","rrl" - see the details below
intercept
logical: fit model with an intercept?
odmax
a scalar integer or vector of length n giving the maximum number of nominations that each node may make - used for "frn" and "cbin" models
seed
random seed
nscan
number of iterations of the Markov chain (beyond burn-in)
burn
burn in for the Markov chain
odens
output density for the Markov chain
plot
logical: plot results while running?
print
logical: print results while running?
gof
logical: calculate goodness of fit statistics?

Value

  • BETAposterior samples of regression coefficients
  • SABRposterior samples of Cov(a,b) and the dyadic correlation
  • APMposterior mean of additive row effects a
  • BPMposterior mean of additive column effects b
  • Uposterior mean of multiplicative row effects u
  • Vposterior mean of multiplicative column effects v
  • UVPMposterior mean of UV
  • EZestimate of expectation of Z matrix
  • YPMposterior mean of Y (for imputing missing values)
  • GOFobserved (first row) and posterior predictive (remaining rows) values of four goodness-of-fit statistics

Details

This command provides posterior inference for parameters in AME models of relational data, assuming one of six possible data types/models:

"nrm": A normal AME model.

"bin": A binary probit AME model.

"ord": An ordinal probit AME model. An intercept is not identifiable in this model.

"cbin": An AME model for censored binary data. The value of 'odmax' specifies the maximum number of links each row may have.

"frn": An AME model for fixed rank nomination networks. A higher value of the rank indicates a stronger relationship. The value of 'odmax' specifies the maximum number of links each row may have.

"rrl": An AME model based on the row ranks. This is appropriate if the relationships across rows are not directly comparable in terms of scale. An intercept, row random effects and row regression effects are not estimable for this model.

Examples

Run this code
data(YX_frn)
fit<-ame(YX_frn$Y,YX_frn$X,burn=5,nscan=5,odens=1,model="frn")
# you should run the Markov chain much longer than this

Run the code above in your browser using DataLab