0
$\begingroup$

I want to simulate data with the same effect sizes and structure of my real data to perform sensitivity analysis for a pathway analysis(sem). Wesley has demonstrated how to simulate multivariate correlated data here. Is it possible to simulate data sets for a specified correlation and p-value and how? There are ten variables. The correlation and p value are as follows:

correlation matrix:

#          [,1]    [,2]    [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]   [,10]
#  [1,]  1.0000 -0.3549  0.1522  0.0486  0.1426 -0.2742 -0.2421  0.0664  0.0419  0.1728
#  [2,] -0.3549  1.0000 -0.0428  0.1441 -0.5491  0.5022 -0.3591 -0.2976 -0.1794 -0.0635
#  [3,]  0.1522 -0.0428  1.0000  0.0300  0.3837 -0.3823  0.0217  0.0898  0.1018  0.0239
#  [4,]  0.0486  0.1441  0.0300  1.0000 -0.1121  0.0302 -0.1347 -0.0365 -0.0462 -0.0092
#  [5,]  0.1426 -0.5491  0.3837 -0.1121  1.0000 -0.2604  0.2168  0.3011  0.1409 -0.1480
#  [6,] -0.2742  0.5022 -0.3823  0.0302 -0.2604  1.0000 -0.1130 -0.0385 -0.0881  0.0599
#  [7,] -0.2421 -0.3591  0.0217 -0.1347  0.2168 -0.1130  1.0000  0.0697  0.1179 -0.1223
#  [8,]  0.0664 -0.2976  0.0898 -0.0365  0.3011 -0.0385  0.0697  1.0000  0.4907 -0.2471
#  [9,]  0.0419 -0.1794  0.1018 -0.0462  0.1409 -0.0881  0.1179  0.4907  1.0000 -0.1243
# [10,]  0.1728 -0.0635  0.0239 -0.0092 -0.1480  0.0599 -0.1223 -0.2471 -0.1243  1.0000

p-value:

#        [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10]
#  [1,]    NA 0.023 0.349 0.766 0.374 0.043 0.127 0.680 0.795 0.280
#  [2,] 0.023    NA 0.793 0.375 0.001 0.001 0.021 0.059 0.262 0.693
#  [3,] 0.349 0.793    NA 0.814 0.002 0.002 0.865 0.481 0.423 0.851
#  [4,] 0.766 0.375 0.814    NA 0.378 0.812 0.288 0.774 0.717 0.943
#  [5,] 0.374 0.001 0.002 0.378    NA 0.036 0.083 0.015 0.263 0.239
#  [6,] 0.043 0.001 0.002 0.812 0.036    NA 0.370 0.761 0.486 0.636
#  [7,] 0.127 0.021 0.865 0.288 0.083 0.370    NA 0.581 0.349 0.332
#  [8,] 0.680 0.059 0.481 0.774 0.015 0.761 0.581    NA 0.001 0.047
#  [9,] 0.795 0.262 0.423 0.717 0.263 0.486 0.349 0.001    NA 0.324
# [10,] 0.280 0.693 0.851 0.943 0.239 0.636 0.332 0.047 0.324    NA
$\endgroup$
1
$\begingroup$

$p$-values for Pearson's correlation are usually derived from $t$-distribution with $n-2$ degrees of freedom using the formula

$$ t = r\sqrt{\frac{n-2}{1 - r^2}} $$

where $r$ is the estimated correlation coefficient and $n$ is sample size. So if you already know how to simulate correlated data, then the only thing that you need is use appropriate sample size for $p$-value to match.

| cite | improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.