简体   繁体   中英

Using R package RSiena, how do I test goodness of fit?

I would like to be able to test whether my fitted model represents the data well, eg:

myalgorithm <- sienaAlgorithmCreate(nsub=2, n3=100)
# nsub=2 and n3=100 is used here for having a brief computation, not for practice.
mynet1 <- sienaDependent(array(c(tmp3, tmp4), dim=c(32, 32, 2)))
mydata <- sienaDataCreate(mynet1)
myeff <- getEffects(mydata)
ans <- siena07(myalgorithm, data=mydata, effects=myeff, batch=TRUE)

How can I check whether the degree distributions in ans fit well?

I found it. Use sienaGOF :

mynet1 <- sienaDependent(array(c(s501, s502, s503), dim=c(50, 50, 3)))
mynet2 <- sienaDependent(array(c(s503, s502, s501), dim=c(50, 50, 3)))
mybeh <- sienaDependent(s50a, type='behavior')
mydata <- sienaDataCreate(mynet1, mynet2, mybeh)
myeff <- getEffects(mydata)
myeff <- includeEffects(myeff, transTrip)
myeff <- includeEffects(myeff, recip, name="mynet2")
myeff <- setEffect(myeff, cycle3, fix=TRUE, test=TRUE, include=TRUE)
myeff  <- setEffect(myeff, nbrDist2, fix=TRUE, test=TRUE, include=TRUE)
myeff <- setEffect(myeff, transTies, fix=TRUE, test=TRUE, include=TRUE)
myalgorithm <- sienaAlgorithmCreate(n3=200)
ans <- siena07(myalgorithm, data=mydata, effects=myeff, returnDeps=TRUE)
gofi <- sienaGOF(ans, IndegreeDistribution, verbose=TRUE, join=TRUE,
                varName="mynet1")

You can even plot a graph of the results to see where the observed data lies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM