built-in plot functions for HLSM object

Share:

Description

plotLikelihood( ) plots the likelihood, and plotDiagnostic( ) plots diagnostic-plot of posterior draws of the parameters from MCMC sample. plotHLSM.random.fit( ) and plotHLSM.fixed.fit( ) are functions to plot mean-results from fitted models, and plotHLSM.LS( ) is for plotting the mean latent position estimates.

Usage

1
2
3
4
5
	plotLikelihood(object,burnin = 0, thin = 1)
	plotDiagnostic(chain)
	plotHLSM.random.fit(fitted.model,parameter,burnin=0,thin=1)
	plotHLSM.fixed.fit(fitted.model, parameter,burnin=0,thin=1)
	plotHLSM.LS(fitted.model,pdfname=NULL,burnin=0,thin=1,...)

Arguments

object

object of class 'HLSM' obtained as an output from HLSMrandomEF() or HLSMfixedEF()

fitted.model

model fit from either HLSMrandomEF() or HLSMfixedEF()

parameter

parameter to plot; specified as Beta for slope coefficients, Intercept for intercept, and Alpha for intervention effect

pdfname

character to specify the name of the pdf to save the plot if desired. Default is NULL

burnin

numeric value to burn the chain for plotting the results from the 'HLSM'object

thin

a numeric thinning value

chain

a numeric vector of posterior draws of parameter of interest.

...

other options

Value

returns plot objects.

Author(s)

Sam Adhikari

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#using advice seeking network of teachers in 15 schools
#to fit the data

#Random effect model#
priors = NULL
tune = NULL
initialVals = NULL
niter = 10

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)

plotLikelihood(random.fit)

intercept = getIntercept(random.fit)
dim(intercept) ##is an array of dimension niter by 15
plotDiagnostic(intercept[,1])
plotHLSM.LS(random.fit)
plotHLSM.random.fit(random.fit,parameter = 'Beta')
plotHLSM.random.fit(random.fit,parameter = 'Intercept')
##look at the diagnostic plot of intercept for the first school

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.