is `summary` working properly for returning netstats?
martinamorris opened this issue · comments
This works:
library(tergm) # diss-persist branch
data(samplk)
samplist <- list(samplk1,samplk2,samplk3)
samp.fit <- tergm(
samplist ~
Form(~edges+mutual+cyclicalties+transitiveties) +
Diss(~edges+mutual+cyclicalties+transitiveties),
estimate = "CMLE",
times = c(1:3)
)
So I would have expected this to work, but it doesn't
summary(samplist ~
Form(~edges+mutual+cyclicalties+transitiveties) +
Diss(~edges+mutual+cyclicalties+transitiveties),
estimate = "CMLE",
times = c(1:3)
)
Error: A network object on the LHS of the formula or as a basis argument must be given Run `rlang::last_error()` to see where the error occurred.
This is working as intended: summary()
has no way of knowing that it's a list of networks.
summary(NetSeries(samplist) ~
Form(~edges+mutual+cyclicalties+transitiveties) +
Diss(~edges+mutual+cyclicalties+transitiveties),
estimate = "CMLE",
times = c(1:3)
)
should work fine, though it would probably ignore times
.
Thanks. I was hoping to use summary here the same way we do with ergm
-- to get the values of the model suff stats. But this makes it clear I don't understand the tergm
temporal operator Cross
.
The time series of the tergm stats (using tsna
):
> tErgmStats(sampdyn, "~edges+mutual+cyclicalties+transitiveties")
Time Series:
Start = 0
End = 3
Frequency = 1
edges mutual cyclicalties transitiveties
0 55 14 16 18
1 57 15 26 30
2 56 15 33 36
3 0 0 0 0
summary output for the Cross()
+ Change()
model:
> summary(NetSeries(samplist) ~
+ Cross(~edges+mutual+cyclicalties+transitiveties) +
+ Change(~edges+mutual+cyclicalties+transitiveties)
+ )
edges mutual cyclicalties
113 30 59
transitiveties Change~edges Change~mutual
66 75 7
Change~cyclicalties Change~transitiveties
16 24
Matches the netstats in the fit object:
> samp.fit2 <- tergm(samplist ~
+ Cross(~edges+mutual+cyclicalties+transitiveties) +
+ Change(~edges+mutual+cyclicalties+transitiveties),
+ estimate = "CMLE",
+ times = c(1:3)
+ )
samp.fit2[["nw.stats"]]
edges mutual cyclicalties transitiveties
113 30 59 66
Change~edges Change~mutual Change~cyclicalties Change~transitiveties
75 7 16 24
The Cross
terms are the sum of the stats for times 2 & 3. I thought they were supposed to be the stats for the first network?
Cross
and Change
are all functions of network transitions and can only be used on objects that contain the transition information. The others are cross-sectional and can be used on all networks.
I think this is resolved. @martinamorris , if not, please reoopen.