From octave-sources-request at bevo dot che dot wisc dot edu Mon Jan 27 14:06:56 2003 Subject: finance/capm.m From: Stefan Burger To: octave-sources at bevo dot che dot wisc dot edu Date: Mon, 27 Jan 2003 06:56:01 -0600 --------------Boundary-00=_5IIDQV5KEHCQQ62XQ4D4 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello,=20 Wanted to share some m-files I created with you.=20 Category: Finance,=20 Functions: =09capm, capital asset pricing method, =09wacc, weight-adjusted cost of capital, =09effir, =09effective interest rate, =09nomir, nominal interest rate capm.m attached,=20 rest will follow in separate mails.=20 Best regards,=20 Stefan Burger --------------Boundary-00=_5IIDQV5KEHCQQ62XQ4D4 Content-Type: text/plain; charset="us-ascii"; name="capm.m" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="capm.m" ## Copyright (C) 2003 Stefan Burger ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2, or (at your option) any ## later version. ## ## Octave is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- ## at deftypefn {Function File} {} capm (@var{r_riskfree}, @var{r_market}, @var{beta}) ## Calculate the equity cost according to CAPM capital asset pricing method. ## Inputs: ## at var{r_riskfree} : risk-free cost of capital, ## at var{r_market} : return on market index, ## at var{beta} : beta factor. ## ## Note: r_riskfree and r_market values are entered as fractions, ## e.g., 0.12 for an interest rate of 12%. ## at end deftypefn ## at seealso{wacc} ## Author: Stefan Burger ## Description: CAPM capital asset pricing method. function r = capm (r_riskfree, r_market, beta) if (nargin != 3) usage("capm (r_riskfree, r_market, beta)"); endif if(size(r_riskfree)!=size(r_market)) error("capm: r_riskfree and r_market have to be of same dimensions!"); elseif(!isscalar(beta)) if ( (!isscalar(r_riskfree)) && (size(beta)!=size(r_riskfree))) error("capm: if both, r_riskfree and beta, are not scalar, then they have to be of same dimensions!"); endif endif r = r_riskfree + (r_market - r_riskfree) * beta; endfunction --------------Boundary-00=_5IIDQV5KEHCQQ62XQ4D4--