0% found this document useful (0 votes)
3 views

Linear Regression Example

Linear regression Model

Uploaded by

Jad Zakaria Elo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Linear Regression Example

Linear regression Model

Uploaded by

Jad Zakaria Elo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Exercise 1: Apple Inc.

(AAPL)

Objective: Analyze the relationship between the market return and the stock return
for Apple Inc. by calculating the coefficients of the linear regression model manually
and verifying the results using R.

Data:

Observation Market Return (X) Stock Return (Y)

1 5% 7%

2 10% 12%

3 15% 14%

4 20% 19%

5 25% 22%

Instructions:

1. Calculate the Mean Values and the Standard deviation

o Calculate x (mean market return) and y (mean stock return) for Apple
Inc.

o Calculate the Standard deviation of x and y

Interpreting the results of descriptive statistics


2. Calculate the Coefficients Manually:

o Using the data provided, compute ˆ using the formula:

ˆ = 
xt yt − Txy
x 2
t − Tx 2

o Calculate ̂ using the formula:

ˆ = y − ˆ x
Prediction:

• If the market return X is predicted to increase by 10% in t+1 (from the last
observation), what would the predicted stock return Y be for t+1? Show your
calculations based on the linear regression model you derived.

3. Verify the Results Using R:

o Calculate descriptive statistics, using the following commands:

descriptive_stats <- data.frame(

Mean_Market_Return = mean(the_name_of_your_database$X),

SD_Market_Return = sd(the_name_of_your_database$X),

Mean_Stock_Return = mean(the_name_of_your_database$Y),

SD_Stock_Return = sd(the_name_of_your_database$Y) )

print(descriptive_stats)

o Load the data and run the regression model for Apple Inc. using the
following commands:

apple_model <- lm(stock_return ~ market_return, data = apple_data)

summary(apple_model)
4. Interpreting the results of the linear regression model

Exercise 2: Microsoft Corporation (MSFT)

Objective: Analyze the relationship between the market return and the stock return for
Microsoft Corporation by calculating the coefficients of the linear regression model
manually and verifying the results using R.

Data:

Observation Market Return (X) Stock Return (Y)

1 3% 5%
2 8% 10%
3 12% 11%
4 15% 16%
5 20% 18%
6 5% 7%
7 10% 13%
8 18% 17%
9 22% 20%
10 25% 23%
11 30% 28%
12 35% 30%

Instructions: Do the same analysis as in the previous exercises by calculating the


different descriptive statistics manually and estimating the beta and alpha parameters
of the model. After that, verify the results using R.

You might also like