--- title: "HW11" author: "Your Name, Your Uniqname" date: "Due April 13, 2020 at 10pm" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) set.seed XXXXXXXXXX)...

1 answer below »
Hi, please complete all parts of Question 1 and Question 2 (Only parts B and C) in the following Data Science homework. I am attaching the necessary files-- both as an .rmd and an html so you can view however you want-- as well as the data. The output should be an rmd file!


--- title: "HW11" author: "Your Name, Your Uniqname" date: "Due April 13, 2020 at 10pm" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) set.seed(392030303) library(tidyverse) library(ggplot2) ``` ## Question 1 (6 pts) While we can motivate ordinary least squares (OLS) as finding the maximum likelihood estimates for $Y \sim N(\beta'x, \sigma^2)$, OLS has wider applicability and still nice properties. When we model $E(Y \mid x) = \beta'x$ and assume a constant variance, ordinary least squares OLS is the best linear unbiased estimator of the $\beta$ parameters (i.e., among all methods that are linear functions of $Y$ and would have unbiased estimates of the parameters, OLS has the smallest variance.) ### Part (a) (2 pt) Suppose we have the simple model $$E(Y \mid x) = \beta x$$ (i.e., there is no intercept term.) Prove that the OLS estimate of $\beta$ is given by: $$\hat \beta = \sum_{i = 1}^n w_i Y_i, \quad w_i = \frac{x_i}{\sum_{i=1}^n x_i^2}$$ and show that this is **unbiased for $\beta$**. Under the same model, show that estimator $$\tilde \beta = \sum_{i=1}^n w_i Y_i, \quad w_i = \frac{1}{n x_i}$$ is unbiased for $\beta$. ### Part (b) (2 pt) We can also consider **biased estimators** that have lower variance. One such estimator is called **ridge regression** and the estimator is given by $$\bar \beta = (X'X + \lambda I)^{-1} X'Y$$ where $\lambda$ is some positive value and $I$ is the identity matrix. Find the ridge regression estimator for the model of (a) and show that for any $\lambda > 0$, $\bar \beta$ and $\hat \beta$ will have **same sign** and $|\bar \beta| < |\hat="" \beta|$.="" (note:="" ridge="" regression="" is="" known="" as="" a="" **shrinkage="" estimator**="" in="" that="" in="" **shrinks="" the="" estimate="" of="" $\beta$="" towards="" zero**.="" this="" can="" be="" useful="" if="" one="" is="" considering="" a="" model="" with="" many="" $\beta$="" parameters="" for="" variables="" on="" roughly="" the="" same="" scale,="" but="" you="" only="" think="" a="" few="" of="" the="" variables="" influence="" the="" outcome.="" ridge="" regression,="" and="" other="" shrinkage="" estimators,="" will="" force="" small="" estimates="" even="" smaller,="" letting="" the="" important="" predictors="" shine="" through.)="" ###="" part="" c="" (2="" pt)="" estimate="" the="" bias="" and="" variance="" of="" the="" sampling="" distributions="" for="" $\hat="" \beta$,="" $\tilde="" \beta$,="" and="" $\bar="" \beta$="" when="" $\lambda="1$" and="" $\lambda="1000$" when="" -="" $\beta="2$" -="" $n="20$" -="" $x_i="" \sim="" 1="" +="" exp(1/10)$="" -="" $y_i="" \mid="" x_i="" \sim="" u(\beta="" x="" -="" 50,="" \beta="" x="" +="" 50)$="" use="" 10,000="" monte="" carlo="" samples.="" ##="" question="" 2="" (4="" points)="" ###="" part="" (a)="" (1="" point)="" read="" sections="" 1="" to="" 3.1,="" and="" 4="" to="" 4.1="" of="" "environmental="" kuznets="" curve="" hypothesis:="" a="" survey"="" (of="" course,="" you="" may="" read="" more,="" but="" these="" sections="" contain="" the="" most="" releveant="" information="" for="" this="" week's="" homework).="" briefly="" summarize="" the="" idea="" of="" the="" **environmental="" kuznets="" curve**="" (ekc).="" specifically,="" what="" kind="" of="" relationship="" does="" it="" posit="" between="" economic="" development="" (say="" gdp="" per="" capita)="" and="" environmental="" impact="" (for="" example="" co$_2$="" per="" capita="" emission)?="" ###="" part="" (b)="" (1="" points)="" load="" the="" data="" in="" the="" supplied="" csv="" file,="" `world_bank_data.csv`.="" these="" represent="" three="" different="" variables="" measured="" on="" countries="" and="" other="" entities="" in="" 2014.="" right="" now,="" the="" data="" are="" stacked="" such="" that="" for="" each="" county="" (or="" aggregation="" of="" countries)-year-variable="" entry="" there="" is="" one="" row.="" we="" would="" prefer="" to="" have="" the="" data="" in="" table="" such="" that="" each="" row="" is="" one="" country,="" and="" the="" four="" variables="" are="" represented="" by="" one="" column="" each.="" your="" task="" is="" to="" turn="" the="" stacked="" data="" into="" a="" more="" convenient="" format.="" to="" verify="" your="" results,="" include="" the="" output="" of="" the="" `summary()`="" function="" applied="" to="" the="" final="" `data.frame`.="" here="" is="" a="" little="" code="" to="" get="" you="" started:="" ```{r}="" world_bank_stacked=""><- read.csv("world_bank_data.csv", na.strings = "..") ## they use .. for missing values ``` the `pivot_wider` function will be helpful [documentation](https://tidyr.tidyverse.org/). after unstacking the data, create columns for gdp per capita and co2 emissions per captita. ### part (c) (2 points) section 4.1 of the ekc paper includes a specification for a model that relates country income to co2 per capita. for our purpses, we will fix a single observation per country ($t = 1$ for all observations) and not include any other predictors (labeled $z$ in the model). fit an ols model using the specification given in equation (1) one on page 440. using the `summary` function, interpret the hypothesis tests for each parameter. interpret your results using the listing of possible outcomes given on pages 440 and 441. do you think there is evidence to support the ekc theory? can we rule out the ekc theory? series.name,country.name,value gdp (current us$),afghanistan,20484885119.7348 gdp (current us$),albania,13228247844.1247 gdp (current us$),algeria,213810022462.428 gdp (current us$),american samoa,643000000 gdp (current us$),andorra,3350736367.25488 gdp (current us$),angola,145712200312.505 gdp (current us$),antigua and barbuda,1275576784.44444 gdp (current us$),argentina,526319673731.638 gdp (current us$),armenia,11609512939.7543 gdp (current us$),aruba,2649720670.39106 gdp (current us$),australia,1464955475993.76 gdp (current us$),austria,441885415805.825 gdp (current us$),azerbaijan,75244294275.1498 gdp (current us$),"bahamas, the",10957300000 gdp (current us$),bahrain,33387712765.9575 gdp (current us$),bangladesh,172885454931.453 gdp (current us$),barbados,4608350000 gdp (current us$),belarus,78813839984.3506 gdp (current us$),belgium,530770977633.615 gdp (current us$),belize,1692955750 gdp (current us$),benin,9707432015.61441 gdp (current us$),bermuda,"na" gdp (current us$),bhutan,1958819095.68324 gdp (current us$),bolivia,32996187988.4226 gdp (current us$),bosnia and herzegovina,18558343508.3435 gdp (current us$),botswana,16250750259.0212 gdp (current us$),brazil,2455993625159.37 gdp (current us$),british virgin islands,"na" gdp (current us$),brunei darussalam,17098342541.4365 gdp (current us$),bulgaria,56814543481.2102 gdp (current us$),burkina faso,12377391462.6377 gdp (current us$),burundi,2705783272.07443 gdp (current us$),cabo verde,1859898513.26858 gdp (current us$),cambodia,16702610842.4025 gdp (current us$),cameroon,34942948737.3967 gdp (current us$),canada,1799268695861.8 gdp (current us$),cayman islands,"na" gdp (current us$),central african republic,1702899386.14322 gdp (current us$),chad,13922223233.5184 gdp (current us$),channel islands,"na" gdp (current us$),chile,260584090570.988 gdp (current us$),china,10482372109961.9 gdp (current us$),colombia,381112119657.445 gdp (current us$),comoros,1148058015.47633 gdp (current us$),"congo, dem. rep.",35909040265.9328 gdp (current us$),"congo, rep.",14177437982.2619 gdp (current us$),costa rica,50577769837.691 gdp (current us$),cote d'ivoire,35343298113.5131 gdp (current us$),croatia,57671307486.8132 gdp (current us$),cuba,80656000000 gdp (current us$),curacao,"na" gdp (current us$),cyprus,23364707443.2798 gdp (current us$),czech republic,207818330723.835 gdp (current us$),denmark,352993633221.281 gdp (current us$),djibouti,1455035088.74594 gdp (current us$),dominica,523540777.777778 gdp (current us$),dominican republic,66065015410.0468 gdp (current us$),ecuador,101726331000 gdp (current us$),"egypt, arab rep.",305529656458.438 gdp (current us$),el salvador,22585841200 gdp (current us$),equatorial guinea,21736500712.9638 gdp (current us$),eritrea,"na" gdp (current us$),estonia,26224622450.8302 gdp (current us$),eswatini,4377293816.28535 gdp (current us$),ethiopia,55612228233.5179 gdp (current us$),faroe islands,2810547884.18708 gdp (current us$),fiji,4483416339.93854 gdp (current us$),finland,272609288689.575 gdp (current us$),france,2852165760630.27 gdp (current us$),french polynesia,"na" gdp (current us$),gabon,18179752009.7489 gdp (current us$),"gambia, the",1259063629.83287 gdp (current us$),georgia,16509305828.9648 gdp (current us$),germany,3890606893346.69 gdp (current us$),ghana,53601126663.9079 gdp (current us$),gibraltar,"na" gdp (current us$),greece,237029579260.722 gdp (current us$),greenland,2837737193.76392 gdp (current us$),grenada,911497407.407407 gdp (current us$),guam,5538000000 gdp (current us$),guatemala,58722323918.1604 gdp (current us$),guinea,8778473640.90839 gdp (current us$),guinea-bissau,1053512334.17271 gdp (current us$),guyana,3077643261.39312 gdp (current us$),haiti,8776350789.5993 gdp (current us$),honduras,19756494434.7031 gdp (current us$),"hong kong sar, china",291459356985.337 gdp (current us$),hungary,140118140454.711 gdp (current us$),iceland,17304033020.5364 gdp (current us$),india,2039127446298.55 gdp (current us$),indonesia,890814755233.225 gdp (current us$),"iran, islamic rep.",434474616831.914 gdp (current us$),iraq,234648370497.427 gdp (current us$),ireland,258099014042.117 gdp (current us$),isle of man,7428280401.5139 gdp (current us$),israel,308416982140.362 gdp (current us$),italy,2151732868243.21 gdp (current us$),jamaica,13852192273.1357 gdp (current us$),japan,4850413536037.84 gdp (current us$),jordan,35826925774.6479 gdp (current us$),kazakhstan,221415572819.5 gdp (current us$),kenya,61448041564.0191 gdp (current us$),kiribati,179703443.302686 gdp (current us$),"korea, dem. people’s rep.","na" gdp (current us$),"korea, rep.",1411333926201.24 gdp (current us$),kosovo,7386891336.07536 gdp (current us$),kuwait,162631412508.784 gdp (current us$),kyrgyz republic,7468096566.71158 gdp (current us$),lao pdr,13268458231.9284 gdp (current us$),latvia,31335013751.5424 gdp (current us$),lebanon,48524603055.257 gdp (current us$),lesotho,2614566294.19462 gdp (current us$),liberia,3144000000 gdp (current us$),libya,41142722414.3351 gdp (current us$),liechtenstein,6657170923.37918 gdp (current us$),lithuania,48516371720.8346 gdp (current us$),luxembourg,66327344188.889 gdp (current us$),"macao sar, china",55347998647.8196 gdp (current us$),madagascar,10673516672.6664 gdp (current us$),malawi,6047813437.31804 gdp (current us$),malaysia,338061963396.376 gdp (current us$),maldives,3697351596.83753 gdp (current us$),mali,14345828992.0411 gdp (current us$),malta,11216758081.9535 gdp (current us$),marshall islands,183121300 gdp (current us$),mauritania,5391475277.24326 gdp (current us$),mauritius,12803445933.5894 gdp (current us$),mexico,1314563967425.24 gdp (current us$),"micronesia, fed. sts.",317999400 gdp (current us$),moldova,7983241044.20189 gdp (current us$),monaco,7060236168.2367 gdp (current us$),mongolia,12226514722.0861 gdp (current us$),montenegro,4587926230.59573 gdp (current us$),morocco,110081248587.369 gdp (current us$),mozambique,16961117243.491 gdp (current us$),myanmar,65446199787.8425 gdp (current us$),namibia,12786078008.2376 gdp (current us$),nauru,117020381.931693 gdp (current us$),nepal,20002968837.9471 gdp (current us$),netherlands,879635084124.987 gdp (current us$),new caledonia,"na" gdp (current us$),new zealand,200955119873.905 gdp (current us$),nicaragua,11880438824.4494 gdp (current us$),niger,8229731383.7693 gdp (current us$),nigeria,568498937615.594 gdp (current us$),north macedonia,11362272837.8818 gdp (current us$),northern mariana islands,845000000 gdp (current us$),norway,499338534779.159 gdp (current us$),oman,81076723016.9051 gdp (current us$),pakistan,244360888750.807 gdp (current us$),palau,245675100 gdp (current us$),panama,49921464365.3204 gdp (current us$),papua new guinea,23060047127.6509 gdp (current us$),paraguay,40276532540.8812 gdp (current us$),peru,201080662205.002 gdp (current us$),philippines,284584522898.872 gdp (current us$),poland,545285410921.999 gdp (current us$),portugal,229629822121.601 gdp (current us$),puerto rico,102445800000 gdp (current us$),qatar,206224725274.725 gdp (current us$),romania,199626806401.529 gdp (current us$),russian federation,2063662665172.51 gdp (current us$),rwanda,8016591927.65923 gdp (current us$),samoa,805162571.787264 gdp (current us$),san marino,1788510017.24824 gdp (current us$),sao tome and principe,348941715.374951 gdp (current us$),saudi arabia,756350347333.334 gdp (current us$),senegal,19770919167.0965 gdp (current us$),serbia,44210806365.6817 gdp (current us$),seychelles,1343010475.37046 gdp (current us$),sierra leone,5015157815.73406 gdp (current us$),singapore,311539499644.858 gdp (current us$),sint maarten (dutch part),"na" gdp (current us$),slovak republic,100948236941.182 gdp (current us$),slovenia,49904928335.3069 gdp (current us$),solomon islands,1172268300.95047 gdp (current us$),somalia,6562001351.4788 gdp (current us$),south africa,350636208163.772 gdp (current us$),south sudan,15099661016.9492 gdp (current us$),spain,1376910811040.88 gdp (current us$),sri lanka,79356449840.8881 gdp (current us$),st. kitts and nevis,916857359.52963 gdp (current us$),st. lucia,1516576962.96296 gdp (current us$) read.csv("world_bank_data.csv",="" na.strings=".." )="" ##="" they="" use="" ..="" for="" missing="" values="" ```="" the="" `pivot_wider`="" function="" will="" be="" helpful="" [documentation](https://tidyr.tidyverse.org/).="" after="" unstacking="" the="" data,="" create="" columns="" for="" gdp="" per="" capita="" and="" co2="" emissions="" per="" captita.="" ###="" part="" (c)="" (2="" points)="" section="" 4.1="" of="" the="" ekc="" paper="" includes="" a="" specification="" for="" a="" model="" that="" relates="" country="" income="" to="" co2="" per="" capita.="" for="" our="" purpses,="" we="" will="" fix="" a="" single="" observation="" per="" country="" ($t="1$" for="" all="" observations)="" and="" not="" include="" any="" other="" predictors="" (labeled="" $z$="" in="" the="" model).="" fit="" an="" ols="" model="" using="" the="" specification="" given="" in="" equation="" (1)="" one="" on="" page="" 440.="" using="" the="" `summary`="" function,="" interpret="" the="" hypothesis="" tests="" for="" each="" parameter.="" interpret="" your="" results="" using="" the="" listing="" of="" possible="" outcomes="" given="" on="" pages="" 440="" and="" 441.="" do="" you="" think="" there="" is="" evidence="" to="" support="" the="" ekc="" theory?="" can="" we="" rule="" out="" the="" ekc="" theory?="" series.name,country.name,value="" gdp="" (current="" us$),afghanistan,20484885119.7348="" gdp="" (current="" us$),albania,13228247844.1247="" gdp="" (current="" us$),algeria,213810022462.428="" gdp="" (current="" us$),american="" samoa,643000000="" gdp="" (current="" us$),andorra,3350736367.25488="" gdp="" (current="" us$),angola,145712200312.505="" gdp="" (current="" us$),antigua="" and="" barbuda,1275576784.44444="" gdp="" (current="" us$),argentina,526319673731.638="" gdp="" (current="" us$),armenia,11609512939.7543="" gdp="" (current="" us$),aruba,2649720670.39106="" gdp="" (current="" us$),australia,1464955475993.76="" gdp="" (current="" us$),austria,441885415805.825="" gdp="" (current="" us$),azerbaijan,75244294275.1498="" gdp="" (current="" us$),"bahamas,="" the",10957300000="" gdp="" (current="" us$),bahrain,33387712765.9575="" gdp="" (current="" us$),bangladesh,172885454931.453="" gdp="" (current="" us$),barbados,4608350000="" gdp="" (current="" us$),belarus,78813839984.3506="" gdp="" (current="" us$),belgium,530770977633.615="" gdp="" (current="" us$),belize,1692955750="" gdp="" (current="" us$),benin,9707432015.61441="" gdp="" (current="" us$),bermuda,"na"="" gdp="" (current="" us$),bhutan,1958819095.68324="" gdp="" (current="" us$),bolivia,32996187988.4226="" gdp="" (current="" us$),bosnia="" and="" herzegovina,18558343508.3435="" gdp="" (current="" us$),botswana,16250750259.0212="" gdp="" (current="" us$),brazil,2455993625159.37="" gdp="" (current="" us$),british="" virgin="" islands,"na"="" gdp="" (current="" us$),brunei="" darussalam,17098342541.4365="" gdp="" (current="" us$),bulgaria,56814543481.2102="" gdp="" (current="" us$),burkina="" faso,12377391462.6377="" gdp="" (current="" us$),burundi,2705783272.07443="" gdp="" (current="" us$),cabo="" verde,1859898513.26858="" gdp="" (current="" us$),cambodia,16702610842.4025="" gdp="" (current="" us$),cameroon,34942948737.3967="" gdp="" (current="" us$),canada,1799268695861.8="" gdp="" (current="" us$),cayman="" islands,"na"="" gdp="" (current="" us$),central="" african="" republic,1702899386.14322="" gdp="" (current="" us$),chad,13922223233.5184="" gdp="" (current="" us$),channel="" islands,"na"="" gdp="" (current="" us$),chile,260584090570.988="" gdp="" (current="" us$),china,10482372109961.9="" gdp="" (current="" us$),colombia,381112119657.445="" gdp="" (current="" us$),comoros,1148058015.47633="" gdp="" (current="" us$),"congo,="" dem.="" rep.",35909040265.9328="" gdp="" (current="" us$),"congo,="" rep.",14177437982.2619="" gdp="" (current="" us$),costa="" rica,50577769837.691="" gdp="" (current="" us$),cote="" d'ivoire,35343298113.5131="" gdp="" (current="" us$),croatia,57671307486.8132="" gdp="" (current="" us$),cuba,80656000000="" gdp="" (current="" us$),curacao,"na"="" gdp="" (current="" us$),cyprus,23364707443.2798="" gdp="" (current="" us$),czech="" republic,207818330723.835="" gdp="" (current="" us$),denmark,352993633221.281="" gdp="" (current="" us$),djibouti,1455035088.74594="" gdp="" (current="" us$),dominica,523540777.777778="" gdp="" (current="" us$),dominican="" republic,66065015410.0468="" gdp="" (current="" us$),ecuador,101726331000="" gdp="" (current="" us$),"egypt,="" arab="" rep.",305529656458.438="" gdp="" (current="" us$),el="" salvador,22585841200="" gdp="" (current="" us$),equatorial="" guinea,21736500712.9638="" gdp="" (current="" us$),eritrea,"na"="" gdp="" (current="" us$),estonia,26224622450.8302="" gdp="" (current="" us$),eswatini,4377293816.28535="" gdp="" (current="" us$),ethiopia,55612228233.5179="" gdp="" (current="" us$),faroe="" islands,2810547884.18708="" gdp="" (current="" us$),fiji,4483416339.93854="" gdp="" (current="" us$),finland,272609288689.575="" gdp="" (current="" us$),france,2852165760630.27="" gdp="" (current="" us$),french="" polynesia,"na"="" gdp="" (current="" us$),gabon,18179752009.7489="" gdp="" (current="" us$),"gambia,="" the",1259063629.83287="" gdp="" (current="" us$),georgia,16509305828.9648="" gdp="" (current="" us$),germany,3890606893346.69="" gdp="" (current="" us$),ghana,53601126663.9079="" gdp="" (current="" us$),gibraltar,"na"="" gdp="" (current="" us$),greece,237029579260.722="" gdp="" (current="" us$),greenland,2837737193.76392="" gdp="" (current="" us$),grenada,911497407.407407="" gdp="" (current="" us$),guam,5538000000="" gdp="" (current="" us$),guatemala,58722323918.1604="" gdp="" (current="" us$),guinea,8778473640.90839="" gdp="" (current="" us$),guinea-bissau,1053512334.17271="" gdp="" (current="" us$),guyana,3077643261.39312="" gdp="" (current="" us$),haiti,8776350789.5993="" gdp="" (current="" us$),honduras,19756494434.7031="" gdp="" (current="" us$),"hong="" kong="" sar,="" china",291459356985.337="" gdp="" (current="" us$),hungary,140118140454.711="" gdp="" (current="" us$),iceland,17304033020.5364="" gdp="" (current="" us$),india,2039127446298.55="" gdp="" (current="" us$),indonesia,890814755233.225="" gdp="" (current="" us$),"iran,="" islamic="" rep.",434474616831.914="" gdp="" (current="" us$),iraq,234648370497.427="" gdp="" (current="" us$),ireland,258099014042.117="" gdp="" (current="" us$),isle="" of="" man,7428280401.5139="" gdp="" (current="" us$),israel,308416982140.362="" gdp="" (current="" us$),italy,2151732868243.21="" gdp="" (current="" us$),jamaica,13852192273.1357="" gdp="" (current="" us$),japan,4850413536037.84="" gdp="" (current="" us$),jordan,35826925774.6479="" gdp="" (current="" us$),kazakhstan,221415572819.5="" gdp="" (current="" us$),kenya,61448041564.0191="" gdp="" (current="" us$),kiribati,179703443.302686="" gdp="" (current="" us$),"korea,="" dem.="" people’s="" rep.","na"="" gdp="" (current="" us$),"korea,="" rep.",1411333926201.24="" gdp="" (current="" us$),kosovo,7386891336.07536="" gdp="" (current="" us$),kuwait,162631412508.784="" gdp="" (current="" us$),kyrgyz="" republic,7468096566.71158="" gdp="" (current="" us$),lao="" pdr,13268458231.9284="" gdp="" (current="" us$),latvia,31335013751.5424="" gdp="" (current="" us$),lebanon,48524603055.257="" gdp="" (current="" us$),lesotho,2614566294.19462="" gdp="" (current="" us$),liberia,3144000000="" gdp="" (current="" us$),libya,41142722414.3351="" gdp="" (current="" us$),liechtenstein,6657170923.37918="" gdp="" (current="" us$),lithuania,48516371720.8346="" gdp="" (current="" us$),luxembourg,66327344188.889="" gdp="" (current="" us$),"macao="" sar,="" china",55347998647.8196="" gdp="" (current="" us$),madagascar,10673516672.6664="" gdp="" (current="" us$),malawi,6047813437.31804="" gdp="" (current="" us$),malaysia,338061963396.376="" gdp="" (current="" us$),maldives,3697351596.83753="" gdp="" (current="" us$),mali,14345828992.0411="" gdp="" (current="" us$),malta,11216758081.9535="" gdp="" (current="" us$),marshall="" islands,183121300="" gdp="" (current="" us$),mauritania,5391475277.24326="" gdp="" (current="" us$),mauritius,12803445933.5894="" gdp="" (current="" us$),mexico,1314563967425.24="" gdp="" (current="" us$),"micronesia,="" fed.="" sts.",317999400="" gdp="" (current="" us$),moldova,7983241044.20189="" gdp="" (current="" us$),monaco,7060236168.2367="" gdp="" (current="" us$),mongolia,12226514722.0861="" gdp="" (current="" us$),montenegro,4587926230.59573="" gdp="" (current="" us$),morocco,110081248587.369="" gdp="" (current="" us$),mozambique,16961117243.491="" gdp="" (current="" us$),myanmar,65446199787.8425="" gdp="" (current="" us$),namibia,12786078008.2376="" gdp="" (current="" us$),nauru,117020381.931693="" gdp="" (current="" us$),nepal,20002968837.9471="" gdp="" (current="" us$),netherlands,879635084124.987="" gdp="" (current="" us$),new="" caledonia,"na"="" gdp="" (current="" us$),new="" zealand,200955119873.905="" gdp="" (current="" us$),nicaragua,11880438824.4494="" gdp="" (current="" us$),niger,8229731383.7693="" gdp="" (current="" us$),nigeria,568498937615.594="" gdp="" (current="" us$),north="" macedonia,11362272837.8818="" gdp="" (current="" us$),northern="" mariana="" islands,845000000="" gdp="" (current="" us$),norway,499338534779.159="" gdp="" (current="" us$),oman,81076723016.9051="" gdp="" (current="" us$),pakistan,244360888750.807="" gdp="" (current="" us$),palau,245675100="" gdp="" (current="" us$),panama,49921464365.3204="" gdp="" (current="" us$),papua="" new="" guinea,23060047127.6509="" gdp="" (current="" us$),paraguay,40276532540.8812="" gdp="" (current="" us$),peru,201080662205.002="" gdp="" (current="" us$),philippines,284584522898.872="" gdp="" (current="" us$),poland,545285410921.999="" gdp="" (current="" us$),portugal,229629822121.601="" gdp="" (current="" us$),puerto="" rico,102445800000="" gdp="" (current="" us$),qatar,206224725274.725="" gdp="" (current="" us$),romania,199626806401.529="" gdp="" (current="" us$),russian="" federation,2063662665172.51="" gdp="" (current="" us$),rwanda,8016591927.65923="" gdp="" (current="" us$),samoa,805162571.787264="" gdp="" (current="" us$),san="" marino,1788510017.24824="" gdp="" (current="" us$),sao="" tome="" and="" principe,348941715.374951="" gdp="" (current="" us$),saudi="" arabia,756350347333.334="" gdp="" (current="" us$),senegal,19770919167.0965="" gdp="" (current="" us$),serbia,44210806365.6817="" gdp="" (current="" us$),seychelles,1343010475.37046="" gdp="" (current="" us$),sierra="" leone,5015157815.73406="" gdp="" (current="" us$),singapore,311539499644.858="" gdp="" (current="" us$),sint="" maarten="" (dutch="" part),"na"="" gdp="" (current="" us$),slovak="" republic,100948236941.182="" gdp="" (current="" us$),slovenia,49904928335.3069="" gdp="" (current="" us$),solomon="" islands,1172268300.95047="" gdp="" (current="" us$),somalia,6562001351.4788="" gdp="" (current="" us$),south="" africa,350636208163.772="" gdp="" (current="" us$),south="" sudan,15099661016.9492="" gdp="" (current="" us$),spain,1376910811040.88="" gdp="" (current="" us$),sri="" lanka,79356449840.8881="" gdp="" (current="" us$),st.="" kitts="" and="" nevis,916857359.52963="" gdp="" (current="" us$),st.="" lucia,1516576962.96296="" gdp="" (current="">
Answered Same DayApr 08, 2021

Answer To: --- title: "HW11" author: "Your Name, Your Uniqname" date: "Due April 13, 2020 at 10pm" output:...

Abr Writing answered on Apr 11 2021
141 Votes
hw11.html
HW11
Your Name, Your Uniqname
Due April 13, 2020 at 10pm
Question 1 (6 pts)
While we can motivate ordinary least squares (OLS) as finding the maximum likelihood estimates for \(Y \sim N(\beta'x, \sigma^2)\), OLS has wider applicability and still nice properties.
When we model \(E(Y \mid x) = \beta'x\) and assume a constant variance, ordinary least squares OLS is the best linear unbiased estimator of the \(\beta\) parameters (i.e., among all methods that are linear functions of \(Y\) and would have unbiased estimates of the parameters, OLS has the smallest variance.)
Part (a) (2 pt)
Suppos
e we have the simple model
\[E(Y \mid x) = \beta x\] (i.e., there is no intercept term.)
Prove that the OLS estimate of \(\beta\) is given by:
\[\hat \beta = \sum_{i = 1}^n w_i Y_i, \quad w_i = \frac{x_i}{\sum_{i=1}^n x_i^2}\]
and show that this is unbiased for \(\beta\).
The OLS estimator can be written as: \[\beta = (X'X)^{-1} X'Y\] Substituting the equation of model (a), \[\beta=\left(|x_i|^2\right)^{-1}x_iy_i=\frac{x_iy_i}{\sum_{i=1}^nx_i^2}\]
From the model (a), we have \(y_ix_i=\beta x_i^2\). Therefore, \(\hat\beta=\beta\) and the estimator is unbaised.
Under the same model, show that estimator
\[\tilde \beta = \sum_{i=1}^n w_i Y_i, \quad w_i = \frac{1}{n x_i}\] is unbiased for \(\beta\).
Combining the above two equations we get \[\tilde \beta = \sum_{i=1}^n \frac{1}{n x_i} Y_i=\frac{1}{n} \sum_{i=1}^n \frac{1}{x_i} Y_i\] From the model (a), we know, \[\frac{Y_i}{x_i}=\beta\] Substituting, \[\tilde \beta = \frac{1}{n} \sum_{i=1}^n \beta=\beta\] Therefore, the estimator is unbiased.
Part (b) (2 pt)
We can also consider biased estimators that have lower variance. One such estimator is called ridge regression and the estimator is given by
\[\bar \beta = (X'X + \lambda I)^{-1} X'Y\] where \(\lambda\) is some positive value and \(I\) is the identity matrix.
Find the ridge regression estimator for the model of (a) and show that for any \(\lambda > 0\), \(\bar \beta\) and \(\hat \beta\) will have same sign and \(|\bar \beta| < |\hat \beta|\).
Let’s build on what we know, which is that whenever the \(n\times p\) model matrix is \(X\), the response n-vector is \(y\), and the parameter p-vector is \(\beta\), the objective function \[f(\beta) = (y - X\beta)^\prime(y - X\beta\] (which is the sum of squares of residuals) is minimized when ?? solves the Normal equations \[(X^\prime X)\beta = X^\prime y.\] Ridge regression adds another term to the objective function (usually after standardizing all variables in order to put them on a common footing), asking to minimize \[(y - X\beta)^\prime(y - X\beta) + \lambda \beta^\prime \beta\] for some non-negative constant \(\lambda\). It is the sum of squares of the residuals plus a multiple of the sum of squares of the coefficients themselves (making it obvious that it has a global minimum). Because \(\lambda\geq0\), it has a positive square root \(v^2=\lambda\).
Consider the matrix X augmented with rows corresponding to v times the \(p\times p\) identity matrix I: \[(y - X\beta)^\prime(y - X\beta) + \lambda \beta^\prime \beta\] When the vector y is similarly extended with p zeros at the end to y*, the matrix product in the objective function adds p additional terms of the form \((0 - \nu \beta_i)^2 = \lambda \beta_i^2\) to the original objective. Therefore \[(y_{*} - X_{*}\beta)^\prime(y_{*} - X_{*}\beta) = (y - X\beta)^\prime(y - X\beta) + \lambda \beta^\prime \beta\] From the form of the left hand expression it is immediate that the Normal equations are \[(y_{*} - X_{*}\beta)^\prime(y_{*} - X_{*}\beta) = (y - X\beta)^\prime(y - X\beta) + \lambda \beta^\prime \beta.\] Because we adjoined zeros to the end of y, the right hand side is the same as \(X^\prime y\). On the left hand side \(v^2I=\lambda I\) is added to the original \(X^\prime X\). Therefore the new Normal equations simplify to \[(X^\prime X + \lambda I)\beta = X^\prime y\]
In ridge regression, we are increasing the bias or making the estimator bias in comparison to OLS estimator in order to decrease the variance. Therefore, \(|\bar \beta| < |\hat \beta|\).
(Note: ridge regression is known as a shrinkage estimator in that in shrinks the estimate of \(\beta\) towards zero. This can be useful if one is considering a model with many \(\beta\) parameters for variables on roughly the same scale, but you only think a few of the variables influence the outcome. Ridge regression, and other shrinkage estimators, will force small estimates even smaller, letting the important predictors shine through.)
Part c (2 pt)
Estimate the bias and variance of the sampling distributions for \(\hat \beta\), \(\tilde \beta\), and \(\bar \beta\) when \(\lambda = 1\) and \(\lambda = 1000\) when
        \(\beta = 2\)
        \(n = 20\)
        \(x_i \sim 1 + Exp(1/10)\)
        \(Y_i \mid x_i \sim U(\beta x - 50, \beta x + 50)\)
Use 10,000 Monte Carlo samples.
\[\mathbf{\lambda=1}\]
N <- 10000
beta <- 2
n <- 20
lambda <- 1
set.seed(1234)
beta.hat <- rep(0, N)
beta.bar <- rep(0, N)
beta.tilde <- rep(0, N)
for (i in 1:N) {
x.i <- 1 + rexp(n, 1/10)
y.i <- rep(0, n)
for (j in 1:n) {
y.i[j] <- runif(1, beta*x.i[j]-50, beta*x.i[j]+50)
}
beta.hat <- c(beta.hat, sum(x.i*y.i/sum(x.i**2)))
beta.bar <- c(beta.bar, sum(x.i*y.i)/(sum(x.i*x.i)+lambda))
beta.tilde <- c(beta.tilde, sum(y.i/x.i)/n)
}
OLS - Unbiased
cat('Bias:', mean(beta.hat)-beta, "\n")
## Bias: -0.999656
cat('Variance:', var(beta.hat-beta), "\n")
## Variance: 1.12021
Unbiased
cat('Bias:', mean(beta.tilde)-beta, "\n")
## Bias: -1.001718
cat('Variance:', var(beta.tilde-beta), "\n")
## Variance: 2.626638
Ridge
cat('Bias:', mean(beta.bar)-beta, "\n")
## Bias: -0.9999358
cat('Variance:', var(beta.bar-beta), "\n")
## Variance: 1.119564
\[\mathbf{\lambda=1000}\]
N <- 10000
beta <- 2
n <- 20
lambda <- 1000
set.seed(1234)
beta.hat <- rep(0, N)
beta.bar <- rep(0, N)
beta.tilde <- rep(0, N)
for (i in 1:N) {
x.i <- 1 + rexp(n, 1/10)
y.i <- rep(0, n)
for (j in 1:n) {
y.i[j] <- runif(1, beta*x.i[j]-50, beta*x.i[j]+50)
}
beta.hat...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here