Is the description of mvnrnd a little bit misleading?
7 views (last 30 days)
Show older comments
Input SIGMA is said to be the covariance, but in case of uncorrelated variables this means that SIGMA = sigma^2, isn't it?
1 Comment
Jochem Bonarius
on 19 Jul 2019
Edited: Jochem Bonarius
on 19 Jul 2019
Only for a single vaiable. If more, then it's
SIGMA = I^N * [sigma_1^2 sigma_2^2 ... sigma_N^2] or diag([sigma_1^2 sigma_2^2 ... sigma_N^2])
Answers (4)
Walter Roberson
on 18 Jun 2017
In this situation, it is confusing unless you read and think about the small print. I hit exactly this problem myself and spent a good hour trying to figure out it before I read the documentation more carefully. It might make sense to people with a lot of experience in statistics, but for the rest of us, the term "sigma" is strongly associated with standard deviation, not with variance.
0 Comments
John D'Errico
on 17 Jun 2017
Edited: John Kelly
on 22 Jun 2017
"covariance matrix SIGMA."
"SIGMA is a D-by-D symmetric positive semi-definite matrix"
"If the covariance matrix is diagonal, containing variances along the diagonal and zero covariances off the diagonal, SIGMA may also be specified as a 1-by-D matrix..."
So SIGMA is stated to be a covariance matrix in multiple places, or at least, a vector of variances. The diagonal elements of a covariance matrix are known to be VARIANCES, not standard deviations. That some people may often use the lower case greek letter sigma to indicate a standard deviation means you need to be careful. But a variable name like this means nothing out of context.
0 Comments
Gregory Canal
on 18 Jul 2019
The other concern I have with this notation is that you would expect the behavior of mvnrnd in 1 dimension to reduce to normrnd. But 'sigma' in 1 dimension is defined differently in both functions (variance vs standard deviation).
1 Comment
Steven Lord
on 18 Jul 2019
There is a note in the Tips section on the mvnrnd documentation page describing this difference in behavior between mvnrnd and normrnd.
If you feel that information should be made more prominent, or if you have other feedback about that page, I recommend using the "How useful was this information?" box at the bottom of the page to rate the page and offer feedback about what you feel should be added, removed, or reworked in the documentation. [For feedback about the functionality, you should probably send that to Technical Support.]
Jochem Bonarius
on 19 Jul 2019
Edited: Jochem Bonarius
on 19 Jul 2019
So the problem is actually in mathematic notation. I will use Wikipedia for my explanation, as it is accurate enough.
What the software developer did, probably in attempt to mimick scientific notation, is use lower case "sigma" to represent σ and upper case "SIGMA" to represent Σ. But this is of course very confusing. And it misses the purpose of using a single character to represent a value, by changing it into a full word.
What the software developer should have done, from a UI perspective, is just call the inputs "standard_deviation" and "covariance_matrix".
0 Comments
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!