Comments (3)
The need the covariance matrix and mean array because we need to give the computer a specific distribution to generate data from. The exercise in class was to generate "synthetic data" from a known distribution. Then, we run our estimation procedure on that synthetic data and test how our estimator performs. These particular numbers were chosen arbitrarily. I just wanted numbers that would allow me to demonstrate omitted variable bias.
In the HW, I describe a probability distribution in which an instrument exists that will allow us to correct for this endogeneity. You'll need to write code to generate synthetic data from that probability distribution. This means that you'll need to generate data for epsilon, u, and z_1. You'll use that data to construct the data for x_1 and y.
Hope this answers your question! Lemme know if I can elaborate on anything further.
from comp-econ-sp19.
Not sure I understand how to construct the covariance matrix, as I am not sure the "order" to put the rows and columns in in the matrix in order to correctly place the covariance values given.
Currently I have this. I'm not sure if I got the covariance matrix right.
cov = np.array([[1,0, 0],
[0,1,0.5],
[0, 0.5, 1]])
mean = np.array([0, 0, 0])
beta0, beta1 , gamma0, gamma1 = 1, 1, 1, 1
Z = scipy.stats.multivariate_normal.rvs(mean=mean, cov=cov, size=N)
df = pd.DataFrame(Z, columns=['epsilon', 'u', 'z1'])
df['x1'] = gamma0 + gamma1 * df.z1 + df.u
df['y'] = beta0 + beta1 * df.x1 + df.epsilon
return df
from comp-econ-sp19.
The order doesn't really matter as long as you're consistent with it. The random number generator will give you an N x 3 matrix of random variables. Each row is a separate draw. The order of the variables in that row is the order that you chose when you defined the mean vector and the variance-covariance matrix.
Judging from the ordering of you columns columns=['epsilon', 'u', 'z1']
, it looks like you might need to adjust your variance-covariance matrix. We should have covariance between
from comp-econ-sp19.
Related Issues (20)
- mle_args HOT 1
- Dealing with NaN Values HOT 3
- Correct Queries, Consistent Issues Running Database HOT 1
- Optimizer not working but generating correct log-likelihood values HOT 1
- Kaggle Not Running HOT 1
- wrong value for Q1 HOT 3
- Ari's monday office hours HOT 1
- Difference between value function and policy function HOT 1
- McCall Wage Values HOT 2
- Typo in HW 7
- HW7 eatCake graphs & output HOT 1
- McCall Modification HOT 1
- EatCake Problem 1 HOT 3
- Replicate Bresnahan Reiss-1991 Solutions Question HOT 1
- issue with HW7 Q5 HOT 1
- Final Review HOT 1
- Using opt.minimize on discrete data HOT 3
- Questions for Bresnahan HW HOT 1
- office hours today HOT 1
- MLE for Bernoulli distribution HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comp-econ-sp19.