GithubHelp home page GithubHelp logo

Comments (8)

SachaEpskamp avatar SachaEpskamp commented on May 28, 2024 1

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.

SachaEpskamp avatar SachaEpskamp commented on May 28, 2024 1

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.

dengxuebin avatar dengxuebin commented on May 28, 2024

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.

SachaEpskamp avatar SachaEpskamp commented on May 28, 2024

Another option would be to treat the 4-level variables as continuous and then use mixed graphical modeling in MGM.

from bootnet.

dengxuebin avatar dengxuebin commented on May 28, 2024

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.

SachaEpskamp avatar SachaEpskamp commented on May 28, 2024

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.

dengxuebin avatar dengxuebin commented on May 28, 2024

Sorry to make you confused. The explanation is following:

  1. 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.

  1. 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.

dengxuebin avatar dengxuebin commented on May 28, 2024

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.

  1. 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.

  2. 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.

  1. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.