Hi,
Here is my Real Estate Investment Trust project, please provide any feedback.
REIT Stock Analysis
Import the numpy module as np
import numpy as np
Load the adjusted closings for SBRA
adj_closings_sbra = np.loadtxt(‘SBRA.csv’, skiprows=1, usecols=5, delimiter=’,’)
Load the adjusted closings for EQR
adj_closings_eqr = np.loadtxt(‘EQR.csv’, skiprows=1, usecols=5, delimiter=’,’)
Simple Rate of Return Function
Create a function that returns the daily rate of return
def rate_of_return(adj_closings):
daily_simple_ror = np.diff(adj_closings)/adj_closings[:-1]
return daily_simple_ror
Calculate Daily Rate of Return for SBRA
daily_simple_returns_sbra = rate_of_return(adj_closings_sbra)
Calculate Daily Rate of Return for EQR
daily_simple_returns_eqr = rate_of_return(adj_closings_eqr)
Calculate Average Daily Return for SBRA
average_daily_simple_return_sbra = np.mean(daily_simple_returns_sbra)
print(average_daily_simple_return_sbra)
0.00210937212011956
Calculate Average Daily Return for EQR
average_daily_simple_return_eqr = np.mean(daily_simple_returns_eqr)
print(average_daily_simple_return_eqr)
0.0015777637451981398
Compare the Average Daily Return between EQR and SBRA
Sbra
Daily Log Returns Function
Create a function that returns the daily rate of return
def log_returns(adj_closings):
log_adj_closings = np.log(adj_closings)
daily_log_returns = np.diff(log_adj_closings)
return daily_log_returns
Calculate Daily Log Returns for SBRA
daily_log_returns_sbra = log_returns(adj_closings_sbra)
print(daily_log_returns_sbra)
Calculate Daily Log Returns for EQR
daily_log_returns_eqr = log_returns(adj_closings_eqr)
print(daily_log_returns_eqr)
Annualize Daily Log Return Function
Create a function that returns the daily rate of return
def annualize_log_return(daily_log_returns):
average_daily_log_returns = np.mean(daily_log_returns)
annualized_log_return = average_daily_log_returns * 250
return annualized_log_return
Calculate Annualize Daily Log Return for SBRA
annualized_log_return_sbra = annualize_log_return(daily_log_returns_sbra)
print(annualized_log_return_sbra)
0.5044563709645333
Calculate Annualize Daily Log Return for EQR
annualized_log_return_eqr = annualize_log_return(daily_log_returns_eqr)
print(annualized_log_return_eqr)
0.3855982155640554
Compare the Annualize Daily Log Return between EQR and SBRA
Based on the differences between the Annualize Daily Log Return for EQR and SBRA, Which could be more profitable in the future and why?
Calculate Variance of Daily Log Return for SBRA
daily_variance_sbra = np.var(daily_log_returns_sbra)
print(daily_variance_sbra)
0.00017844226355047074
Calculate Variance of Daily Log Return for EQR
daily_variance_eqr = np.var(daily_log_returns_eqr)
print(daily_variance_eqr)
6.833881310511606e-05
Compare the Variance of Daily Log Return between EQR and SBRA
Explain which investment is more riskier based on the Variance of daily log return between EQR and SBRA ? SBRA is riskier
Calculate the Daily Standard Deviation for SBRA
daily_sd_sbra = np.std(daily_log_returns_sbra)
print(daily_sd_sbra)
0.013358228308816658
Calculate the Daily Standard Deviation for EQR
daily_sd_eqr = np.std(daily_log_returns_eqr)
print(daily_sd_eqr)
0.00826672928703463
Compare the Daily Standard Deviation between EQR and SBRA
Has your previous variance risk assessment changed based on the Daily Standard Deviation and why? No, the Std reinforces previous assessments
Calculate the Correlation between SBRA and EQR
corr_sbra_eqr = np.corrcoef(daily_log_returns_sbra, daily_log_returns_eqr)
print(corr_sbra_eqr)
[[1. 0.62096591]
[0.62096591 1. ]]
Interpret the Correlation between SBRA and EQR
Interpret and explain the correlation between the stocks SBRA and EQR? There is a positive correlation so should invest in one not both in order to diversify.
Final Analysis
Which stock would you invest in based on risk and profitability? SBRA