To illustrated the issue, I have written the code below which first generates a dataset of 4000 cases of 6 variables, each with values randomly selected from 5 levels (0 to 4).Then these 6 variables are summed for each row. Then the dataset is splitted based on quartiles of this total(column name is"t"). Next, Qgraph package in r generates first 4 graphs, each for a quartile then the last graph for the complete original dataset. The whole dataset's graph predictably shows no edges or a couple with very weak values(correlation matrix is printed in the console) but almost all nodes in quartile graphs are connected by significant negative correlations. I have simulated this(1000 rounds) and the result is exactly the same, just the random couple of edges in whole dataset graph disappear. Is there a problem with the code? If not can somebody help me with an explanation for this phenomenon dataset of random variables with no correlations but subsets based on sum of variables have significant negative correlations between variables, which pass even bonferroni correction)?Attached is the R code to generate random dataset and replicate the experiment.

More Farhad Montazeri's questions See All
Similar questions and discussions