[R-SIG-Finance] Returns used to compute the alpha and the beta

Benoit Schmid Benoit.Schmid at unige.ch
Thu Oct 30 14:20:28 CET 2008


Good morning Patrick,

>> x <- numeric(100)
>> x[1] <- 100
>>
>> set.seed(123)
>> for (i in 2:100) {
>> x[i] <- x[i-1] + rnorm(1,1,1) - 0.009*i*rnorm(1,1,1)^2
>> }
>>
>> x1 <- c(x[-1],0)
>> ret <- x1/x - 1
>>
>> #arithmetic mean of net returns:
>> amean <- mean(ret[-100])*25000 ; amean
>>
>> #arithmetic mean of log returns:
>> amean2 <- mean(diff(log(x)))*25000 ; amean2
>>
>> #geometric mean of net returns:
>> gmean<- ((prod(1+ret[-100]))^(1/length(ret[-100]))-1)*25000; gmean
>>
>>   
> 
> 'amean' is pretty much nonsense. 'amean2' and 'gmean'
> should be equivalent except one is a log return and the
> other is a simple return.  If you transform one return into
> the other form, then you should get the same number.
> 

You should get close numbers but not the exact same numbers 
as Adams says.

Again this is because the exponential of an esperance is 
not the esperance of an exponential.
This is the property that you should have in order to have
the exact match.

> r = log return
> R = simple return
> 
> r = log(R + 1)
> R = exp(r) - 1
> 
> 
> 
> Patrick Burns
> patrick at burns-stat.com
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
>



More information about the R-SIG-Finance mailing list