Homework #15 Problem 2

Business analysts in Laurelistan believe that salaries of top executives in companies have fallen out of sync with the companies’ actual profits. This Excel file contains a list of the total salaries paid out to executives last year and the actual net profits last year for each of 43 Laurelistani companies (both in millions of Laurelistani dollars). Using the Excel Data Analysis tools, run a regression of salaries (the dependent variable) on profits (the independent variable) to see whether executive salaries were really really in line with profits.

The coefficient of determination is ________

The standard error of the equation is ________

The estimated slope coefficient is ________

The corresponding measured test statistic for the two-tail test is ________

The lower and upper confidence limits for the 80% confidence interval for the slope parameter are and ________

The lower and upper confidence limits for the 95% confidence interval for the intercept parameter are and ________

Answer

First, import the data. Do not forget to set your working directory.

setwd("C:/Users/User/OneDrive - UIUC/OneDrive - University of Illinois - Urbana/Semestre 6/Econ203 Spring 2020/TA/8")
library(xlsx)
laurelist<-read.xlsx("laurelistanv3.xls", sheetName = "Sheet1", as.data.frame = T, header = T)
### Column 3 has no data - it is information about the data (millions)

Then, run the regression using lm function:

### Getting rid of column 3 
laurelist<-laurelist[,-3]

reg_laure<-lm(Salaries~Profits, data=laurelist)
summary(reg_laure)
## 
## Call:
## lm(formula = Salaries ~ Profits, data = laurelist)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.9163 -1.5594  0.3696  2.0410  5.4213 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 19.16186    1.07124  17.888   <2e-16 ***
## Profits     -0.17414    0.08504  -2.048   0.0489 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.676 on 32 degrees of freedom
## Multiple R-squared:  0.1159, Adjusted R-squared:  0.08823 
## F-statistic: 4.193 on 1 and 32 DF,  p-value: 0.04887
## Getting the Coefficient of Determination
rsq<-summary(reg_laure)$r.squared
rsq
## [1] 0.1158566
### Using the function summary you have the information about the residual standard error. But you can calculate it by hand
## SSE is the sum of the squared residuals
SSE<-sum(reg_laure$residuals^2)
SSE
## [1] 229.1181
## 34 observations
n<-nrow(laurelist)
n
## [1] 34
### Applying the formula you get the Standard Error of the Regression 
Se<-sqrt(SSE/(n-2))
Se
## [1] 2.675806
### Slope
b<-reg_laure$coefficients[2]
b
##    Profits 
## -0.1741425
### Two-tailed t test for the slope and the respective pvalue
tval<-summary(reg_laure)$coefficients[2,3]
tval
## [1] -2.047737
pval<-summary(reg_laure)$coefficients[2,4]
pval
## [1] 0.04886731
### Why? use summary(reg_laure)$coefficients and try to understand what I did

### Lower and Upper Confidence Interval
confint(reg_laure, level=0.95)
##                  2.5 %       97.5 %
## (Intercept) 16.9798120 21.343902060
## Profits     -0.3473662 -0.000918728
confint(reg_laure, level=0.80)
##                   10 %        90 %
## (Intercept) 17.7600612 20.56365291
## Profits     -0.2854254 -0.06285956