Calculating Valuation Multiples
Using the Pharmaceuitcal firms you have identified in the prior exercise (the data of which is stored in the pharma
data object), calculate the P/LTM EPS, P/NTM EPS, and P/BVPS for the comparable companies. P is the market price of the stock, EPS is earnings per share, and BVPS is book value of equity per share.
Note that, in practice, there are times when the EPS or BVPS is not populated from the commonly used databases. Therefore, you have to make sure your code is adequately flexible to only calculate multiples when the EPS or BVPS is positive. If the EPS or BVPS is not positive (i.e., less than or equal to 0), your code should set the value of that multiple equal to NA.
For this exercise, you should use the ifelse()
argument to set non-positive values equal to NA
. Otherwise, for positive values, we can calculate the valuation multiple.
This exercise is part of the course
Equity Valuation in R
Exercise instructions
- Calculate P/LTM EPS.
- Calculate P/NTM EPS.
- Calculate P/BVPS.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Calculate P/LTM EPS
pharma$ltm_p_e <- ifelse(___, ___, ___)
# Calculate P/NTM EPS
pharma$ntm_p_e <- ifelse(___, ___, ___)
# Calculate P/BVPS
pharma$p_bv <- ifelse(___, ___, ___)
pharma