Exercise

# Weighted average (1)

As a finance professional, there are a number of important calculations that you will have to know. One of these is the *weighted average*. The weighted average allows you to calculate your *portfolio return* over a time period. Consider the following example:

Assume you have 40% of your cash in Apple stock, and 60% of your cash in IBM stock. If, in January, Apple earned 5% and IBM earned 7%, what was your total portfolio return?

To calculate this, take the return of each stock in your portfolio, and multiply it by the weight of that stock. Then sum up all of the results. For this example, you would do:

`6.2 = 5 * .4 + 7 * .6`

Or, in variable terms:

`portf_ret <- apple_ret * apple_weight + ibm_ret * ibm_weight`

Instructions

**100 XP**

- Weights and returns for Microsoft and Sony have been defined for you.
- Calculate the
`portf_ret`

for this porfolio.