Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
This morning, Mathieu had a nice experience in his course on computational method in actuarial science. But let us start with some mathematical formal definitions.
First, recall that
And it is a definition. Such a function exists only if
Now, this ‘power’ function appears also in complex analysis, when dealing with unit roots. From instance, if
Let us get back to Mathieu’s problem. Actually, in his course, he wanted to compute
you do get
It looks like this hat function can be used to define objects such as
you get
(meaning that this is a problem…). It is also possible to use the power (puissance in French) function of Excel,
Here, you also get
The weird part here is that, in the ‘help’ window, you can read that this power function can be used with any number in
Another point… what about
you get
(similarly with the power function). So clearly, it is not that simple to use this power function. Now, if you use Google (which is now my new online calculator when I am in class, when I cannot use R), if the power is a fraction (or to be more specific the inverse of an integer), then it works as Excel
you get
But if you type (which should be close, from a continuity property of the power function)
you get
and similarly
On Wolfram Mathworld, enter
Mathematica does recognize that we try to deal with unit roots: the result is here
with – as expected – a numerical approximation
With Matlab, Mathieu did obtain the same as Mathematica (its decimal approximation). And to conclude, with R, Mathieu did obtain
> (-8)^(1/3) [1] NaN > (-8)^(.333333333333333) [1] NaN
So for R, you cannot use this hat function on negative numbers.
Now, how can we interpret those outputs ?
1) My understanding is that clearly, with MS Excel,
which is problematic. For instance, in insurance, with monthly discounts, we do have functions like
2) The problem comes – probably (MS Excel is not an open software, so it might be hard to check) – from the fact that
3) There is still a problem with Google, and Mathematica. That is fine to return unit roots in
but one can also observe that , and similarly,
One can check with
With R, since we do not deal with power function here, but with roots, if we want to find
> polyroot(c(8,0,0,1)) [1] 1+1.732051i -2+0.000000i 1-1.732051i
Which is different… Weird isn’t it ?
Arthur Charpentier
Arthur Charpentier, professor in Montréal, in Actuarial Science. Former professor-assistant at ENSAE Paristech, associate professor at Ecole Polytechnique and assistant professor in Economics at Université de Rennes 1. Graduated from ENSAE, Master in Mathematical Economics (Paris Dauphine), PhD in Mathematics (KU Leuven), and Fellow of the French Institute of Actuaries.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.