MATLAB for Brain and Cognitive Scientists by Mike X Cohen

MATLAB for Brain and Cognitive Scientists by Mike X Cohen

Author:Mike X Cohen [Cohen, Mike]
Language: eng
Format: epub, pdf
Publisher: MIT Press
Published: 2017-05-12T00:00:00+00:00


16.7 Exercises

1. In this exercise, you will explore the effects of correlation strength and sample size on simulated correlated data. Write a triple-loop to create two signals of different lengths and correlation strengths and 100 iterations (trials) of each length-strength pair. For each simulated correlation, compute the squared distance between the true correlation that you specified and the estimated correlation coefficient. Plot the trial-averaged results in two 2D images (one image for average correlation coefficients, and one image for the average distance to the true correlation. How do you interpret the results—is it better to have a strong effect or more data?

2. So far you’ve learned only how to create a bivariate data set with known correlation. What about a multivariate data set with a known covariance structure? This can be implemented by constructing the desired covariance matrix and scaling random numbers by the Cholesky factorization of that covariance matrix (the Cholesky factorization is a way to represent a symmetric matrix using two triangular matrices). You can also create multivariate correlated data using eigendecomposition, which you’ll learn about in the next chapter. Below is code to create a 1,000-by-3 matrix of correlated random numbers. Perform a sanity check to test whether the data show the requested covariance matrix.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.