首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代做NEKN96、代写c/c++,Java程序设计
项目预算:
开发周期:
发布时间:
要求地区:
Homework Assignment 1
NEKN96
Guidelines
1. Upload the HWA in .zip format to Canvas before the 2nd of October, 23:59, and only
upload one HWA for each group. The .zip ffle should contain two parts:
- A report in .pdf format, which will be corrected.
- The code you used to create the output/estimates for the report. The code itself will
not be graded/corrected and is only required to conffrm your work. The easiest is to add
the whole project folder you used to the zip ffle.
1 However, if you have used online tools,
sharing a link to your work is also ffne.
2
2. The assignment should be done in groups of 3-4 people, pick groups at
Canvas → People → Groups.
3
3. Double-check that each group member’s name and ID number are included in the .pdf ffle.
4. To receive your ffnal grade on the course, a PASS is required on this HWA.
- If a revision is required, the comments must be addressed, and an updated version should
be mailed to ioannis.tzoumas@nek.lu.se. However, you are only guaranteed an additional
evaluation of the assignment in connection to an examination period.
4
You will have a lot of ffexibility in how you want to solve each part of the assignment, and all things
that are required to get a PASS are denoted in bullet points:
Beware, some things require a lot of work, but you should still only include the ffnal table or ffgure
and not all intermediary steps. If uncertain, add a sentence or two about how you reached your
conclusions, but do not add supplementary material. Only include the tables/ffgures explicitly asked
for in the bullet points.
Good Luck!
1Before uploading the code, copy-paste the project folder to a new directory and try to re-run it. Does it still work?
2Make sure the repository/link is public/working before sharing it.
3Rare exceptions can be made if required.
4Next is the retake on December 12th, 2024.
1NEKN96
Assignment
Our goal is to put into practice the separation of population vs. sample using a linear regression
model. This hands-on approach will allow us to generate a sample from a known Population Regression
Function (PRF) and observe how breakages of the Gauss-Markov assumptions can affect our sample
estimates.
We will assume that the PRF is:
Y = α + β1X1 + β2X2 + β3X3 + ε (1)
However, to break the assumptions, we need to add:
A0: Non-linearities
A2: Heteroscedasticity
A4: Endogeneity
A7: Non-normality in a small sample
A3 autocorrelation will be covered in HWA2, time-series modelling.
Q1 - All Assumptions Fulfflled
Let’s generate a ”correct” linear regression model. Generate a PRF with the parameters:
α = 0.7, β1 = −1, β2 = 2, β3 = 0.5, ε ∼ N(0, 4), Xi
iid∼ N(0, 1). (2)
The example code is also available in Canvas
Setup Parameters
n = 30
p = 3
beta = [-1, 2, 0.5]
alpha = 0.7
Simulate X and Y, using normally distributed errors
5
np. random . seed ( seed =96)
X = np. random . normal (loc=0, scale =1, size =(n, p))
eps = np. random . normal (loc =0, scale =2, size =n)
y = alpha + X @ beta + eps
Run the correctly speciffed linear regression model
result_OLS = OLS( endog =y, exog = add_constant (X)). fit ()
result_OLS . summary ()
Add a well-formatted summary table
Interpret the estimate of βˆ
2 and the R2
.
5
Important: The np.random.seed() will ensure that we all get the same result. In other words, ensure that we are
using the ”correct” seed and that we don’t generate anything else ”random” before this simulation.
2NEKN96
In a paragraph, discuss if the estimates are consistent with the population regression function.
Why, why not?
Re-run the model, increasing the sample size to n = 10000. In a paragraph, explain what happens
to the parameter estimates, and why doesn’t R2 get closer and closer to 1 as n increases?
Q2 - Endogeneity
What if we (wrongly) assume that the PRF is:
Y = α + β1X1 + β2X2 + ε (3)
Use the same seed and setup as in Q1, and now estimate both the ”correct” and the ”wrong” model:
result_OLS = OLS( endog =y, exog = add_constant (X)). fit ()
result_OLS . summary ()
result_OLS_endog = OLS ( endog =y, exog = add_constant (X[:,0:2 ])). fit ()
result_OLS_endog . summary ()
Shouldn’t this imply an omitted variable bias? Show mathematically why it won’t be a problem
in this speciffc setup (see lecture notes ”Part 2 - Linear Regression”).
Q3 - Non-Normality and Non-Linearity
Let’s simulate a sample of n = 3000, keeping the same parameters, but adding kurtosis and skewness
to the error terms:
6
n = 3000
X = np. random . normal (loc=0, scale =1, size =(n, p))
eps = np. random . normal (loc =0, scale =2, size =n)
eps_KU = np. sign ( eps) * eps **2
eps_SKandKU_tmp = np. where ( eps_KU > 0, eps_KU , eps_KU *2)
eps_SKandKU = eps_SKandKU_tmp - np. mean ( eps_SKandKU_tmp )
Now make the dependent variable into a non-linear relationship
y_exp = np.exp( alpha + X @ beta + eps_SKandKU )
Create three ffgures:
1. Scatterplot of y exp against x 1
2. Scatterplot of ln(y exp) against x 1
3. plt.plot(eps SKandKU)
The ffgure(s) should have a descriptive caption, and all labels and titles should be clear to the
reader.
Estimate two linear regression models:
6The manual addition of kurtosis and skewness will make E [ε] ̸= 0, so we need to remove the average from the errors
to ensure that the exogeneity assumption is still fulfflled.
3NEKN96
res_OLS_nonLinear = OLS( endog =y_exp , exog = add_constant (X)). fit ()
res_OLS_transformed = OLS ( endog =np.log ( y_exp ), exog = add_constant (X)). fit ()
Add the regression tables of the non-transformed and transformed regressions
In a paragraph, does the transformed model fft the population regression function?
Finally, re-run the simulations and transformed estimation with a small sample, n = 30
Add the regression table of the transformed small-sample estimate
Now, re-do this estimate several times
7 and observe how the parameter estimates behave. Do
the non-normal errors seem to be a problem in this spot?
Hint: Do the parameters seem centered around the population values? Do we reject H0 : βi = 0?
In a paragraph, discuss why assuming a non-normal distribution makes it hard to ffnd the
distributional form under a TRUE null hypothesis, H0 ⇒ Distribution?
Hint: Why is the central limit theorem key for most inferences?
Q4 - Heteroscedasticity
Suggest a way to create heteroscedasticity in the population regression function.
8
Write down the updated population regression function in mathematical notation
Estimate the regression function assuming homoscedasticity (as usual)
Adjust the standard errors using a Heteroscedastic Autocorrelated Consistent (HAC) estimator
(clearly state which HAC estimator you use)
Add the tables of both the unadjusted and adjusted estimates
In a paragraph, discuss if the HAC adjustment to the standard errors makes sense given the
way you created the heteroscedasticity. Did the HAC adjustment seem to ffx the problem?
Hint: Bias? Efffcient?
7Using a random seed for each estimate.
8Tip: Double-check by simulating the model and plotting the residuals against one of the regressors. Does it look
heteroscedastic?
4
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写data driven business mod...
2024-11-12
代做acct1101mno introduction...
2024-11-12
代做can207 continuous and di...
2024-11-12
代做dsci 510: principles of ...
2024-11-12
代写25705 financial modellin...
2024-11-12
代做ccc8013 the process of s...
2024-11-12
代做intro to image understan...
2024-11-12
代写eco380: markets, competi...
2024-11-12
代写ems726u/p - engineering ...
2024-11-12
代写cive5975/cw1/2024 founda...
2024-11-12
代做csci235 – database syst...
2024-11-12
代做ban 5013 analytics softw...
2024-11-12
代写cs 17700 — lab 06 fall ...
2024-11-12
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!