San Diego State University R Programming & Statistical Computing Lab Report



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

I was stuck on this subject and a friend recommended Studypool. I'm so glad I checked it out!

Similar Questions
Related Tags