REIT STOCK ANALYSIS
In this project, you will analyze Real Estate Investment Trusts, commonly known as REITs. REITs are companies that own or operate real estate that produces income. REITs, like the stocks of regular public companies, are traded on different stock exchanges. Investing in a REIT allows you to invest in portfolios of real estate assets the same way you can invest in a company by buying its stock.
Using financial statistics and NumPy you will analyze two REITs: Sabra Health Care REIT Inc. (NASDAQ: SBRA), which invests in health care real estate, and Equity Residential (NASDAQ:EQR), which invests in rental apartment properties.
The time period for analysis we will be using is Jan 1 2018 to Dec 31 2018. The REIT data for SBRA (SBRA.csv) and EQR (EQR.csv) can be found in the same folder as this file.
Import the numpy module as np
import numpy as np
ModuleNotFoundError: No module named ‘numpy’
Load the adjusted closings for SBRA
adj_closings_sbra = np.loadtxt(“SBRA.csv”, skiprows=1, usecols=5, delimiter=‘,’)
print(adj_closings_sbra)
[16.295595 16.287062 16.013905 15.783428 16.065119 15.698063 15.552948
15.535877 15.220038 15.296862 15.305403 15.168818 15.160282 15.365152
15.672459 15.467587 15.604168 15.518806 15.373691 15.17736 15.450516
15.143212 15.049313 14.631038 14.665186 14.596896 14.024972 14.221302
14.349346 14.34081 13.998735 14.481149 14.910934 14.568859 14.516233
14.972331 15.191611 15.270552 14.998645 14.805679 15.042501 14.989876
15.524915 15.805591 15.998555 15.849446 15.849446 16.156435 15.735423
15.866989 15.621396 15.700336 15.65648 15.375805 15.270552 15.095128
14.603944 14.770597 14.81445 15.48983 15.481058 15.024958 15.305635
15.64771 15.586311 15.524915 15.428432 15.437201 15.358261 15.007417
15.086357 15.323176 15.568768 15.621396 15.384579 15.086357 15.068815
15.26178 15.270552 15.393345 16.103809 16.059952 16.393257 16.393257
16.358171 16.849354 17.165115 17.086174 17.27914 17.6563 17.682613
17.577362 17.489649 17.393166 17.173887 17.173887 17.577873 17.658672
17.892086 18.044701 18.242205 18.502552 18.834719 18.610283 18.67312
18.843697 18.601301 18.67312 18.709034 18.816765 18.753922 19.14893
18.915516 19.193815 18.996311 19.104044 19.014267 19.355412 19.166885
19.229727 19.310526 19.481098 19.490072 19.723484 19.508028 19.534962
19.876106 20.226227 20.34293 20.037699 20.199293 20.190313 20.360889
20.226227 20.082586 19.894056 19.669621 20.082586 19.705534 19.624737
19.328482 19.409279 19.418251 18.816765 18.834719 19.400299 19.490072
19.418251 19.965878 19.813261 20.07361 19.894056 20.010767 19.822239
20.010767 20.540434 20.74692 20.939188 21.296261 21.223017 21.30542
21.332886 21.268795 21.186394 21.067368 21.497688 21.644182 21.442755
21.589247 21.387819 21.653336 21.570934 21.177237 21.287106 21.277952
21.314573 21.552626 21.204706 21.396976 21.342041 20.994123 21.415287
21.332886 20.920876 21.049059 20.609583 20.746916 21.168081 20.627893
20.600424 20.325752 20.041924 20.069393 20.554649 20.783543 20.59127
19.968678 19.401022 19.666538 20.380688 20.170107 20.023615 19.959522
19.712318 19.574982 19.822186 20.087704 19.639074 19.922903 20.170107
19.822186 20.032766 19.758097 20.444778 19.648228 19.85881 19.584139
19.483427 19.355244 18.879145 18.392426 17.896345 17.456423 18.018024
17.971224 17.521944 17.484503 17.681063 17.877625 18.092905 18.055466
18.055466 18.064823 17.587465 18.139706 18.036745 17.699785 18.046106
17.606184 17.550024 17.521944 16.857384 17.025864 16.492344 16.408104
15.846501 14.985381 15.44402 15.303621 15.350421 15.425301]
Calculate Simple Rate of Return
To calculate the daily RoR for the SBRA stock we need the daily adjusted closing price. The formula we are using for the daily rate of return is out[n] = a[n+1] - a[n]
Create a function that returns the daily rate of return
step 1. define a function named rate_of_return
step 2. create parameter for adj_closings
step 3. Within the function use np.diff() and set it to the variable daily_simple_ror
step 4. return daily_simple_ror
def simple_rate_of_return(adj_closings):
daily_simple_ror = np.diff(adj_closings)/adj_closings[:-1]
return daily_simple_ror
Call the function simple_rate_of_return with the arguments adj_closings_sbra. Then print the results.
daily_simple_returns_sbra = simple_rate_of_return(adj_closings_sbra)
print(daily_simple_returns_sbra )
[-0.00052364 -0.01677141 -0.0143923 0.01784726 -0.02284801 -0.00924413
-0.00109761 -0.02032965 0.00504756 0.00055835 -0.00892397 -0.00056273
0.0135136 0.02000026 -0.0130721 0.00883014 -0.00547046 -0.00935091
-0.01277058 0.0179976 -0.01988956 -0.00620073 -0.02779363 0.00233394
-0.00465661 -0.03918121 0.0139986 0.00900368 -0.00059487 -0.02385326
0.03446126 0.02967893 -0.02294122 -0.00361223 0.03141986 0.01464568
0.00519635 -0.01780597 -0.01286556 0.01599535 -0.00349842 0.03569336
0.01807907 0.01220859 -0.00932015 0. 0.01936907 -0.02605847
0.00836114 -0.01547824 0.00505333 -0.00279332 -0.01792708 -0.00684537
-0.01148773 -0.03253924 0.01141151 0.00296894 0.04558927 -0.00056631
-0.02946181 0.01868072 0.02234961 -0.00392383 -0.0039391 -0.00621472
0.00056837 -0.00511362 -0.02284399 0.00526007 0.01569756 0.01602749
0.00338036 -0.01515978 -0.01938448 -0.00116277 0.01280559 0.00057477
0.00804116 0.04615397 -0.00272339 0.0207538 0. -0.00214027
0.03002677 0.01874024 -0.00459892 0.01129369 0.02182748 0.00149029
-0.00595223 -0.00499011 -0.00551658 -0.01260719 0. 0.02352327
0.00459663 0.01321809 0.00852975 0.01094526 0.01427168 0.0179525
-0.01191608 0.00337647 0.0091349 -0.01286351 0.00386097 0.0019233
0.00575823 -0.00333973 0.02106269 -0.0121894 0.01471274 -0.01028998
0.00567126 -0.00469937 0.01794153 -0.00974027 0.00327868 0.00420178
0.00883311 0.00046065 0.01197594 -0.01092383 0.00138066 0.01746325
0.01761517 0.00576988 -0.01500428 0.0080645 -0.00044457 0.00844841
-0.00661376 -0.00710172 -0.00938774 -0.01128151 0.02099507 -0.01877507
-0.00410022 -0.015096 0.0041802 0.00046225 -0.03097529 0.00095415
0.03002859 0.0046274 -0.003685 0.02820166 -0.00764389 0.01314014
-0.00894478 0.00586663 -0.00942133 0.00951093 0.0264691 0.01005266
0.0092673 0.01705286 -0.00343929 0.00388272 0.00128916 -0.00300433
-0.00387427 -0.00561804 0.0204259 0.00681441 -0.00930629 0.00683177
-0.00933002 0.0124144 -0.00380551 -0.01825127 0.00518807 -0.00043003
0.00172108 0.01116856 -0.01614281 0.00906733 -0.00256742 -0.016302
0.02006104 -0.00384777 -0.01931337 0.00612704 -0.02087865 0.00666355
0.02030013 -0.02551899 -0.00133164 -0.01333332 -0.01396396 0.00137058
0.02417891 0.01113587 -0.00925121 -0.03023573 -0.02842732 0.01368567
0.03631295 -0.01033238 -0.00726283 -0.00320087 -0.01238527 -0.00696701
0.01262857 0.01339499 -0.02233356 0.01445226 0.01240803 -0.01724934
0.01062345 -0.01371099 0.03475441 -0.03896105 0.01071761 -0.01383119
-0.00514253 -0.00657908 -0.02459793 -0.02578078 -0.02697203 -0.02458167
0.0321716 -0.0025974 -0.02499997 -0.00213681 0.01124196 0.01111709
0.01204187 -0.00206926 0. 0.00051824 -0.02642473 0.03139969
-0.005676 -0.01868186 0.0195664 -0.02437767 -0.00318979 -0.0016
-0.0379273 0.00999443 -0.03133585 -0.00510782 -0.03422717 -0.05434133
0.03060576 -0.00909083 0.0030581 0.00487804]
Calculate Average Daily Return
Use np.mean() with the argument daily_simple_returns_sbra to calculate the average daily return. Then set it to the variable name average_daily_simple_return_sbra
average_daily_simple_return_sbra = np.mean(daily_simple_returns_sbra)
print(average_daily_simple_return_sbra)
-8.542353953650273e-05
Calculate Daily Log Returns
Create a function that returns the daily rate of return
step 1. define a function named log_returns
step 2. create parameter for adj_closings
step 3. use np.log() to get the log of each adjusted closing price and set it to the variable log_adj_closings
step 4. use np.diff() to get the diff of each daily log adjusted closing price and set it to the variable daily_log_returns
step 5. return daily_log_returns
def log_returns(adj_closings):
log_adj_closings = np.log(adj_closings)
daily_log_returns = np.diff(log_adj_closings)
return daily_log_returns
Call the function log_returns with the arguments adj_closings_sbra. Set it to the variable daily_log_returns_sbra. Then print the results.
daily_log_returns_sbra = log_returns(adj_closings_sbra)
print(daily_log_returns_sbra)
[-0.00052378 -0.01691364 -0.01449688 0.01768987 -0.02311307 -0.00928713
-0.00109821 -0.02053915 0.00503486 0.00055819 -0.00896403 -0.00056289
0.01342311 0.01980288 -0.0131583 0.00879138 -0.00548548 -0.00939491
-0.01285283 0.01783756 -0.02009002 -0.00622004 -0.02818718 0.00233122
-0.00466748 -0.03996945 0.01390153 0.00896338 -0.00059505 -0.02414235
0.03388077 0.02924703 -0.02320846 -0.00361877 0.03093636 0.01453947
0.0051829 -0.0179664 -0.01294904 0.01586877 -0.00350455 0.03507111
0.01791759 0.01213467 -0.00936386 0. 0.01918388 -0.02640401
0.00832637 -0.01559927 0.0050406 -0.00279722 -0.01808972 -0.0068689
-0.01155423 -0.03308041 0.01134689 0.00296454 0.04458062 -0.00056647
-0.02990453 0.01850838 0.02210352 -0.00393155 -0.00394688 -0.00623411
0.0005682 -0.00512674 -0.02310896 0.00524628 0.01557563 0.0159004
0.00337466 -0.01527587 -0.01957482 -0.00116345 0.01272429 0.0005746
0.00800901 0.04512055 -0.00272711 0.02054137 0. -0.00214256
0.02958479 0.01856681 -0.00460953 0.0112304 0.02159267 0.00148918
-0.00597002 -0.0050026 -0.00553185 -0.01268734 0. 0.02325086
0.0045861 0.0131315 0.00849358 0.0108858 0.0141708 0.01779325
-0.01198764 0.00337078 0.00909342 -0.01294696 0.00385353 0.00192145
0.00574172 -0.00334532 0.02084394 -0.0122643 0.01460555 -0.01034329
0.00565524 -0.00471045 0.01778248 -0.00978802 0.00327331 0.00419297
0.00879433 0.00046055 0.0119048 -0.01098393 0.00137971 0.01731252
0.01746182 0.0057533 -0.01511798 0.00803215 -0.00044467 0.00841292
-0.00663573 -0.00712706 -0.00943208 -0.01134563 0.02077771 -0.01895356
-0.00410865 -0.0152111 0.00417149 0.00046215 -0.03146517 0.00095369
0.02958656 0.00461673 -0.00369181 0.02781132 -0.00767326 0.01305456
-0.00898502 0.00584949 -0.00946599 0.00946599 0.02612486 0.01000247
0.00922463 0.01690909 -0.00344522 0.0038752 0.00128833 -0.00300885
-0.00388179 -0.00563388 0.02022009 0.00679129 -0.00934986 0.00680854
-0.00937381 0.01233798 -0.00381277 -0.01841988 0.00517466 -0.00043012
0.0017196 0.01110665 -0.01627453 0.00902647 -0.00257072 -0.01643634
0.01986247 -0.00385519 -0.01950231 0.00610834 -0.02109969 0.00664145
0.02009682 -0.02585024 -0.00133253 -0.013423 -0.01406237 0.00136964
0.02389123 0.01107433 -0.00929427 -0.03070225 -0.0288392 0.01359287
0.03566917 -0.01038613 -0.00728933 -0.003206 -0.0124626 -0.0069914
0.01254949 0.01330607 -0.02258673 0.01434882 0.01233168 -0.01739984
0.01056742 -0.01380585 0.03416411 -0.03974034 0.01066058 -0.01392773
-0.0051558 -0.00660082 -0.02490552 -0.02611892 -0.02734245 -0.02488884
0.03166493 -0.00260078 -0.02531777 -0.00213909 0.01117923 0.01105575
0.01196994 -0.00207141 0. 0.0005181 -0.02678013 0.0309168
-0.00569217 -0.01885857 0.01937743 -0.02467972 -0.00319489 -0.00160128
-0.03866526 0.00994482 -0.03183733 -0.00512091 -0.03482664 -0.05587359
0.03014675 -0.00913241 0.00305343 0.00486618]
Calculate Annualize Daily Log Return
Create a function that returns the daily rate of return
step 1. define a function named annualize_log_return
step 2. create parameter for daily_log_returns
step 3. use np.mean() with the argument daily_log_returns to calculate the average daily return. Then set it to the variable name average_daily_log_returns
step 4. then multiply average_daily_log_returns by 250 and set it to the variable annualized_log_return
step 5. return annualized_log_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
Call the function annualize_log_return with the arguments daily_log_returns. Set it to the variable annualized_log_return_sbra. Then print the results.
annualized_log_return_sbra = annualize_log_return(daily_log_returns_sbra)
print(annualized_log_return_sbra)
-0.054885742513678615
Calculate Variance of Daily Log Returns
Calculate the variance of the daily logarithmetic return. Use the function .var() with the argument log_daily_ror. Set it to the variable daily_varaince_sbra. Then print the results.
daily_varaince_sbra = np.var(daily_log_returns_sbra)
print(daily_varaince_sbra)
0.00026836195613099464
Calculate Standard Deviation
Calculate the Standard Deviation of the daily logarithmetic return. Use the function .std() with the argument daily_log_returns_sbra. Set it to the variable daily_sd_sbra. Then print the results.
daily_sd_sbra = np.std(daily_log_returns_sbra)
print(daily_sd_sbra)
0.016381756808443795
Load EQR Data
Load the adjusted closings for EQR
adj_closings_eqr = np.loadtxt(“EQR.csv”, skiprows=1, usecols=5, delimiter=‘,’)
print(adj_closings_eqr)
[60.47094 60.785145 59.737785 59.69017 60.09008 59.366444 58.519035
58.042961 57.528797 57.766834 57.938221 57.557369 57.576412 58.25243
58.833241 58.499992 58.280998 58.595207 58.280998 57.671623 58.661854
57.443108 57.081291 55.272205 54.948479 54.139149 52.615715 53.939201
53.901115 54.262936 53.958241 55.138905 55.196041 54.881824 53.196526
53.482162 54.262936 54.396236 53.158443 53.539295 53.624992 53.282219
53.767815 54.167717 55.062733 55.481682 56.662346 56.652824 56.529049
56.690907 56.862297 57.347885 57.433582 57.385979 57.252682 56.890862
56.074154 56.669872 57.025375 59.13921 59.206463 58.649181 59.907871
60.676544 60.811054 60.580456 59.859833 60.24416 60.080822 59.043129
59.235291 59.264114 59.984741 59.552368 58.322498 57.755608 58.043861
58.332108 57.947781 58.735661 59.523544 59.292942 59.782963 59.100777
59.187248 59.667667 60.051998 59.706097 60.10965 60.445938 60.10004
59.850227 58.610756 57.890129 57.400108 57.294415 57.928562 58.053467
59.331371 58.802917 59.340984 59.437069 61.320293 61.483639 61.329906
62.079353 61.512459 61.810322 61.598942 62.069744 61.531685 61.695023
60.724579 61.253036 60.993614 59.975132 59.581192 60.20573 60.397903
61.173222 61.696571 61.086002 60.756485 61.347672 61.725643 61.512432
61.638416 62.365288 62.791721 62.559124 62.869247 62.869247 63.121223
62.510662 62.442822 61.890404 62.074543 62.30714 61.270142 61.279835
61.541504 62.617268 62.510662 62.055157 61.803177 63.411976 63.877186
63.935322 64.846336 64.933556 64.846336 64.497437 64.82695 63.925632
64.303596 64.545891 65.088631 65.311523 65.757339 65.660423 64.914177
64.836639 64.797874 65.350296 65.398758 65.834869 65.82518 65.573204
65.660423 64.952942 65.350296 65.893021 65.166153 65.708885 65.902718
65.670113 66.038399 65.737953 66.290375 65.679802 64.943253 65.82518
66.128029 64.574722 64.711487 63.490334 63.451248 64.731033 64.516106
64.711487 63.851795 63.461025 63.392643 63.793179 64.037407 63.197254
61.41925 61.223866 61.526714 62.894405 62.591557 62.923717 63.373104
62.073792 62.26918 63.920177 64.535629 63.343788 64.691948 64.262108
63.461025 63.324253 62.953026 64.15464 64.985023 65.913109 65.747025
65.922874 66.460175 66.56765 67.17334 66.215942 67.759491 67.798569
67.945114 67.896263 67.515259 67.847412 68.23819 68.599648 68.648491
69.605881 70.221344 69.12719 70.973579 70.01619 69.859886 69.77195
67.896263 68.404259 68.326111 66.176872 66.743484 66.655571 66.548111
65.6884 62.210564 63.910404 64.535629 64.711487 65.016823]
Calculate Simple Rate of Return EQR
Call the function simple_rate_of_return with the arguments adj_closings_eqr. Then print the results.
daily_simple_returns_eqr = simple_rate_of_return(adj_closings_eqr)
print(daily_simple_returns_eqr)
[ 0.00519597 -0.01723053 -0.00079707 0.00669976 -0.01204252 -0.01427421
-0.00813537 -0.00885834 0.0041377 0.00296688 -0.00657342 0.00033085
0.01174123 0.00997059 -0.0056643 -0.00374349 0.00539128 -0.00536237
-0.01045581 0.01717016 -0.02077578 -0.0062987 -0.03169315 -0.00585694
-0.01472889 -0.02813923 0.02515382 -0.00070609 0.00671268 -0.00561516
0.02188107 0.00103622 -0.00569275 -0.03070776 0.00536945 0.01459877
0.00245656 -0.02275512 0.00716447 0.00160064 -0.00639204 0.00911366
0.00743757 0.01652305 0.00760858 0.02128025 -0.00016805 -0.0021848
0.00286327 0.00302324 0.00853972 0.00149434 -0.00082884 -0.00232281
-0.0063197 -0.0143557 0.01062375 0.00627323 0.03706832 0.0011372
-0.00941252 0.02146134 0.01283092 0.00221684 -0.00379204 -0.0118953
0.00642045 -0.00271127 -0.01727162 0.0032546 0.00048658 0.01215958
-0.00720805 -0.02065191 -0.00971992 0.00499091 0.00496602 -0.0065886
0.01359638 0.01341405 -0.00387413 0.00826441 -0.01141104 0.00146311
0.00811693 0.00644119 -0.00576002 0.00675899 0.00559458 -0.00572244
-0.00415662 -0.02070955 -0.01229513 -0.00846467 -0.00184134 0.01106822
0.00215619 0.02201254 -0.00890682 0.00915035 0.0016192 0.03168433
0.00266382 -0.00250039 0.01221993 -0.00913176 0.00484232 -0.00341982
0.00764302 -0.00866862 0.00265453 -0.0157297 0.00870252 -0.00423525
-0.01669817 -0.00656839 0.01048213 0.00319194 0.01283685 0.0085552
-0.00989632 -0.00539431 0.00973043 0.00616113 -0.00345417 0.00204811
0.01179252 0.00683767 -0.00370426 0.00495728 0. 0.00400794
-0.00967283 -0.00108525 -0.00884678 0.00297524 0.00374706 -0.01664333
0.0001582 0.00427007 0.0174803 -0.0017025 -0.00728684 -0.00406058
0.02603101 0.00733631 0.00091012 0.01424899 0.00134503 -0.00134322
-0.0053804 0.00510893 -0.01390345 0.00591256 0.00376799 0.00840859
0.00342444 0.00682599 -0.00147384 -0.01136523 -0.00119447 -0.00059789
0.00852531 0.00074157 0.00666849 -0.00014717 -0.00382796 0.0013301
-0.01077485 0.00611757 0.00830486 -0.01103103 0.00832843 0.00294988
-0.00352952 0.00560812 -0.00454957 0.0084034 -0.00921058 -0.01121424
0.01357996 0.00460081 -0.02348939 0.00211793 -0.01887073 -0.00061562
0.02016958 -0.00332031 0.00302841 -0.013285 -0.00611995 -0.00107754
0.00631834 0.00382843 -0.01311972 -0.0281342 -0.00318115 0.00494657
0.02222922 -0.00481518 0.00530679 0.00714177 -0.02050258 0.00314767
0.02651387 0.00962845 -0.01846795 0.02128322 -0.00664441 -0.01246587
-0.00215521 -0.00586232 0.01908747 0.01294346 0.01428154 -0.00251974
0.00267463 0.00815045 0.00161713 0.00909886 -0.01425265 0.02331084
0.00057672 0.00216148 -0.00071898 -0.00561156 0.00491967 0.00575966
0.005297 0.000712 0.01394626 0.00884211 -0.0155815 0.02671003
-0.01348937 -0.0022324 -0.00125875 -0.02688311 0.00748194 -0.00114244
-0.0314556 0.00856208 -0.00131718 -0.00161217 -0.01291864 -0.05294445
0.02732398 0.00978284 0.00272498 0.00471842]
Calculate Average Daily Return EQR
Use np.mean() with the argument daily_simple_returns_eqr to calculate the average daily return. Then set it to the variable name average_daily_simple_return_eqr
average_daily_simple_return_eqr = np.mean(daily_simple_returns_eqr)
print(average_daily_simple_return_eqr)
0.0003603686312168377
Calculate Daily Log Returns EQR
Call the function log_returns with the arguments adj_closings_eqr. Set it to the variable daily_log_returns_eqr. Then print the results.
daily_log_returns_eqr = log_returns(adj_closings_eqr)
print(daily_log_returns_eqr)
[ 0.00518251 -0.0173807 -0.00079738 0.00667742 -0.01211562 -0.01437706
-0.00816864 -0.0088978 0.00412916 0.00296248 -0.00659512 0.0003308
0.01167284 0.00992121 -0.0056804 -0.00375051 0.0053768 -0.0053768
-0.01051086 0.01702442 -0.02099464 -0.00631862 -0.03220625 -0.00587416
-0.01483844 -0.02854273 0.02484267 -0.00070634 0.00669025 -0.00563098
0.02164511 0.00103568 -0.00570901 -0.03118913 0.00535508 0.01449324
0.00245354 -0.02301802 0.00713893 0.00159936 -0.00641255 0.00907238
0.00741005 0.01638803 0.00757978 0.02105699 -0.00016806 -0.00218719
0.00285918 0.00301868 0.00850346 0.00149322 -0.00082918 -0.00232552
-0.00633976 -0.01445974 0.01056772 0.00625363 0.03639781 0.00113655
-0.0094571 0.02123429 0.0127493 0.00221438 -0.00379925 -0.01196662
0.00639993 -0.00271495 -0.01742251 0.00324932 0.00048647 0.01208625
-0.00723415 -0.02086814 -0.00976747 0.0049785 0.00495373 -0.0066104
0.01350478 0.01332488 -0.00388165 0.00823044 -0.01147665 0.00146204
0.00808417 0.00642054 -0.00577668 0.00673625 0.00557898 -0.00573887
-0.00416528 -0.020927 -0.01237134 -0.0085007 -0.00184304 0.01100741
0.00215387 0.02177376 -0.00894673 0.00910873 0.00161789 0.03119274
0.00266027 -0.00250352 0.01214587 -0.00917371 0.00483063 -0.00342568
0.00761396 -0.00870641 0.00265102 -0.01585472 0.00866487 -0.00424425
-0.01683916 -0.00659006 0.01042758 0.00318686 0.01275516 0.00851881
-0.00994561 -0.00540891 0.0096834 0.00614223 -0.00346015 0.00204601
0.01172353 0.0068144 -0.00371114 0.00494503 0. 0.00399993
-0.00971992 -0.00108584 -0.00888615 0.00297083 0.00374006 -0.01678338
0.00015819 0.00426098 0.01732928 -0.00170395 -0.00731352 -0.00406885
0.02569797 0.00730953 0.00090971 0.01414843 0.00134412 -0.00134412
-0.00539492 0.00509593 -0.014001 0.00589515 0.0037609 0.00837344
0.00341859 0.0068028 -0.00147493 -0.01143031 -0.00119518 -0.00059807
0.00848918 0.0007413 0.00664635 -0.00014718 -0.0038353 0.00132922
-0.01083332 0.00609893 0.00827056 -0.01109232 0.00829394 0.00294553
-0.00353576 0.00559245 -0.00455995 0.00836828 -0.00925326 -0.01127759
0.01348858 0.00459026 -0.02376966 0.00211569 -0.01905105 -0.00061581
0.01996887 -0.00332583 0.00302383 -0.01337403 -0.00613876 -0.00107812
0.00629846 0.00382112 -0.01320655 -0.02853755 -0.00318622 0.00493437
0.02198575 -0.00482681 0.00529275 0.00711639 -0.02071567 0.00314273
0.02616847 0.00958239 -0.01864062 0.0210599 -0.00666659 -0.01254422
-0.00215754 -0.00587957 0.01890759 0.01286041 0.01418052 -0.00252292
0.00267106 0.00811741 0.00161583 0.00905772 -0.01435519 0.02304329
0.00057655 0.00215914 -0.00071924 -0.00562736 0.00490761 0.00574314
0.00528302 0.00071175 0.01384991 0.00880325 -0.01570417 0.02635954
-0.01358118 -0.00223489 -0.00125954 -0.02725107 0.00745409 -0.0011431
-0.03196096 0.00852564 -0.00131805 -0.00161347 -0.01300281 -0.05439753
0.02695734 0.00973529 0.00272127 0.00470732]
Calculate Annualize Daily Log Return EQR
Call the function annualize_log_return with the arguments daily_log_returns_eqr. Set it to the variable annualized_log_return_eqr. Then print the results.
annualized_log_return_eqr = annualize_log_return(daily_log_returns_eqr)
print(annualized_log_return_eqr)
0.07248313273073137
Calculate Variance of Daily Log Returns
Calculate the variance of the daily logarithmetic return. Use the function .var() with the argument daily_log_returns_eqr. Set it to the variable daily_varaince_eqr. Then print the results.
daily_varaince_eqr = np.var(daily_log_returns_eqr)
print(daily_varaince_eqr)
0.0001409887171232902
Calculate Standard Deviation
Calculate the Standard Deviation of the daily logarithmetic return. Use the function .std() with the argument daily_log_returns_eqr. Set it to the variable daily_sd_eqr. Then print the results.
daily_sd_eqr = np.std(daily_log_returns_eqr)
print(daily_sd_eqr)
0.011873866982718402
Calculate the Correlation between SBRA and EQR
Calculate the Correlation of the daily logarithmetic return between SBRA and ERQ assets. Use the function .corrcoef() with the arguments daily_log_returns_sbra and daily_log_returns_eqr. Set it to the variable corr_sbra_eqr. Then print the results.
corr_sbra_eqr = np.corrcoef(daily_log_returns_sbra,daily_log_returns_eqr)
print(corr_sbra_eqr)
[[1. 0.6738194]
[0.6738194 1. ]]
The dates have to be equivalent for corrcoef to work. The dates are for all of 2018 for EBR and SBRA