You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to generate 1000 simulations of a 15-variable series. To do so, I am using a 15x15 correlation matrix as an input to the rmulti() function. All the observations are drawn from beta distributions, with different shape1 and shape2 parameters at each point in the series, all of which are positive values.
My correlation matrix is positive definite, as assessed by the is_pos_definite() function and also the is.positive.definite() function from the matrixcalc package. My matrix is also symmetric, as assessed by the is.symmetric.matrix() function. The matrix can be created thus:
When I run the rmulti() function, it eventually returns: Error: The correlation you specified is impossible: correlation matrix not positive definite despite the functions quoted above confirming positive definite status.
Troubleshooting
If I reduce the dimensions of the matrix to 9x9 (or smaller) and the decay parameter to 0.5 I can successfully generate correlated values - in larger dimensional cases or if I increase the decay parameter, I receive the error quoted above.
Outcome
I'm happy to be educated on the nuances of setting up correlation matrices, but I'd like to understand why my process is failing, using the rmulti() function.
Thanks for your advice!
EDIT
I should add that if I set the rmulti() function argument r to be a static value (e.g., 0.8) rather than use a varying correlation matrix, I can successfully generate values.
FURTHER EDIT
Discovered that by adjusting the rmulti() function to use lower.tri() instead of upper.tri() the issue is resolved and I can use a 15x15 matrix successfully. This solution is built off issue #107https://github.com/debruine/faux/issues/107
The text was updated successfully, but these errors were encountered:
Aim
I am attempting to generate 1000 simulations of a 15-variable series. To do so, I am using a 15x15 correlation matrix as an input to the rmulti() function. All the observations are drawn from beta distributions, with different shape1 and shape2 parameters at each point in the series, all of which are positive values.
My correlation matrix is positive definite, as assessed by the is_pos_definite() function and also the is.positive.definite() function from the matrixcalc package. My matrix is also symmetric, as assessed by the is.symmetric.matrix() function. The matrix can be created thus:
Problem
When I run the rmulti() function, it eventually returns:
Error: The correlation you specified is impossible: correlation matrix not positive definite
despite the functions quoted above confirming positive definite status.Troubleshooting
If I reduce the dimensions of the matrix to 9x9 (or smaller) and the decay parameter to 0.5 I can successfully generate correlated values - in larger dimensional cases or if I increase the decay parameter, I receive the error quoted above.
Outcome
I'm happy to be educated on the nuances of setting up correlation matrices, but I'd like to understand why my process is failing, using the rmulti() function.
Thanks for your advice!
EDIT
I should add that if I set the rmulti() function argument r to be a static value (e.g., 0.8) rather than use a varying correlation matrix, I can successfully generate values.
FURTHER EDIT
Discovered that by adjusting the rmulti() function to use lower.tri() instead of upper.tri() the issue is resolved and I can use a 15x15 matrix successfully. This solution is built off issue #107 https://github.com/debruine/faux/issues/107
The text was updated successfully, but these errors were encountered: