Assignment 1 Submission Aaryaman Aggarwal, 230020 August 28, 2025 Question 1 a) A descriptive summary of the mean, median, standard deviation, maximum, and minimum are as follows: Variable Metrics Mean Median Standard Deviation Maximum Minimum IgG 5.29 5.00 2.28 Age 2.77 2.58 1.66 14.40 0.90 6.00 0.50 The histogram is as follows: Figure 1: Histogram of IgG(Left) and Age(Right) The IgG histogram appears to be left skewed, whereas the histogram for age doesn’t appear 1 to be skewed. This should imply that Mean < Median for IgG but from the values we can see that isn’t the case as few high values of IgG push the mean to be higher. The histogram for age seems to be uniformly distributed and there appears to be no skewness. b) The M odel 1: y i = β1 + β2 x + u i (1) The following are the estimates for the model using Ordinary Least Squares which was given as follows: Coefficients β1 (Intercept) β2 Estimates 3.3640 0.6951 Standard Errors 0.2214 0.068469 t-statistic 15.194 10.152 R2 = 0.258 From the coefficient estimates we can see that age has a positive effect of IgG, implying that as age increases, the IgG value(g/L) also increases. The low value of R2 however indicates that the model doesn’t fit very well and explains a very little amount of the variability of IgG. c) The M odel 2: yi = β1 + β2 x + β3 x2 + εi (2) The following are the estimates of the model using Ordinary Least Squares: Coefficients β1 (Intercept) β2 β3 Estimates 3.0839 0.9674 -0.0454 Standard Errors 0.3833 0.3118 0.05077 t-statistic 8.0458 3.1029 -0.8954 R2 = 0.26 In the fit for Model 2 as well, we can see it is evident that there is a positive correlation between age and IgG but the coefficient for age2 is negative with a very low t-statistic. Additionally, the R2 is only slightly greater than Model 1 and explains around the same amount of variability as model 1. d) In this it is said we can assume that ε ∼ N (0, 1) =⇒ yi − (β1 + β2 xi + β3 x2i ) ∼ N (0, 1) (3) From this assumption we can write the conditional distribution of yi |xi as: yi |xi ∼ N (β1 + β2 xi + β3 x2i , 1) Therefore the PDF of yi can be written as: 2 (4) f (yi |xi , β) = √12π exp( −(yi −(β1 +β2 xi +β3 x2i )) ) 2 Therefore the log likelihood is: ln L(β) = n X ln f (yi |xi , β) (5) i=1 ln L(β) = n X 1 (yi − β1 − β2 xi − β3 x2i )2 [− ln(2π) − ] 2 2 i=1 n n 1 X (yi − β1 − β2 xi − β3 x2i )2 ln L(β) = − ln(2π) − ] 2 2 i=1 2 (6) (7) The model estimates using the Maximum Likelihood Method (Using Newton Rhapson) is as follows: Maximum Likelihood Estimates Coefficients β1 (Intercept) β2 β3 Estimates 3.0839 0.9674 -0.0454 Standard Errors 0.3833 0.3118 0.05077 3 t-statistic 8.0458 3.1029 -0.8954 Question 2 a) For the response variable q85 coded as yi Variable yi = 1 (Yes, legal) yi = 0 (No, illegal) Frequency Count 659 581 Percentages 53.1452% 46.8548% b) For the variable ’age’ coded as x2 and ’hh1’ (Number of members in the household) as x3 . Variable x2 (Age) x3 (hh1) Mean 50.5008 2.7194 Std. Deviation 17.7579% 1.4403% c) For the variable ’past use’ encoded as x4 which is 1 if ’Yes’ or else ’0’ if ’No’ Variable x4 = 1 (Yes) x4 = 0 (No) Frequency Count 587 653 Percentages 47.3387% 52.6613% d) For the variable ’sex’ as x5 = 1 if Male and x5 = 0 if female. Also for the variable ’Parent’ as x6 = 1 if ’Yes’ or x6 = 0 if ’No’ Variable x5 = 1 (Male) x5 = 0 (Female) x6 = 1 (Yes for parents) x6 = 0 (No for parents) Count 603 637 358 882 Percentage 48.6290% 51.3710% 28.8710% 71.1290 % e) For the variable ’Marital Status’ Category 1(’Single’) = ’x7 = 1 if x ∈’Never Been Married’ Category 2(’Post Married’) = ’x8 = 1 if x ∈ ’Divorced’, ’Separated’, ’Widowed’ Category 3(’Couple’) = ’Base Category = if ∈’Married’, ’Living with a partner’ Variable x7 = 1 (Single) x7 = 0 (Not Single) x8 = 1 (Post Married) x8 = 0 (Not Post Married) Couple Category Count 235 1005 285 955 720 Percentage 18.9516% 81.0484% 22.9839% 77.0161 % 58.0645 f) For the variable ’Income’. The categories are as follows 1. ’Poor’ = People ∈ Less than 10000, 10 to under 20000, 20 to under 30000, 30 to under 40000, 40 to under 50000. Encoded as x9 = 1 if individual ∈ ’Poor’ and x9 = 0 otherwise. 4 2. ’Middle’ = People ∈ 50 to under 75000, 75 to under 100000. Encoded as x10 = 1 if individual ∈ ’Poor’ and x10 = 0 otherwise. 3. ’Rich’ = People ∈ 100 to under 150000, 150000 or more.This is considered as the Base Category and not be included in the regression Variable x9 = 1 (Poor) x9 = 0 (Not Poor) x10 = 1 (Middle) x10 = 0 (Not Middle) Rich Category Count 519 721 366 874 232 Percentage 41.8548% 58.1452% 29.5161% 70.4839 % 18.7097% g) For the variable ’educ’. The categories are as follows: 1. ’HSandBelow’ = People ∈ Less than HS, HS Incomplete, HS. Encoded as x11 = 1 if individual ∈ ’HSandBelow’ and x11 = 0 otherwise. 2. ’lessThanBachelors’ = People ∈ Some College, Associate Degree. Encoded as x12 = 1 if individual ∈ ’lessThenaBachelors’ and x12 = 0 otherwise. 3. ’BachelorsandAbove’ = People ∈ Bachelors, Postgraduate Degree, Some Postgraduate. This is considered as the Base Category and not included in the regression. Variable x11 = 1 (HSandBelow) x11 = 0 (Not HSandBelow) x12 = 1 (lessThanBachelors) x12 = 0 (not lessThanBachelors) BachelorsandAbove Category Count 414 826 381 Percentage 33.3871% 66.6129% 30.7258% 859 69.2742 % 445 35.8871% h) For the variable ’race’. The categories are as follows: 1. ’white’ = Encoded as x13 = 1 if individual ∈ ’white’ and x13 = 0 otherwise. 2. ’black’ = Encoded as x14 = 1 if individual ∈ ’black’ and x14 = 0 otherwise. 3. ’allOther’ = Considered as Base Category which will not be included in the regression. Variable x13 = 1 (White) x13 = 0 (Not White) x14 = 1 (Black) x14 = 0 (not Black) allOthers Category Count 954 286 146 1094 140 i) For the variable ’party’. The categories are as follows: 5 Percentage 76.9355% 23.0645% 11.7742% 88.2258% 11.2903% 1. ’democrat’ = Encoded as x15 = 1 if individual ∈ ’Democrat’ and x15 = 0 otherwise. 2. ’republican’ = Encoded as x16 = 1 if individual ∈ ’Republican’ and x16 = 0 otherwise. 3. ’independentOthers’ = Base Category which consists of individuals who affiliate with all other parties excluding Democratic and Republican. This will not be included in the regression. Variable x15 = 1 (Democrat) x15 = 0 (Not Democrat) x16 = 1 (Republican) x16 = 0 (not Republican) independentOthers Category Count 422 818 357 883 461 6 Percentage 34.0323% 65.9677% 28.7903% 71.2097% 37.1774% Question 3 a) To derive the probability of yi = 1 and yi = 0 using a binary probit model we can use an underlying ’Latent Variable’ zi such that: ( 0 if zi ≤ 0 f (x) = (8) 1 if zi > 0 Where zi is defined as: zi = x′i β + εi (9) β and xi are vectors kx1 and by the definition of the binary probit model: εi ∼ N (0, 1) (10) Pr(y = 1) = Pr(zi > 0) (11) We can derive it as follows: Pr(zi > 0) = Pr(x′i β + εi > 0) Pr(ε > −x′i β) = Pr(ε < x′i β) (12) (13) =⇒ P r(ε < x′i β) = Φ(x′i β) (14) =⇒ Pr(yi = 1) = Φ(x′i β) (15) We can do this because of Equation (10). (Φ(x) is the CDF of the Standard Normal Distribution). Similarily, we can derive the same for Pr(y = 0) Pr(y = 0) = Pr(zi < 0) (16) Pr(zi < 0) = Pr(x′i β + εi < 0) (17) −x′i β) Φ(−x′i β) (18) =⇒ P r(ε < −x′i β) = 1 − Φ(x′i β) (19) =⇒ Pr(yi = 0) = 1 − Φ(x′i β) (20) =⇒ P r(ε < = Due to the symmetry of the Normal Distribution The likelihood function can be constructed as: n Y f (yi |xi , β) (21) [f (yi = 1|xi , β)]yi [f (yi = 0|xi , β)]1−yi (22) L(β) = i=1 L(β) = n Y i=1 L(β) = n Y [ Φ(x′i β) ]yi [ 1 − Φ(xi β)]1−yi i=1 7 (23) b) The following table is of the coefficient estimates: Variable Coefficients Intercept β1 Age β2 hh1 β3 Past Use β4 Sex β5 Parents β6 Single β7 Post Married β8 Poor β9 Middle β10 HSandBelow β11 lessThanBachelors β12 White β13 Black β14 Democrat β15 Republican β16 Binary Probit Model Estimates Standard Errors 0.4496 0.2598 -0.0084 0.0029 -0.0552 0.0332 0.8035 0.07837 0.1771 0.0786 0.0526 0.1051 0.1242 0.1199 0.05555 0.1049 -0.2148 0.0961 -0.1711 0.1008 -0.1915 0.0949 0.0798 0.0973 -0.0346 0.1252 -0.3382 0.1598 0.2324 0.0939 -0.4638 0.0950 t-statistic 1.7302 -2.8755 -1.6625 10.2531 2.2527 0.5007 1.0363 0.5294 -2.2341 -1.6983 -2.0179 0.8205 -0.2761 -2.1159 2.4738 -4.8786 c) The covariate effect on Pr(yi = 1|x) if age is increased by 5 years is calculated as: Covariate EffectAge = Pr(yi = 1|xi,−2 , xi,2 = xi,2 + 5, β) − Pr(yi = 1|xi , β) (24) All values of xi are kept constant apart from x2 which is the age variable. For each individual, the value of age is increased by 5, while everything else is kept constant. The reported value of the covariate effect of increasing age by 5 years is. Covariate EffectAge = −0.0144 (25) This is the mean of the covariate effect over all of datapoints of x. d) The covariate effect of parents on Pr(yi = 1|β, xi ) Covariate EffectParents = Pr(yi = 1|β, xi,−6 , xi,6 = 1) − Pr(yi = 1|β, xi,−6 , xi,6 = 0) (26) All of xi is kept constant apart from xi,6 which is fixed as xi,6 = 1 in the first term and xi,6 = 0 for the second term. The reported value of the covariate effect of being a Parent is: Covariate EffectParents = 0.0179 (27) This is the mean of all the covariate effects of the individual being a parent or not in the dataset. 8 Question 4 a) The probability Pr(yi = 1) and Pr(yi = 0) can be derived in a similar manner (i.e using a latent variable zi ) ( 0 if zi ≤ 0 f (x) = (28) 1 if zi > 0 Where zi is defined as: zi = x′i β + εi (29) β and xi are vectors of dimension kx1 and by the definition of the binary logit model: εi ∼ Logistic(0, 1) (30) This is where the logit model differs from the probit model, as we can see in Equations (28) and (10). The errors in the logit model follow a standard normal distribution. For a random variable X, if X ∼ Logisitic(0,1) then: E(X) = 0 π2 3 The probability density function for the standard logistic distribution is: V ar(X) = f (x) = e−x [1 + e−x ]2 (31) (32) (33) The cummulative density function for the standard logisitc distribution is donated as: Pr(X < α) = Λ(α) (34) It is evident that due to the symmetricity of the logistic distribution, the following will hold true: Λ(α) = 1 − Λ(−α) (35) As we can observe, since the variance of the Standard Logistic Distribution is greater than that of the Standard Normal Distribution we can infer that the logistic distribution has comparatively fatter tails. Using these properties of ε and Logistic distribution, we can derive the probability Pr(yi = 1) as follows: Pr(y = 1) = Pr(zi > 0) (36) Pr(zi > 0) = Pr(x′i β + εi > 0) (37) Pr(ε > −x′i β) = Pr(ε < x′i β) (38) =⇒ Pr(ε < x′i β) = Λ(x′i β) (39) Pr(yi = 1) = Λ(x′i β) (40) 9 Similarily, we can also derive the probability for Pr(yi = 0) as: Pr(y = 0) = Pr(zi < 0) (41) Pr(zi < 0) = Pr(x′i β + εi < 0) (42) =⇒ Pr(ε < −x′i β) = Λ(−x′i β) (43) =⇒ Pr(ε < −x′i β) = 1 − Λ(x′i β) (44) Pr(yi = 0) = 1 − Λ(x′i β) (45) Using these values of Pr(yi = 1) and Pr(yi = 0) we can construct the likelihood function: n Y f (yi |xi , β) (46) [f (yi = 1|xi , β)]yi [f (yi = 0|xi , β)]1−yi (47) L(β) = i=1 L(β) = n Y i=1 L(β) = n Y [Λ(x′i β) ]yi [1 − Λ(xi β)]1−yi (48) i=1 b) The following are the estimates, standard error and t-values of the coefficients using a binary logit model. Variable Intercept Age hh1 Past Use Sex Parents Single Post Married Poor Middle HSandBelow lessThanBachelors White Black Democrat Republican Coefficients β1 β2 β3 β4 β5 β6 β7 β8 β9 β10 β11 β12 β13 β14 β15 β16 Binary Logit Model Estimates 0.838 -0.015 -0.096 1.308 0.267 0.074 0.183 0.08 -0.364 -0.291 -0.327 0.119 -0.052 -0.523 0.36 -0.776 Standard Errors 0.43 0.005 0.055 0.13 0.13 0.173 0.198 0.174 0.16 0.167 0.158 0.161 0.206 0.264 0.155 0.158 t-statistic 1.948 -2.999 -1.737 10.052 2.058 0.426 0.921 0.46 -2.28 -1.743 -2.074 0.738 -0.25 -1.978 2.316 -4.905 c) To calculate the covariate effect of increasing age by 5 years on Pr(yi = 1|β) Covariate EffectAge = Pr(yi = 1|β, xi,−2 , xi,2 = xi,2 + 5) − Pr(yi = 1|β, xi ) 10 (49) All values of xi are kept constant apart from x2 which is the age variable. For each individual, the value of age is increased by 5, while everything else is kept constant. The reported value of the covariate effect of increasing age by 5 years is. Covariate EffectAge = −0.0151 (50) This is the mean of the covariate effect over all of datapoints of x. d) To calculate the covariate effect of being a parent Covariate EffectP arent = Pr(yi = 1|β, xi,−6 , xi,6 = 1) − Pr(yi = 1|β, xi,−6 , xi,6 = 0) (51) While keeping all other values of xi the same, and fixing the ”Parents” variable. The value of the covariate effect is: Covariate Effectparents = 0.0152 (52) This is the mean of the covariate effect of all the datapoints. e) Yes there is a difference in the Covariate effect calculated in the probit and logit model. This is due to the difference in their variances. π2 V arlogit = 3 (53) V arprobit = 1 (54) Due to this difference in variance, the estimates can be compared as: βlogit ≈ 1.81βprobit (55) So hence, the values of the covariate effects may be slightly different, as the β-estimates for the logit model are greater. Even due to the different values, the meaning of the values can still be interpreted as the same. For example, from both models we can conclude that if age increases, the probability of the individual supporting the legalization of marijuana decreases. 11 Question 5 a) The ordinary probit model generalizes the binary model as yi can have more than 2 outcomes which have some ordinal significance, i.e they can be ranked. For this model, we also use the latent variable zi . zi = x′i β + εi (56) β and xi are vectors kx1 and by the definition of the ordinal probit model: εi ∼ N (0, 1) (57) γj−1 < zi ≤ γj =⇒ yi = j (58) j = Categories into which we have to classify the datapoint to (59) j = 1, 2 . . . J (60) γj = Threshold values for category j (61) And we use it in the following manner: Where Therefore, we can derive Pr(yi = j) as follows: =⇒ =⇒ Pr(yi = j) = Pr(zi ≤ γj , γj−1 < zi ) (62) =⇒ Pr(yi = j) = Pr(zi ≤ γj ) − Pr(zi ≤ γj−1 ) (63) Pr(yi = j) = Pr(x′i β + εi ≤ γj ) − Pr(x′i β + εi ≤ γj−1 ) Pr(yi = j) = Pr(εi ≤ γj − x′i β) − Pr(εi ≤ γj−1 − x′i β) =⇒ Pr(yi = j) = Φ(γj − x′i β) − Φ(γj−1 − x′i β) (64) (65) (66) We can come to the above equation due to Equation(57) Now to construct the likelihood function, We define an indicator variable Zij , which equals 1 if yi = j and 0 otherwise. Then the likelihood function can be defined as follows : L(β) = N X m X Zij ln[ Φ(γj − x′i β) − Φ(γj−1 − x′i β)] (67) i=1 j=0 b) A descriptive summary of categorical variables with mean and standard deviation is as follows Variables educlevel motherWorked urban south educFather educMother famIncome female black age15 age16 age17 Mean 5.29 5.00 2.28 14.40 0.90 Standard Deviation 2.77 2.58 1.66 6.00 0.50 12 c) d) For a one-unit change in covariate xjk , the marginal effect on category j is given by : ∂P r(yi = j|xi ) = βk [ Φ(γj − x′i β) − Φ(γj−1 − x′i β)] ∂xik (68) Now for a finite change of ∆ xik we will modify the equation a little bit and say: ∆P r(yi = j) = ( Φ(γj − x′T i β) − Φ(γj−1 − x′T i β)) − [ Φ(γj − x′i β) − Φ(γj−1 − x′i β)] (69) where xT i = xi + ∆ xik eik and we average over i to obtain the ACE Following are the average changes in Pr(educLevel=j) across the sample, rounded to four decimals, and they sum to approximately zero as expected. Categories P r(educLevel=1) P r(educLevel=2) P r(educLevel=3) P r(educLevel=4) Reported ACE -0.0289 (decrease) +0.0153 (increase) +0.0031 (increase) +0.0105 (increase 13
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )