 San Diego State University R Programming & Statistical Computing Lab Report

eblnyzvxrl101

Programming

San Diego State University

### Question Description

Need help with R programming on this statistical assignment! I've attached the assignment and the data sets required below!

### Unformatted Attachment Preview

3rd Statistical computing assignment 1) The following model can be used to study whether campaign expenditures affect election outcomes: 𝑣𝑜𝑡𝑒𝐴 = 𝛽0 + 𝛽1 log(𝑒𝑥𝑝𝑒𝑛𝑑𝐴) + 𝛽2 log(𝑒𝑥𝑝𝑒𝑛𝑑𝐵) + 𝛽3 𝑝𝑟𝑡𝑦𝑠𝑡𝑟𝐴 + 𝑢 Where 𝑣𝑜𝑡𝑒𝐴 is the percentage of the votes received by candidate A, 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 and 𝑒𝑥𝑝𝑒𝑛𝑑𝐵 are campaign expenditures by Candidates A and B, and 𝑝𝑟𝑡𝑦𝑠𝑡𝑟𝐴 is a measure of party strength for Candidate A. a. What is the interpretation of 𝛽1 ? b. In terms of the parameters, state the null hypothesis that a 1% increase in A’s expenditures is offset by a 1% increase in B’s expenditures. c. Estimate the given model using the data in VOTE1 and report the results in the usual form. Do A’s expenditures affect the outcome? What about B’s expenditures? Can you use these results to test the hypothesis in part (b)? d. Estimate a model that directly gives the t-statistic for testing the hypothesis in part (b). What do you conclude? (use a two-sided alternative). 2) Use the data in WAGE2 for this exercise. a. Consider the standard wage equation log(𝑤𝑎𝑔𝑒) = 𝛽0 + 𝛽1 𝑒𝑑𝑢𝑐 + 𝛽2 𝑒𝑥𝑝𝑒𝑟 + 𝛽3 𝑡𝑒𝑛𝑢𝑟𝑒 + 𝑢 State the null hypothesis that another year of general workforce experience has the same effect on log⁡(𝑤𝑎𝑔𝑒) as another year of tenure with the current employer. b. Test the null hypothesis in part (a) against a two-sided alternative, at the 5% significance level, by constructing a 95% confidence interval. What do you conclude? 3) Use the data in ELEM94_95 to answer the following parts. The findings can be compared with those in table 4.1 in your text. The dependent variable 𝑙𝑎𝑣𝑔𝑠𝑎𝑙 is the log of average teacher salary and 𝑏𝑠 is the ratio of average benefits to average salary (by school). a. Run the simple regression of 𝑙𝑎𝑣𝑔𝑠𝑎𝑙 on 𝑏𝑠. Is the estimated slope statistically different from zero? Is it statistically different from -1? b. Add the variables 𝑙𝑒𝑛𝑟𝑜𝑙 and 𝑙𝑠𝑡𝑎𝑓𝑓 to the regression from part (a). What happens to the coefficient on 𝑏𝑠? How does the situation compare with that in Table 4.1? c. How come the standard error on the 𝑏𝑠 coefficient is smaller in part (b) than in part (a)? d. How come the coefficient on 𝑙𝑠𝑡𝑎𝑓𝑓 is negative? Is it large in magnitude? e. Now add the variable 𝑙𝑢𝑛𝑐ℎ to the regression. Holding other factors fixed, are teachers being compensated for teaching students from disadvantaged backgrounds? Explain. f. Overall, is the pattern of results that you find with ELEM94_95 consistent with the pattern in Table 4.1? 4) Use the data in ECONMATH to answer the following questions. a. Estimate a model explaining 𝑐𝑜𝑙𝑔𝑝𝑎 to ℎ𝑠𝑔𝑝𝑎, 𝑎𝑐𝑡𝑚𝑡ℎ, and 𝑎𝑐𝑡𝑒𝑛𝑔. Report the results in the usual form. Are all explanatory variables statistically significant? b. Consider an increase in ℎ𝑠𝑔𝑝𝑎 of one standard deviation, about .343. By how much ̂ increase, holding 𝑎𝑐𝑡𝑚𝑡ℎ and 𝑎𝑐𝑡𝑒𝑛𝑔 fixed. About how many standard does 𝑐𝑜𝑙𝑔𝑝𝑎 ̂ by the same amount deviations would the 𝑎𝑐𝑡𝑚𝑡ℎ have to increase to change 𝑐𝑜𝑙𝑔𝑝𝑎 as a one standard deviation in ℎ𝑠𝑔𝑝𝑎? Comment. c. Test the null hypothesis that 𝑎𝑐𝑡𝑚𝑡ℎ and 𝑎𝑐𝑡𝑒𝑛𝑔 have the same effect in the population against a two-sided alternative. Report the p-value and describe your conclusions. d. Suppose the college admissions officer wants you to use the data on the variables in part (a) to create an equation that explains at least 50% of the variation in 𝑐𝑜𝑙𝑔𝑝𝑎. What would you tell the officer? 5) Use the data KIELMC, only for year 1981, to answer the following parts. The data are for houses that sold during 1981 in North Andover, MA; 1981 was the year construction began on a local garbage incinerator. a. To study the effects of the incinerator location on housing price, consider the simple regression model log(𝑝𝑟𝑖𝑐𝑒) = 𝛽0 + 𝛽1 log(𝑑𝑖𝑠𝑡) + 𝑢 Where 𝑝𝑟𝑖𝑐𝑒 is housing price in dollars and 𝑑𝑖𝑠𝑡 is distance from the house to the incinerator measured in feet. Interpreting this equation causally, what sign do you expect for 𝛽1 if the presence of the incinerator depresses housing prices? Estimate this equation and interpret the results. b. To the simple regression in part (a), please add the variables log(𝑖𝑛𝑡𝑠𝑡) , log(𝑎𝑟𝑒𝑎) , log(𝑙𝑎𝑛𝑑) , 𝑟𝑜𝑜𝑚𝑠, 𝑏𝑎𝑡ℎ𝑠, and 𝑎𝑔𝑒, where 𝑖𝑛𝑡𝑠𝑡 is distance from the home to the interstate, 𝑎𝑟𝑒𝑎 is square footage of the house, 𝑙𝑎𝑛𝑑 is the lot size in square feet, 𝑟𝑜𝑜𝑚𝑠 is total number of rooms, 𝑏𝑎𝑡ℎ𝑠 is number of bathrooms, and 𝑎𝑔𝑒 is the age of the house in years. Now, what do you conclude about the effects of the incinerator? Explain why (a) and (b) give conflicting results. c. Add [log(𝑖𝑛𝑡𝑠𝑡)]2 to the model in part (b). Now what happens? What do you conclude about the importance of functional form? d. Is the square of log⁡(𝑑𝑖𝑠𝑡) significant when you add it to the model from part (c)? 6) Use the data in WAGE1 for this exercise. a. Use OLS to estimate the equation log(𝑤𝑎𝑔𝑒) = 𝛽0 + 𝛽1 𝑒𝑑𝑢𝑐 + 𝛽2 𝑒𝑥𝑝𝑒𝑟 + 𝛽3 𝑒𝑥𝑝𝑒𝑟 2 + 𝑢 And report the results using the usual format (equation, n, 𝑅 2). b. Is 𝑒𝑥𝑝𝑒𝑟 2 statistically significant at the 99% confidence level? c. Using the approximation ̂2 + 2𝛽 ̂3 𝑒𝑥𝑝𝑒𝑟)Δ𝑒𝑥𝑝𝑒𝑟, %Δ𝑤𝑎𝑔𝑒 ̂ ≈ 100(𝛽 Find the approximate return to the fifth year of experience. What is the approximate return to the 20th year of experience? d. At what value of 𝑒𝑥𝑝𝑒𝑟 does additional experience actually lower predicted log⁡(𝑤𝑎𝑔𝑒)? How many people have more experience than this in the sample? 7) Use the data in VOTE1 for this exercise. a. Consider a model with an interaction term between expenditures: 𝑣𝑜𝑡𝑒𝐴 = 𝛽0 + 𝛽1 𝑝𝑟𝑡𝑦𝑠𝑡𝑟𝐴 + 𝛽2 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 + 𝛽3 𝑒𝑥𝑝𝑒𝑛𝑑𝐵 + 𝛽4 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 ∗ 𝑒𝑥𝑝𝑒𝑛𝑑𝐵 + 𝑢 What is the partial effect of 𝑒𝑥𝑝𝑒𝑛𝑑𝐵 on 𝑣𝑜𝑡𝑒𝐴, holding 𝑝𝑟𝑡𝑦𝑠𝑡𝑟𝐴 and 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 fixed? What is the partial effect of 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 on 𝑣𝑜𝑡𝑒𝐴? Is the expected sign for 𝛽4 obvious? b. Estimate the equation in part (a) and report the results in the usual form. Is the interaction term statistically significant? c. Find the average of 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 in the sample. Fix 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 at 300 (for \$300,000). What is the estimated effect of another \$100,000 spent by Candidate B on 𝑣𝑜𝑡𝑒𝐴? Is this a large effect? d. Now fix 𝑒𝑥𝑝𝑒𝑛𝑑𝐵 at 100. What is the estimated effect of Δ𝑒𝑥𝑝𝑒𝑛𝑑𝐴 = 100 on 𝑣𝑜𝑡𝑒𝐴? Does this make sense? e. Now, estimate a model that replaces the interaction with 𝑠ℎ𝑎𝑟𝑒𝐴, Candidate A’s percentage share of total campaign expenditures. Does it make sense to hold both 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 and 𝑒𝑥𝑝𝑒𝑛𝑑𝐵 fixed, while changing 𝑠ℎ𝑎𝑟𝑒𝐴? f. In the model from part (e), find the partial effect of 𝑒𝑥𝑝𝑒𝑛𝑑𝐵 on 𝑣𝑜𝑡𝑒𝐴, holding 𝑝𝑟𝑡𝑦𝑠𝑡𝑟𝐴 and 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 fixed. Evaluate this at 𝑒𝑥𝑝𝑒𝑛𝑑𝐴 = 300 and 𝑒𝑥𝑝𝑒𝑛𝑑𝐵 = 0 and comment on the results. ...
Purchase answer to see full attachment Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

## Final Answer Hello, I've completed the task. r_analysis.R provides all code, and the answers are written up in third_statistical_assi... znevarefsna22 (39)
UC Berkeley Anonymous
I was stuck on this subject and a friend recommended Studypool. I'm so glad I checked it out! Studypool 4.7 Trustpilot 4.5 Sitejabber 4.4