Difference between revisions of "Example function"
Jhernandez3 (talk | contribs) m |
Jhernandez3 (talk | contribs) m |
||
Line 2: | Line 2: | ||
<breadcrumbs>Analytica User Guide > {{PAGENAME}}</breadcrumbs><br /> | <breadcrumbs>Analytica User Guide > {{PAGENAME}}</breadcrumbs><br /> | ||
− | The following function, Capm(), computes the expected return for a stock under the capital asset pricing model. | + | The following function, [http://wiki.analytica.com/index.php?title=Capm Capm](), computes the expected return for a stock under the capital asset pricing model. |
::[[File:example_function_1.png|400px]] | ::[[File:example_function_1.png|400px]] | ||
Line 8: | Line 8: | ||
==Parameters== | ==Parameters== | ||
− | It has three parameters, rf, rm, and beta. The parameter qualifier Number says that it expects that the parameters are numbers. | + | It has three parameters, <code>rf</code>, <code>rm</code>, and <code>beta</code>. The parameter qualifier <code>Number</code> says that it expects that the parameters are numbers. |
==Description== | ==Description== | ||
Line 16: | Line 16: | ||
==Definition== | ==Definition== | ||
− | The definition is an expression that uses its parameters, rf, rm, and beta, and evaluates to the value to be returned. | + | The definition is an expression that uses its parameters, <code>rf</code>, <code>rm</code>, and <code>beta</code>, and evaluates to the value to be returned. |
==Sample usage== | ==Sample usage== | ||
− | You use the Capm() function in a definition in the same way you would use Analytica’s built-in functions. For example, if the risk free rate is 5%, the expected market return is 8%, and Stock-Beta is defined as the beta value for a given stock, we can find the expected return according to the capital asset pricing model as: | + | You use the [http://wiki.analytica.com/index.php?title=Capm Capm]() function in a definition in the same way you would use Analytica’s built-in functions. For example, if the risk free rate is 5%, the expected market return is 8%, and Stock-Beta is defined as the beta value for a given stock, we can find the expected return according to the capital asset pricing model as: |
− | Stock_return: Capm(5%, 8%, StockBeta) | + | :<code>Stock_return: Capm(5%, 8%, StockBeta)</code> |
− | The function works equally well when StockBeta is an array of beta values — or if any parameter is an array — the result is an array of expected returns. | + | The function works equally well when <code>StockBeta</code> is an array of beta values — or if any parameter is an array — the result is an array of expected returns. |
<footer>Building Functions and Libraries / {{PAGENAME}} / Call a function</footer> | <footer>Building Functions and Libraries / {{PAGENAME}} / Call a function</footer> |
Revision as of 09:19, 26 December 2015
The following function, Capm(), computes the expected return for a stock under the capital asset pricing model.
Parameters
It has three parameters, rf
, rm
, and beta
. The parameter qualifier Number
says that it expects that the parameters are numbers.
Description
The description says what the function returns and what its parameters mean.
Definition
The definition is an expression that uses its parameters, rf
, rm
, and beta
, and evaluates to the value to be returned.
Sample usage
You use the Capm() function in a definition in the same way you would use Analytica’s built-in functions. For example, if the risk free rate is 5%, the expected market return is 8%, and Stock-Beta is defined as the beta value for a given stock, we can find the expected return according to the capital asset pricing model as:
Stock_return: Capm(5%, 8%, StockBeta)
The function works equally well when StockBeta
is an array of beta values — or if any parameter is an array — the result is an array of expected returns.
Enable comment auto-refresher