Description Usage Arguments Value Author(s) References Examples
Function to run the MCMC sampler to draw from the posterior distribution of intercept, slopes, latent positions, and intervention effect (if applicable). HLSMrandomEF( ) fits random effects model; HLSMfixedEF( ) fits fixed effects model.
1 2 3 4 5 6 7 8 9 10 11 12 13 | HLSMrandomEF(Y,edgeCov=NULL, receiverCov = NULL, senderCov = NULL,
FullX = NULL,initialVals = NULL, priors = NULL, tune = NULL,
tuneIn = TRUE,TT = NULL,dd, niter,intervention)
HLSMfixedEF(Y,edgeCov=NULL, receiverCov = NULL, senderCov = NULL,
FullX = NULL, initialVals = NULL, priors = NULL, tune = NULL,
tuneIn = TRUE, TT = NULL,dd, niter,intervention)
getBeta(object, burnin = 0, thin = 1)
getIntercept(object, burnin = 0, thin = 1)
getAlpha(object, burnin = 0, thin = 1)
getLS(object, burnin = 0, thin = 1)
getLikelihood(object, burnin = 0, thin = 1)
|
Y |
input outcome for different networks. Y can either be (i). list of socio-matrix for (ii). list of data frame with columns (iii). a dataframe with columns named as follows: |
edgeCov |
data frame to specify edge level covariates with (i). a column for network id named (ii). a column for sender node named (iii). a column for receiver nodes named (iv). columns for values of each edge level covariates. |
receiverCov |
a data frame to specify nodal covariates as edge receivers with (i.) a column for network id named (ii.) a column (iii). the rest for respective node level covariates. |
senderCov |
a data frame to specify nodal covariates as edge senders with (i). a column for network id named (ii). a column (iii). the rest for respective node level covariates. |
FullX |
list of numeric arrays of dimension |
initialVals |
an optional list of values to initialize the chain. If For fixed effect model For random effect model
|
priors |
an optional list to specify the hyper-parameters for the prior distribution of the paramters.
If priors =
|
tune |
an optional list of tuning parameters for tuning the chain. If tune =
|
tuneIn |
a logical to indicate whether tuning is needed in the MCMC sampling. Default is |
TT |
a vector of binaries to indicate treatment and control networks. If there is no intervention effect, TT = |
dd |
dimension of latent space. |
niter |
number of iterations for the MCMC chain. |
intervention |
binary variable indicating whether the posterior distribution of the intervention effect is to be estimated. |
object |
object of class 'HLSM' returned by |
burnin |
numeric value to burn the chain while extracting results from the 'HLSM'object. Default is |
thin |
numeric value by which the chain is to be thinned while extracting results from the 'HLSM' object. Default is |
Returns an object of class "HLSM". It is a list with following components:
draws |
list of posterior draws for each parameters. |
acc |
list of acceptance rates of the parameters. |
call |
the matched call. |
tune |
final tuning values |
Sam Adhikari
Tracy M. Sweet, Andrew C. Thomas and Brian W. Junker (2012), "Hierarchical Network Models for Education Research: Hierarchical Latent Space Models", Journal of Educational and Behavorial Statistics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | library(HLSM)
#Set values for the inputs of the function
priors = NULL
tune = NULL
initialVals = NULL
niter = 10
#Random effect HLSM on Pitt and Spillane data
random.fit = HLSMrandomEF(Y = ps.advice.mat,FullX = ps.edge.vars.mat,
initialVals = initialVals,priors = priors,
tune = tune,tuneIn = FALSE,dd = 2,niter = niter,
intervention = 0)
summary(random.fit)
names(random.fit)
#extract results without burning and thinning
Beta = getBeta(random.fit)
Intercept = getIntercept(random.fit)
LS = getLS(random.fit)
Likelihood = getLikelihood(random.fit)
##Same can be done for fixed effect model
#Fixed effect HLSM on Pitt and Spillane data
fixed.fit = HLSMfixedEF(Y = ps.advice.mat,FullX = ps.edge.vars.mat,
initialVals = initialVals,priors = priors,
tune = tune,tuneIn = FALSE,dd = 2,niter = niter,
intervention = 0)
summary(fixed.fit)
names(fixed.fit)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.