<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/another-wrong-entry/"></div></div><div><a data-url="http://www.r-bloggers.com/another-wrong-entry/" data-counturl="http://www.r-bloggers.com/another-wrong-entry/" data-count="horizontal" data-text="another wrong entry" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://xianblog.wordpress.com/2016/06/27/another-wrong-entry/"> R – Xi'an's Og</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a target="_blank" href="http://i1.wp.com/xianblog.files.wordpress.com/2016/06/nonpositivecorr.jpg?ssl=1"><img alt="" class="wp-image-30927" src="http://i1.wp.com/xianblog.files.wordpress.com/2016/06/nonpositivecorr.jpg?resize=450%2C272&ssl=1" data-recalc-dims="1"></a><strong><a target="_blank" href="http://www.amazon.com/gp/product/038771264X/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=038771264X&linkCode=as2&tag=chrprobboo-20&linkId=TA5CYKJQT4KDLXXK"><img height="190" alt="" width="128" src="https://books.google.fr/books/content?id=JN0rPpEpw3IC&printsec=frontcover&img=1&zoom=5&edge=curl&imgtk=AFLRE70VLNGu6_P9kibfk2WrWpg7bE41X3VUofK9E3I3qa-4jJyB515I8vU4446TC4w0YcM2a437OEUp49H-7sP1FbgxYXyEAF0p5dkjwcf-LYMYv2ToFgnPYg6pKfjCOUcdasy0WOJW"></a>Q</strong>uite a coincidence! I just came across <a target="_blank" href="https://xianblog.wordpress.com/2015/07/18/the-worst-possible-proof-xed/">another bug</a> in Lynch’s (2007) book, <a target="_blank" href="http://www.amazon.com/gp/product/038771264X/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=038771264X&linkCode=as2&tag=chrprobboo-20&linkId=TA5CYKJQT4KDLXXK%22">Introduction to Applied Bayesian Statistics and Estimation for Social Scientists</a>. Already discussed <a target="_blank" href="https://xianblog.wordpress.com/2015/07/18/the-worst-possible-proof-xed/">here</a> and on <a target="_blank" href="http://stats.stackexchange.com/a/160017/7224">X validated</a>. While working with one participant to the <a target="_blank" href="https://xianblog.wordpress.com/2016/02/26/post-isba-softshop/">post-ISBA softshop</a>, we were looking for efficient approaches to simulating correlation matrices and came [by <a target="_blank" href="https://goo.gl/9PyIF9">Google</a>] across the above R code associated with a 3×3 correlation matrix, which misses the additional constraint that <a target="_blank" href="http://blogs.sas.com/content/iml/2012/09/12/when-is-a-correlation-matrix-not-a-correlation-matrix.html">the determinant must be positive</a>. As shown e.g. by the example</p>
<pre>
> eigen(matrix(c(1,-.8,.7,-.8,1,.6,.7,.6,1),ncol=3))
$values
[1] 1.8169834 1.5861960 -0.4031794
</pre>
<p>having all correlations between -1 and 1 is not enough. Just. Not. Enough.</p>
<p>Filed under: <a target="_blank" href="https://xianblog.wordpress.com/category/books/">Books</a>, <a target="_blank" href="https://xianblog.wordpress.com/category/kids/">Kids</a>, <a target="_blank" href="https://xianblog.wordpress.com/category/statistics/r-statistics/">R</a>, <a target="_blank" href="https://xianblog.wordpress.com/category/statistics/">Statistics</a>, <a target="_blank" href="https://xianblog.wordpress.com/category/university-life/">University life</a> Tagged: <a target="_blank" href="https://xianblog.wordpress.com/tag/bayesian-analysis/">Bayesian Analysis</a>, <a target="_blank" href="https://xianblog.wordpress.com/tag/correlation/">correlation</a>, <a target="_blank" href="https://xianblog.wordpress.com/tag/cross-validated/">cross validated</a>, <a target="_blank" href="https://xianblog.wordpress.com/tag/introductory-textbooks/">introductory textbooks</a>, <a target="_blank" href="https://xianblog.wordpress.com/tag/linear-algebra/">linear algebra</a>, <a target="_blank" href="https://xianblog.wordpress.com/tag/positive-definite-matrix/">positive definite matrix</a>, <a target="_blank" href="https://xianblog.wordpress.com/tag/scott-lynch/">Scott Lynch</a> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xianblog.wordpress.com/30918/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/xianblog.wordpress.com/30918/" border="0"></a> <img alt="" src="http://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/another-wrong-entry/"></div></div><div><a data-url="http://www.r-bloggers.com/another-wrong-entry/" data-counturl="http://www.r-bloggers.com/another-wrong-entry/" data-count="vertical" data-text="another wrong entry" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://xianblog.wordpress.com/2016/06/27/another-wrong-entry/"> R – Xi'an's Og</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/KZ8bc24H414"></a></div>