create_correlated_abilities
Creates correlated ability parameters based on an input correlation matrix.
This is a helper function for use in synthesizing multi-dimensional data assuming multivariate normal distribution
Args
correlation_matrix- (2d array) Symmetric matrix defining the correlation between the abilities
n_participants- number of participants to synthesize
Returns
abilities- (2d array) correlated abilities
Expand source code
def create_correlated_abilities(correlation_matrix, n_participants): """ Creates correlated ability parameters based on an input correlation matrix. This is a helper function for use in synthesizing multi-dimensional data assuming multivariate normal distribution Args: correlation_matrix: (2d array) Symmetric matrix defining the correlation between the abilities n_participants: number of participants to synthesize Returns: abilities: (2d array) correlated abilities """ lower = np.linalg.cholesky(correlation_matrix) return lower @ np.random.randn(correlation_matrix.shape[0], n_participants)
Last modified April 15, 2020: Adding doc strings to utility functions. (99abcbc)