Vous êtes sur la page 1sur 2

Functions on a Set of Numbers

Now we turn to the functionality that makes Excel quite powerful for more advanced problems.
We can apply a function to a large group of numbers that are all gathered in a single column or a
single row. So, for example, we can calculate the average of a group of numbers. We can
calculate it's standard deviation, it's minimum, it's maximum, and many other descriptive
statistics about that set of numbers, right?
We also have functions that allows us to perform analyses on sets of ordered pairs of
numbers. So here, we would have an array that consists of two rows, or two columns, and we can
pair the values in them and perform functions. That are functions on two variables. So let me
show you what I mean. What I've done here, is I've taken data that I've downloaded from Yahoo
Finance,
For the Standard and Poor's 500 index. Which is simply an index of 500 of the largest companies
that are traded on US stock exchange and then one particular large US company stock, Duke
Energy.
And I've taken data for the beginning of each month. For the closing price and I'm using
something here called the adjusted closing price which includes reinvestment of dividends, but in
any case I am looking at 176 months of price data which would give me 175 monthly return. I'm
going to calculate the continuously compounded or log monthly return. The way that I do that, is
It take the natural log of the ration of the two prices with the more recent price on top. So I'm
gonna take the natural log of the price in August,
Divided by the price in July.
Okay?
So, it started in 1930 and it went to 1925, so I have a small loss that month of -0.29%. Now we're
going to do our very clever trick, where we simply click on the handle and the data will fill in all
the way down for all 170 five returns.
Cool, eh? Not only that, but because we used relative references, both in the row direction and in
the column direction, I can take this formula and I can drag it over and you'll notice that the
relative references have moved one to the right. So they now refer to data in column C which are
the Duke Energy prices. And here Duke Energy's stock is slightly up for the month. Okay, so
now I have two time series of monthly returns
for the index and an individual stock. And something that I often might want to be able to do is
to look at how one stock did compared to its index or the universe. The larger market of which it
is a part.
So, first of all, I'm curious to know which performed better. The index or the stock? In order to
calculate the average of a series of values
that are all in one column or one row, what Excel calls an array.
I enter my function which in this case is average.
Then I enter the cell location of the first value I'm interested in.
I separate with a colon and I enter the cell value of the last cell that I'm interested in. And what
I've done is I have selected those two cells and all the cells in between to calculate their average.
Right, and again, because I've used relative references I should be able to drag And you see
here, I've calculated the value for the average return for Duke Energy stock.

So you see that Duke Energy has on average, performed quite a bit better than the S&P 500
Index over this time period.
>> This is my return for one month, so if I want to know my continuously compounded return
for 12 months or per one year, something multiplied by 12, so I'm going to say, equals G6 times
12.
And if I want the continuously compounded monthly return for
Duke Energy stock, I simply drag the formula. And again, you see that I'm indicating now
the value in, H6, okay?
Another thing that I'm typical interested in when I'm looking at financial return numbers would
be the, how spread out individual returns are and I usually use the standard deviation as my
metric to evaluate how spread out they are. And again Excel has a built in standard deviation
function so i'm going to say equals stdEV.p. StdEV.p stands for the population standard deviation
which is what I want here and i'm going to use the exact same range D4 to D178.
And my monthly standard deviation is, I'm gonna convert this to a percentage. So I go to
Formatting > Cells > Percentage, okay,
And again, I can just drag this over to calculate the monthly standard deviation for Duke Energy
stock.
If I want to annualize this value, the way standard deviations work Is that I would multiply the
standard deviation for one month, not by 12, but by the square root of 12. So, I'm going to take
my value for monthly standard deviation which is G10
times the square root of 12.
And Excel actually has a built in function for square roots.
And, similarly, I will drag this over.
And I will get the standard deviation for Duke Energy. So you see that Duke Energy has a
significantly better return than the S&P 500 index over this time interval.
But it is also quite a bit volatile or there's a much larger range of possible outcomes. Another
way of looking at the range of possible outcomes would be to look at the worst month and the
best month for each of these values and in Excel we have functions for minimum and maximum,
so let's take a look at the minimum of D4 to D178. And this tells us the worst month during this
time period I would have lost 18.5%, that's pretty bad, and.
My best month I would've gained 10.3% This is the average of the index as a whole.
The Duke Energy stock had a month where it lost 31% of it's value that's quite a lot worse.
But it also had a month where it gained 20.9% which is quite a lot better. So from a descriptive
statistics point of view I can already draw some conclusions. I can say Duke energy stock seems
to have been a much
higher paying investment than simply investing in the SMP 500 index over this time interval of a
little over 14 years. But, I would have had a higher standard deviation of returns. I would have
had bigger lows and bigger highs and so from a point of view of risk adjusted return, Duke
Energy stock is not a free deal. There's some cost to be paid for the higher return.

Vous aimerez peut-être aussi