Say I'd like to simulate academic data
Code:
clear *
set seed 1066
cls
matrix input mCorr = (1, .3, .4\ .3, 1, 0, \ .4, 1, 1)
corr2data gpa gre final, n(2500) means(3.5 150 80) sds(.15 4 2) corr(mCorr)
corr
I want there to be a correlation between GRE test scores (GRE) ones gpa, and their final grade, with GRE being between 130 and 165 and GPA being between 2 and 4.5, and final being between 0 and 100. How might I specify, say, a correlation between these three variables?
I know it has something to do with this matrix command above... at present, Stata returns
Code:
. corr2data gpa gre final, n(2500) means(3.5 150 80) sds(.15 4 2) corr(mCorr)
corr(mCorr) is not symmetric
How might I solve this? I've always wondered how we can perfectly (almost) specify a relationship between a set of variables, since this would come in handy in a simulation setting. I figured the easiest setting would be to use an academic example where the variables are pretty sensible to consider (i.e., better tests = better grades).
0 Response to Specifying a Correlation
Post a Comment