# LAB 2.2 -- COMPUTER EXERCISES C2 and C6

.Rmd
--- title: "LAB 2.2 -- COMPUTER EXERCISES C2 and C6" author: "Kai Thng" date: "9/12/2022" output: html_document --- ```{r setup, include=TRUE} knitr::opts_chunk\$set(echo = TRUE, include=TRUE) options(scipen=999) library(wooldridge) library(texreg) library(tidyverse) library(formattable) library(psych) ``` #### C2 Using the CEOSAL2 Dataset ```{r} head(ceosal2) psych::describe(ceosal2) ``` ##### (i) Find the average salary and the average tenure in the sample. ```{r} xsalary <- mean(ceosal2\$salary) xsalary xceoten <- mean(ceosal2\$ceoten) xceoten ``` The average salary for chief executives for U.S. corporations is 865,864 dollars. The average years of tenure for chief executives for U.S. corporations is7.95 years. ##### (ii) How many CEOs are in their first year as CEO (that is, ceoten=0)? What is the longest tenure as a CEO? ```{r} firstceoten <- count(ceosal2,ceoten=0) firstceoten maxceoten <- max(ceosal2\$ceoten) maxceoten ``` The number of Chief executive officers that are in their first year was sound to be 177. The longest tenured CEO has been at the company for 37 years. ##### (iii) Estimate the simple regression model and report your results in the usual form. What is the (approximate) predicted percentage increase in salary given one more year as a CEO? ```{r} model <- lm(salary ~ ceoten, data=ceosal2) model ```
The simple regression model for salary is log(**salary**)= 772.43 + 11.75 **ceoten** + u. The approximate predicted percentage increase in salary given one more year as a CEO is 11.75%. #### C6: Using the MeAP93 set ```{r} head(meap93) psych::describe(meap93) ``` ##### (i)Do you think each additional dollar spent has the same effect on the pass rate, or does a diminishing effect seem more appropriate? Explain. ```{r} plot(meap93\$math10,meap93\$expend) ``` Based on the scatter plot, there seems to be a diminishing return in the pass rate with each dollar added. The spread of the dots gets wider as dollars are increased instead of there being more at higher scores. ##### (ii) In the population model argue that B1/10 is the percentage point change in math10 given a 10% increase in expend. This makes sense because the model is given with log and 10% increase in expend would be the same as a b1/10 percentage point in math 10 since b1/10 is just .1. therefore both would equal 1.116%. ##### (iii) In the population model argue that B1/10 is the percentage point change in math10 given a 10% increase in expend. ```{r} model <- lm(math10~lexpend,data = meap93) model count(meap93) summary(model) ``` math10=-69.34+11.164log(expend)+u n=408, R2=0.02966 The B0 of the model is -69.34. The B1 of the model is 11.164. There are 408 observations in the sample. 2.97 percent of the the math pass rate is explained by the model with spending per student. ##### (IV) How big is the estimated spending effect? Namely, if spending increases by 10%, what is the estimated percentage point increase in math10? The estimated spending effect is 11.164 which is statistically significant at 5%. When spending increases by 10% the estimated percentage point increase in math10 is 1.116 since a 10% increase in spending is equal to a B1/10 percentage point change in math 10. ##### (V) One might worry that regression analysis can produce fitted values for math10 that are greater than 100. Why is this not much of a worry in this data set? This is not too much of a worthy because in order to have a an analysis that produces values greater than 100 spending would have to be at least \$3,867,040.
-69.341+11.164log(expend)>100 11.164log(expend)>169.341 log(expend)>15.168 expend>e^15.168 expend>3,867,040 #### End