-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Hi @SachaEpskamp,
I am looking for a way to compare two cross-lagged network panel models (CLPN, Wysocki et al. approach) with the NCT. Is there any way to use the NCT with these CLPN models? I am aware that CLPN is a work in progress and the NCT is designed primarily for cross-sectional networks but barring other ways of examining the replicability/generalizability of CLPNs I think it would still be useful.
More detail:
The CLPN currently relies upon a custom function that calls on glmnet. Here exemplified with a two-wave panel sample 2013-2015 and 9 variables for each wave.
df <- as.matrix(longi13_15)
k <- 9
adjMat <- matrix(0, k, k)
CLPN.fun <- function(df) {
for (i in 1:k){
lassoreg <- cv.glmnet(as.matrix(df[,1:k]), df[,(k+i)],
family = "gaussian", alpha = 1, standardize=TRUE)
lambda <- lassoreg$lambda.min
adjMat[1:k,i] <- coef(lassoreg, s = lambda, exact = FALSE)[2:(k+1)]
}
return(adjMat)
}
This function can then be used with bootnet's estimateNetwork, like this:
labels <- c("1", "2", "3", "4", "5", "6", "7", "8", "9")
pg13_15CL <- estimateNetwork(df, fun = CLPN.fun, labels = labels, directed = T)
Which also allows for it being used in bootstrapping procedures:
boot_CL <- bootnet(pg13_15CL, directed = T, nBoots = 1000, nCores = 1, type = "nonparametric", statistics = c("edge", "OutStrength", "InStrength"))
However, I am not able to feed this model (as estimated with estimateNetwork) into the NCT. Doing so results in an error message (pg15_15CLB is just another version of the same model for testing):
Error in NCT(pg13_15CL, pg13_15CLB, it = 10, estimator = CLPN.fun) :
Custom estimator function not supported for bootnet objects
Relatedly, the NCT works when I try the same approach with another function which calls on psychonetrics which might suggest that the issue relates to how it handles the CLPN function.