[SOLVED] 代写 R algorithm html scala graph Takehome Final Project Due day: Jan 8, 2020

30 $

File Name: 代写_R_algorithm_html_scala_graph_Takehome_Final_Project_Due_day:_Jan_8,_2020.zip
File Size: 744.18 KB

SKU: 1297465055 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


Takehome Final Project Due day: Jan 8, 2020
December 16, 2019
The Orst question is to estimate the multinomial Probit Model MNP: Suppose there are n consumers in the market, i1; 2; :::; n. Each of them makes comsumption decision according to her indirect utility of commodities and the consumer picks up the commodity associated with largest indirect utilities. Let XijXij1; :::; XijpT denote a vector of observed characteristics of commodity j for consumer i, e.g., priceij is the trading price of j for consumer i. For simplicity, in this question we assume Xij is scalar p1. The indirect utility is assumed to be linearly separable, namely, the random utility of i choosing j follows
Uij0j 1jXijuijVijuij
where Vij is the deterministic utility towards researchers and uij captures the demand shock or unobserved evaluation of utilities of commodity j for consumer i which is generally unknown to the researchers but known to the consumers. In this exercise, j0; 1; 2; 3, i.e., there are 4 commodities. For the normalization purpose, we also assume Vi00, 0 is the outside choice.
According to the utility maximization, people choose commodity j if it maximizes their indirect utilities,
Yi j iUij Ui;j
The data observed for research are fYi;Xigni1 where Yi 2 f0;1;2;3g XifXijg3j0.
For the choice behavior, speciOcally, 1.
Yi0i
ui0ui0ui0
01 11Xi1ui1 02 12Xi2ui2 03 13Xi3ui3
1

which is equivalently
which is equivalently
2110032ui03 2X 3
56ui17 401 11i15 1010 4ui25 0212Xi2
1 0 0 1 u 03 13Xi3 M0 0X;
2.
4
zi3z
Yi 01 11Xi1ui1 01 11Xi1ui1 01 11Xi1ui1
1iui0
2110032ui03 2
56ui17 4 0 1 1 0 4ui2 5
0 1 0 1 u
M1 1X;
0203
12Xi2ui213Xi3ui3
4
zi3 z
01 01
02 11Xi1 12Xi2 03 11Xi1 13Xi3
X3 0111i1 5
3.
which is equivalently
Yi 02 12Xi2ui2 02 12Xi2ui2 02 12Xi2ui2
2iui0
2101032ui03 2
56ui17 4 0 1 1 0 4ui2 5
0 0 1 1 u
M2 2X;
0103
11Xi1ui113Xi3ui3
4
zi3 z
02 02
01 12Xi2 11Xi1 03 12Xi2 13Xi3
X3 0212i2 5
4.
Yi 03 13Xi3ui3 03 13Xi3ui3 03 13Xi3ui3
2
3i
ui0
0111Xi1ui10212Xi2ui2

which is equivalently
2100132ui03 2
X 3 03 13i3 5
56ui174 0 1 0 1 4ui2 5
4
zi3 z
0 0 1 1 u
M3 3X;
03 01 13Xi3 11Xi1 03 02 13Xi3 12Xi2
model, we further assume the uiui0; ui1; ui2; ui3T are joint uiN0;
normal
In Probit
identically for all i, i.e.,
where for the purpose of identiOcation of parameters , the variancecovariance matrix follows
Ln jX; Y
Pr M0u0 Xi; b jXi1fYi0g Pr M1ui1 Xi; b jXi1fYi1g Y Pr M2ui2 Xi; b jXi1fYi2g Pr M3ui3 Xi; b jXi1fYi3g
Yn i1
n i1
210003
6 0 1 0 0 7 ;2 0; 1
40015 001
and this covariance matrix captures the correlations among dierent choices of com modities. In this speciOcation, the unobserved characteristics of choice 2,3 are pos itively correlated. Since ui is normally distributed and Mju should also be joint normal with covariance matrix j VarMju. Since all the observations are i.i.d.
draw from the above MNP. The likelihood function of the parameters bT ; T can be written as
0 0 Xi; b1fYi0g1 1 Xi; b1fYi1g2 2 Xi; b1fYi2g3 3 Xi; b1fYi3g
is the CDF of multivariate normal distribution with 0 mean and covari argmaxlogLn jX;Y 1
2
a Simulate DGP: n500; Xij Unif2; 2 i.i.d. across i and j; 0:5;
i. 0j1 and 1j0:5 which are known to be identical across j research knows s are identical
ii. 011 and 02030:5; and 11 Unif0;1 and 1213 Unif0;1 b Specify j VarMj u, j0; 1; 2; 3 and discuss of the identiOcation of
3
where
ance . Therefore the MLE ofsolves the following optimization problem

c In case i, assumeis unknown, then estimate0; 1;according to 1. The maximization of log Ln jX; Ycan be implemented using proOled procedures:
given
0; 1 arg max log Ln b0; b1; jX; Y2 b0 ;b1
and then solve foraccording to
arg max logLn0;1;jX;Y
20;1
case ii, assumeis known to be 0:5 0:5 and you are required to solve
01; 02; 11 and 12 sinceitisknownthat 0203; 1213by max log Ln b01; b02; b11; b12jX; Y
b01 ;b02 ;b11 ;b12
Repeating drawing data from DGP as well as your estimation 100 times and
report the mean and standard deviation of your estimates of; . Hints:
a The conditional choice probability CCP,j j Xi;b, should be evaluated and calculated using GHK sampler do NOT use computer package
b In calculate the proOled MLE, the inner loop of 2 could be conducted through NelderMead algorithm since the gradients of multivariate normal CDF wonit be easily obtained.could be estimated through line search in an interval 0; 1
QuasiMCMC for Quantile Regression: Similar to the model we considered in class, we aim to estimating the following quantile regression model
YiXiT Ui
For simplicity, X ? U Unif0; 1 and we assume for any give x 2 X , quantile function
:! xTis increasing in , then
PrYiXiT jXiPrXiT UiXiT jXi
PrUi that is the quantile function of Y given X is
Q YijXiXiT
The quantile regression can also be written as an additive model:
YX0 X0 U X0
4

and in median regression, writeis short for 0:5 and similarly is short for 0:5, so YiXi0i. A typical example will be linear locationscale model:
suppose X Unif0; 1 ? N 0; 1,
Y0 1X1X
0 1X1X1U
01U 11UX
Andcan be obtained by minimizing a check loss function
argminE Yi Xi0b 3
b2B
whereu1 fu0g u, when 0:5, 0:5 ujuj. Therefore, 3 teaches
us in the Onite sample
argminXn YiXi0b 4 b2B i1
For b 2 Rp, deOne residual ri bYiXiT b, then
1Xn YiXi0b 5
where Fn u; b the empirical CDF of ri b 1 Xn
Zn i1
u dFn u; b
Fnu;b n 1fribug i1
since both empirical CDF andis not smoothed, Fernandes, GuerreHorta, 2019 considers a way of smoothing the Fn u; b which leads to a smoothed objective functions. The idea is following:
1. Smooth Fn u; b by some kernel functions K Zu
where
Xn fht;b 1 K trib
Fnh u;bfh t;bdt 1
nh i1 h
and K is a symmetric density kernel function and h is the corresponding bandwidth that shrinks to 0 as n ! 1.
5

2. Replace Fn u;b by Fnh u;b and redeOne the objective function for be shown that
where
and it can
6
huuKutudt
which is so called Convolutiontype smoothing of objective function 5
3. If K u up.d.f. of N 0; 1, it can also be shown that
u dFnh u; b ZXn
1 hYiXiTb n i1
Z
where
hui1EjZu;hj1u;Zu;h Nu;h2 22
1hG u1 u 2h2
212×2
exp2x 12 x ;is CDF of N 0; 1
G x
a Fernandes, GuerreHorta 2019, Journal of Business and Economic Statis tics Simulate the following DGP and estimate ;0:5 by minimizing 6
Y X1 X2 0:50:51UX3 0:50:51U0:51U
where U Unif0; 1, X1N 0; 2 ; X2 and X3 unif0; 1, they are mutually independent. Try two dierent sample sizes n200; 400
The optimization can be implemented through QuasiNewtonis methods or Gra dient descending algorithm. Also repeating drawing data from same DGP as well as your estimation 200 times and report the mean and standard deviation of your estimates
b Chernozhukov and Hong 2003, Journal of Econometrics The typical quantile regression could be directly obtained through minimizing 5. One standard procedure is to use linear programming with innerpoint iteration. While an alternative method that deals with 5 is to simulate from its quasiposterior function using MCMC. DeOne the posterior density function of
Xn0! Lnbjdataexp YiXib
i1
6

and
pbjdataR XPn !
b expPni1YiXi0b bexp i1Yi Xi0bdb
n0bexp YiXib
i1
whereb is prior distribution of Zb which is assumed to be unif10; 10 and
p bjdata db
calculatethrough MCMC sampling from pbjdata b1;:::;bM and report b average bc; :::; bM ; c is some positive number, e.g., c1000; M20000 after some burnin process mc. Please also plot your sampling path b1; :::; bMHints: random walk proposal Using N ; 2 as proposal density, 2 is the tuning parameter that could be adjusted during the sampling procedure. How are the results if repeating MCMC 100 times with independent sampling from DGP in a?
c Optional Koenker 2005 Quantile Regression, Econometric Society Mono graph Series Estimate according to 4 using Linear programming with inte rior point algorithm Mehrotrais predictorcorrector method 1992 and com pare your results with ab. Hints: A good reference for the computation aspect of quantile is http:www.econ.uiuc.edurogerresearchrqrq.html
7

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 R algorithm html scala graph Takehome Final Project Due day: Jan 8, 2020
30 $