I load data from mexican firms:

library(readxl)
download.file("http://www.apradie.com/datos/dataex1.xlsx", "dataex1.xlsx", mode="wb")
data<-read_excel("dataex1.xlsx")

PROBLEM 1

#I save the data from the excel file in an R object
data <- read_excel("dataex1.xlsx")

# Keep only the first 2015 quarter 
data$quarter <- as.Date(data$quarter)
data <- as.data.frame(data[(data$quarter=="2015-01-01"),])

I crate my variables:

# Create earnings per share variable
data$eps <- data$ebit / data$sharesoutstanding

# Create earnings per share deflated by price column
data$epsp <- data$eps / data$adjustedstockprice

#Create financial leverage variable 
data$finlev<- data$ltdebt / data$ta
library(statar)
library(plm)

I winsorize earnings per share deflated by price at the 2%:

data$epsp<- winsorize(data$epsp,probs = c(0.02,0.98))
## 0.86 % observations replaced at the bottom
## 0.86 % observations replaced at the top

I Run a multiple regression model:

regressionmodel <- lm(F1r ~ epsp + finlev, data = data)
regressionmodel <- summary(regressionmodel)
regressionmodel
## 
## Call:
## lm(formula = F1r ~ epsp + finlev, data = data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.40900 -0.05603  0.01626  0.07200  0.33677 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  0.0005036  0.0203659   0.025   0.9803  
## epsp         0.6296639  0.4248226   1.482   0.1419  
## finlev      -0.2636856  0.1340223  -1.967   0.0523 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1287 on 88 degrees of freedom
##   (25 observations deleted due to missingness)
## Multiple R-squared:  0.06323,    Adjusted R-squared:  0.04194 
## F-statistic:  2.97 on 2 and 88 DF,  p-value: 0.05648

I calculate the Confidence Intervals:

# Create 95% confidence intervals of B1 
Minb1 <-  0.6296639 - 2*(0.4248226)
Maxb1 <- 0.6296639 + 2*(0.4248226)
Minb1
## [1] -0.2199813
Maxb1
## [1] 1.479309
# Create 95% confidence intervals of B2
Minb2 <-  -0.2636856 - 2*(0.1340223)
Maxb2 <- -0.2636856 + 2*(0.1340223)
Minb2
## [1] -0.5317302
Maxb2
## [1] 0.004359

Interpretation

# WITH THE EFFECT OF EPS DEFLATED BY PRICE, I CAN SEE THAT THE EFFECT OF FINANCIAL LEVERAGE IS NEGATIVE AND SIGNIFICANT, SINCE THE P VALUE OBTAINED IS 0.0523. THIS MEANS THAT FOR EACH UNIT CHANGE IN THE FINANCIAL LEVARAGE, THE CHANGE IN THE QUARTERLY STOCK RETURN IS -26.36%. WITH THIS WE CAN ASSUME THAT THE EFFECT OF FINANCIAL LEVERAGE IS NEGATIVE IN RELATION TO THE EPSP, SINCE THE P VALUE IS 0.0523. 

PROBLEM 2

I start by clearing my environment:

rm(list = ls())
options(scipen = 999)
library(readxl)
download.file("http://www.apradie.com/datos/dataex1.xlsx", "dataex1.xlsx", mode="wb")
data<-read_excel("dataex1.xlsx")

I create again my Variables:

# Create earnings per share variable
data$eps <- data$ebit / data$sharesoutstanding
# Create earnings per share deflated by price column
data$epsp <- data$eps / data$adjustedstockprice

I create new variable for Market Value:

data$marketvalue <- data$adjustedstockprice * data$sharesoutstanding
data$size1 <- log (data$marketvalue)

I proceed to winsorize again at 2%:

data$epsp<- winsorize(data$epsp,probs = c(0.02,0.98))
## 1.54 % observations replaced at the bottom
## 1.54 % observations replaced at the top

I crate another variable for Cashflow:

data$cflow <- data$cashflowoper/data$ta

I winsorize at 1%:

data$cflow <- winsorise(data$cflow, probs = c(0.01,0.99))
## 0.86 % observations replaced at the bottom
## 0.86 % observations replaced at the top
library(statar)
library(plm)

I create categorical variable:

data$size1 <- factor(data$sizetype, c("small","medium","big"), labels = c("Small", "Medium", "Big"))

I create the Regression Model:

regressionmodel2 <- lm(data$epsp ~ data$cflow + data$size1, na.action = na.omit)
regressionmodel2 <- summary(regressionmodel2)
regressionmodel2
## 
## Call:
## lm(formula = data$epsp ~ data$cflow + data$size1, na.action = na.omit)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.14016 -0.03750 -0.01883  0.01352  0.40089 
## 
## Coefficients:
##                   Estimate Std. Error t value             Pr(>|t|)    
## (Intercept)       0.054687   0.003310  16.523 < 0.0000000000000002 ***
## data$cflow        0.115252   0.038837   2.968              0.00306 ** 
## data$size1Medium -0.037932   0.009057  -4.188            0.0000301 ***
## data$size1Big    -0.001218   0.004191  -0.291              0.77142    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07213 on 1261 degrees of freedom
##   (359 observations deleted due to missingness)
## Multiple R-squared:  0.02409,    Adjusted R-squared:  0.02177 
## F-statistic: 10.38 on 3 and 1261 DF,  p-value: 0.0000009517

Interpretation:

# AFTER CREATING THIS MODEL FOR ALL QUARTERS, I WAS ABLE TO SEE THAT THE CASH FLOW RATIO COEFFICIENT IS  0.115252, MEANING THAT AS THE CASH FLOW INCREASES IN ONE UNIT THE EARNINGS PER SHARE DEFLATED BY PRICE WILL INCREASE IN 11.5%, THE P VALUE IS <0.05 MEANING THAT IT IS SIGNIFICANT. 
# EPSP ESTIMATED VALUE IS EXPECTED TO BE 0.054687.