Comments (8)
How many observations do you have? Likely this is due to polychoric correlations. I would use Spearman correlations in this case (corMethod = "cor", corArgs = list(method = "spearman")
).
Best, Sacha
from bootnet.
The bootnet_mgm
function is not supported for manual use. Please use:
network <- estimateNetwork(..., default = "mgm")
instead as described in the documentation. Then, you can bootstrap using bootnet(network)
. Using bootnet in the way you do above is not supported for MGM because the type
argument is used double.
from bootnet.
According to your reply, I solved the problem. Before I used "corMethod = "cor"" without "corArgs = list(method = "spearman")", it worked but I doubted the results because I thought the "cor" defaulted to pearson correlation which fits continuous data. Now, I think the results more reasonable. But I still have some worry because binary data essentially are categorical. Thus the spearson may be not strong enough, right? Thanks a lot for your immediate reply!
ps: my numbers of observation is 2864.
from bootnet.
Another option would be to treat the 4-level variables as continuous and then use mixed graphical modeling in MGM.
from bootnet.
Hi sacha, thanks for your reply!
In fact, I used "mgm" package to estimate network because I think ordinal and binary data should be categorical essentially and the code is following:
mgm_64<- mgm(data = as.matrix(sdr),
type = rep("c",64), level = c(rep(4,10),2,rep(4,23),2,2,rep(4,23),2,rep(4,4)),
k = 2, threshold = "HW", lambdaSel = 'EBIC', alphaSel="EBIC",
lambdaGam = 0.5, pbar = T)
Meanwhile I used "bootnet" to compute edge-weight accuracy and stability which is following
##stability
boot_64 <- bootnet(as.matrix(sdr), default ="EBICglasso", statistics
=c("edge","Betweenness","Strength","Closeness"),
corMethod="cor", corArgs = list(method = "spearman"),
nBoots = 1000, type = "case", nCores = 8)
##accuracy
boot1a <- bootnet(sdr, default ="EBICglasso", corMethod="cor",
corArgs = list(method = "spearman"), nBoots = 1000, nCores = 8)
The point is that all variables are categorial in mgm, while they are ordinal in bootnet, which may be inconsistent or reliable. But I don't know how to integrate all in one(i.e. bootnet). Have you any other suggestions? Thanks again!
from bootnet.
I don't really understand this. Why would you compute the stability using EBICglasso while you estimate the network using mgm? Just use estimateNetwork with the mgm default first?
from bootnet.
Sorry to make you confused. The explanation is following:
- When to estimate network, I used
types<-rep("c",64)
level <-c(rep(4,10),2,rep(4,23),2,2,rep(4,23),2,rep(4,4))
mgm_bt<-bootnet_mgm(as.matrix(sdr), type=types, level=level, tuning = 0.5,
criterion = "EBIC", threshold = "HW", order = 2)
it worked,but there was warning message
Estimating Network. Using package::function:
mgm::mgm for network computation
Using glmnet::glmnet
Warning message:
In bootnet_mgm(as.matrix(sdr), type = types, level = level, tuning = 0.5, :
Bootnet does not support unsigned edges and treats these as positive edges.
Thus I chosed mgm package directly.
2 When to calculate stability I used
boot_64 <- bootnet(as.matrix(sdr), default ="mgm", statistics=c("edge","Betweenness","Strength","Closeness"),
nBoots = 1000, type = "case", nCores = 8)
there was the following message:
Note: bootnet will store only the following statistics: edge, strength, outStrength, inStrength
Estimating sample network...
Estimating Network. Using package::function:
mgm::mgm for network computation
Using glmnet::glmnet
'type' argument not assigned. Setting type to 'c' for all binary variables and 'g' for all other variables.
'level' argument not assigned. Setting level to 1 for all Gaussian/Poisson variables and number of unique values for all categorical variables
Bootstrapping...
| | 0 % ~calculating
I did not know which data type was assign the data, binary, continual , categorical or anything else?
3 when to assign the data type to data using "type" parameter
boot_64 <- bootnet(as.matrix(sdr), default ="mgm", type=types,level=level,
nBoots = 1000, type = "case", nCores = 8)
there was a message:
Error in bootnet(as.matrix(sdr), default = "mgm", type = types, level = level, :
正式参数"type"有多个与之相对应的实际参数, this is chinese. the meaning is "the "type" parameter in mgm conflict with the "type" parameter in the bootnet."
Thus I don't know where to assign my data type to my data.
- when to use
boot_64 <- bootnet(as.matrix(sdr), default ="EBICglasso", statistics =c("edge","Betweenness","Strength","Closeness"),
corMethod="cor",nBoots = 1000, type = "case", nCores = 8)
it worked but no "warning" and "error" although I think it can be wrong.
I hope you can understand, but if not, I am very sorry to make you confused again.
from bootnet.
Thanks for your immediate reply. I used your method, it worked but need more than two days to finish. However I still had some questions.
-
when to estimate network, is it ok to ignore "the warning message"?
Warning message:
In bootnet_mgm(as.matrix(sdr), type = types, level = level, tuning = 0.5, :
Bootnet does not support unsigned edges and treats these as positive edges. -
when to split the dataframe above into two groups of observation(1772 & 1067) by condition(the number of variable is still 64) and estimate again. there were two types of warning message.
for 1772
mgm_ND1<-estimateNetwork(as.matrix(ND1), default = "mgm",
type = types,
level = level,
order = 2, threshold = "HW",
alphaSel="EBIC")
Estimating Network. Using package::function:
mgm::mgm for network computation
Using glmnet::glmnet
Warning message:
In (function (data, type, level, tuning = 0.5, missing = c("listwise", :
Bootnet does not support unsigned edges and treats these as positive edges.
it is the same as the complete data before.
for 1067
mgm_ND2<-estimateNetwork(as.matrix(ND2), default = "mgm",
type = types,
level = level,
order = 2, threshold = "HW",
alphaSel="EBIC")
Estimating Network. Using package::function:
mgm::mgm for network computation
Using glmnet::glmnet
Warning messages:
1: In lognet(x, is.sparse, ix, jx, y, weights, offset, alpha, nobs, :
one multinomial or binomial class has fewer than 8 observations; dangerous ground
2: from glmnet Fortran code (error code -90); Convergence for 90th lambda value not reached after maxit=100000 iterations; solutions for larger lambdas returned
3: In lognet(x, is.sparse, ix, jx, y, weights, offset, alpha, nobs, :
one multinomial or binomial class has fewer than 8 observations; dangerous ground
4: from glmnet Fortran code (error code -90); Convergence for 90th lambda value not reached after maxit=100000 iterations; solutions for larger lambdas returned
5: In (function (data, type, level, tuning = 0.5, missing = c("listwise", :
Bootnet does not support unsigned edges and treats these as positive edges.
it was different ,but I don't know the reason and how to handle it.
- It can take very long time to compute when numbers of nboots increase. I don't know whether there are some criteria to choose the number of iteration.
I wish your reply if you would. Thanks again!
from bootnet.
Related Issues (20)
- Follow-up on #83 re. `R CMD check` HOT 1
- Error in estimating Network using "IsingFit" HOT 2
- How to deal with nested data? HOT 2
- Warning message when using estimateNetwork() with default = "mgm" HOT 1
- Length of communities argument does not match number of nodes" error HOT 4
- Maximum numbers of errors in bootnet HOT 2
- Removing negative range in stability plot HOT 1
- Bug with CS-coefficient (?): same values are estimated for betweenness and strength HOT 3
- Plotting centrality stability showing only "strength" HOT 5
- Estimate group network bug? HOT 1
- Which bootstrapping default use with mgm? HOT 1
- edge weight bootstrap error HOT 3
- Correlation matrix is not positive definite HOT 2
- Subsetting estimate network object HOT 1
- HELP! Matrix not positive defined HOT 4
- Possible to use qgraph or weights matrix as input in bootnet? HOT 3
- Transforms corMethod = "npn" NAs into values? HOT 2
- Plotting bootstrapped edge CIs results in "Error in `dplyr::select()`" HOT 1
- Questions about the function "bootnet_IsingFit" from bootnet ? HOT 2
- Error with bootnet's bootstrapping HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootnet.