In this video, we discuss how to estimate systematic and unsystematic risk i.e. idiosyncratic risk in Stata.
Facebook : https://www.facebook.com/thedatahall/
Download exercise files:
https://payhip.com/b/dZGmA
How to Estimate Beta Using DCAPM (Downside CAPM) in Stata
https://www.youtube.com/watch?v=GMblJumx2YU
Estimate Rolling Beta in Stata | Rolling Vs Asreg command
https://www.youtube.com/watch?v=YdpVfrrGyjs
How to estimate weekly, monthly and yearly beta in stata | Statsby
https://www.youtube.com/watch?v=99NI2Uvna9g
00:00 Systematic Risk
2:34 Idiosyncratic risk
Show More Show Less View Video Transcript
0:00
Welcome to the Data Hall YouTube channel
0:02
In this video, we are going to talk about how do we execute or estimate systematic
0:06
and unsystematic risk in Stata. So we have already covered different videos related to systematic risk
0:14
For example, how do we estimate weekly, yearly or monthly systematic risk in Stata
0:20
In this video, although we would cover this systematic risk calculation, but our main focus
0:24
is on the unsystematic risk because that is what we haven't covered in, in fact
0:29
So let's load this data set. This is an example data set where I have the symbol code that is kind of a ticker that represents
0:38
different firms. We have date, stock return, market return and the risk free rate
0:44
Let me show you the data. We have different stocks, their dates, their stock returns, market returns and the risk free rate
0:53
So what we need to do is let's first discuss how do we calculate the systematic risk
1:00
First we generate the RIRF because we are going to apply the CAPM model to calculate systematic risks
1:06
So for CAPM model we need the excess stock return and the excess market return
1:11
So first we need to calculate the excess stock return and then we calculate the excess market return
1:17
We generate this year variable, we extract ear from the date variable and store that in this
1:23
year variable. Let me show you this data So we have this ear over here stock return and access market return Next what we need to do is we need to use the stats by command
1:36
And what started by command would do is it would execute regression
1:40
for each symbol each year. And it would guest us the betas, the systematic risk my year
1:48
Save them in this file that is called beta. This would be in stata format
1:54
And this is the regression model that we are going to apply. So regress excess stock return on excess market return
2:02
So let me execute this command and what it would do is it would generate a beta
2:07
Dottf file in our working directory. Let me show you this file
2:12
So this is how the file looks like. We have this stock where we have its different ears, its systematic risk, that is its beta and we have its constant
2:23
So we do not require constant what we are interested in is the measure of systematic risk
2:28
So this way we would get the systematic risk of different firms for different years
2:34
Let's move to the second task which is to calculate the idiosyncratic risk
2:39
Now for idiosyncratic risk, the measure that is used in different researches is that they take
2:44
the standard division of the residual for each firm or each symbol and that is considered as a measure of
2:52
unsystematic risk Now what we need to do is we first need to calculate standard deviation So what we are going to do is let create this empty variable that would contain the residuals
3:04
Now this is, it doesn't contain currently anything, but we are going to
3:08
we are going to populate it with the residuals. Now what we are going to do is we are going to look into the, we are going to use loop
3:16
We are going to take the unique values of each, a list of each, a list of symbols
3:24
So what we do is for that we use the levels of command and tell it to take all the levels or the unique values of the symbol code variable and save that in this level's local levels variable
3:37
And what we would do is we would iterate through each value of that local levels variable, regress stock, excess stock return on excess market return if the symbol is equal to that return
3:50
So let's just say if I can show you the data, in the first instance
3:54
it would take this specific firm, right? And it would regress access return on market return
4:04
if the symbol code is equal to this form. It would then move on to the second firm, right
4:14
Let's say this one and so on and so forth. So this loop would iterate through each firm
4:20
We would execute the regression, predict the residuals and save those residuals This is how this command would work right Okay so let me execute this command So it is going to execute regression for each of these firms
4:37
for each of these symbols and calculate its residuals. So now we have the residuals
4:43
What we need to do is we need to take the standard deviation, this idiosyncratic volatility on systematic risk would be the standard deviation
4:51
of residual for each firm each. year if I execute this now we have idiosyncratic risk but you can see it is these are
5:00
duplicate values for each firm each year so what we need is we need to drop the duplicate values
5:07
let's just keep the simple ear and endosyncratic risk these are the variables that we need
5:12
so we do not have clutter and we are going to duplicate drop so you can see that in 2011 we have
5:20
these values but for the same parish for different years we have different values and
5:26
that is because it was daily data and now it is converted into an yearly standard
5:31
deviation for each firm so we are going to drop the duplicate value now we just
5:36
have one value for each firm each year and that is the mayor of idiosyngratic risk
5:41
and you can save that merges with your other data set perform certain
5:46
ysis on them or whatever you want to do it with So thanks for watching this video. I hope it was useful. Do subscribe to this channel and do hit the bell icon
#Business Finance
#Risk Management


