# Get depression data
data <- depression[,24:44]
# Estimate EGM (using EGA)
egm_ega <- EGM(data)
# Estimate EGM (using EGA) specifying communities
egm_ega_communities <- EGM(data, communities = 3)
# Estimate EGM (using EGA) specifying structure
egm_ega_structure <- EGM(
data, structure = c(
1, 1, 1, 2, 1, 1, 1,
1, 1, 1, 3, 2, 2, 2,
2, 3, 3, 3, 3, 3, 2
)
)
# Estimate EGM (using standard)
egm_standard <- EGM(
data, EGM.model = "standard",
communities = 3, # specify number of communities
p.in = 0.95, # probability of edges *in* each community
p.out = 0.80 # probability of edges *between* each community
)
if (FALSE) {
# Estimate EGM (using EGA search)
egm_ega_search <- EGM(
data, EGM.model = "EGA", search = TRUE
)
# Estimate EGM (using EGA search and AIC criterion)
egm_ega_search_AIC <- EGM(
data, EGM.model = "EGA", search = TRUE, opt = "AIC"
)
# Estimate EGM (using search)
egm_search <- EGM(
data, EGM.model = "standard", search = TRUE,
communities = 3, # need communities or structure
p.in = 0.95 # only need 'p.in'
)}
Run the code above in your browser using DataLab