-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correlation matrix is not positive definite #129
Comments
While the original sample has 43 cases, the bootstrapped samples will have fewer than 43 cases leading to potentially non-positive definite correlation matrices used as input. While technically EBICglasso can still be used (you would have to overwrite this error both in qgraph and bootnet) I really do not advice you to do so. See here for more info: |
Hi Sacha, thanks for your response. In this example:#126, the number of datapoints was fewer than number of nodes. In my project, number of datapoints (43) beyonds the number of nodes (37). Why would this error still happened? |
Even though you have more datapoints than nodes in the original data, you don't have this in the bootstrapped data as you resample cases with replacement, leading to less unique cases. See for example:
|
Hi Sacha,
I encounter a problem when I used bootnet function. For my data, I got 37 nodes and 43 samples. Although the number of samples is not large, it still exceeds the number of nodes.
The code I'm using is as follows:
mynetwork <- estimateNetwork(raw_data, default = "EBICglasso", tuning = 0.5,corMethod="spearman")
b1<-bootnet(mynetwork,nBoots=1000,type="nonparametric",nCores=1,statistics=c("strength","betweenness", "closeness","edge"))
I got the following error message:
Note: bootnet will store only the following statistics: strength, betweenness, closeness, edge
Bootstrapping...
| | 0%Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet_correlate(data = data, corMethod = corMethod, corArgs = corArgs, :
Correlation matrix is not positive definite.
Error in bootnet(mynetwork, nBoots = 1000, type = "nonparametric", nCores = 1, :
Maximum number of errors in bootstraps reached
Thanks for the help!
The text was updated successfully, but these errors were encountered: