[R] Beta stochastic simulation

Duncan Murdoch murdoch at stats.uwo.ca
Fri Sep 15 14:22:47 CEST 2006


On 9/15/2006 7:51 AM, Mark Pinkerton wrote:
> I have just installed 2.4.0 alpha and the problem persists. Here is the
> output of the run:

When I run it, I get a series of warning messages from qbeta.  Do you 
get those?

Duncan Murdoch

> 
>> # Summary stats
>> summary(totals.losses1)
>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
>         0         0      1284   1617000    685100 219200000 
>> mean(totals.losses1)
> [1] 1617219
>> sd(totals.losses1)/sqrt(length(totals.losses1))
> [1] 78863.17
>> 
>> summary(totals.losses2)
>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
>         0         0      1422   2417000    819200 118200000 
>> mean(totals.losses2)
> [1] 2417471
>> sd(totals.losses2)/sqrt(length(totals.losses2))
> [1] 134866.0 
> 
> Thanks,
> Mark
> 
> Mark Pinkerton
> Risk Management Solutions 
> Peninsular House
> 30 Monument Street
> London EC3R 8HB 
> UK 
>  
> www.RMS.com 
> Tel:  +44 20 7444 7783 
> Fax: +44 20 7444 7601
> 
> -----Original Message-----
> From: Duncan Murdoch [mailto:murdoch at stats.uwo.ca] 
> Sent: 15 September 2006 12:15
> To: Mark Pinkerton
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Beta stochastic simulation
> 
> On 9/15/2006 6:43 AM, Mark Pinkerton wrote:
>> Hi Duncan,
>> Thanks for having a look at this. Find attached a zip with all the 
>> relevant files to run the simulation. I am running this on Windows XP,
> 
>> R version 2.3.1.
> 
> Does the error still occur in a recent alpha build?  It's downloadable
> from CRAN, in cran.r-project.org/bin/windows/base/rtest.html  (though I
> notice the version there is a week old; I'd better kick the build
> script).
> 
> Duncan Murdoch
> '
>> 
>> The correct result for the average annual loss, calculated using a 
>> battle tested FFT engine, is 1,609,361 The summary stats from my last 
>> run are below:
>> 
>>> # Summary stats
>>> summary(totals.losses1)
>>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
>>         0         0      1142   1620000    698000 132500000 
>>> mean(totals.losses1)
>> [1] 1619891
>>> sd(totals.losses1)/sqrt(length(totals.losses1))
>> [1] 77949.25
>>> summary(totals.losses2)
>>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
>>         0         0      2352   2341000    749700 141700000 
>>> mean(totals.losses2)
>> [1] 2341237
>>> sd(totals.losses2)/sqrt(length(totals.losses2))
>> [1] 129695.9
>> 
>> Thanks,
>> Mark
>> 
>> Mark Pinkerton
>> Risk Management Solutions
>> Peninsular House
>> 30 Monument Street
>> London EC3R 8HB
>> UK
>>  
>> www.RMS.com
>> Tel:  +44 20 7444 7783
>> Fax: +44 20 7444 7601
>> 
>> -----Original Message-----
>> From: Duncan Murdoch [mailto:murdoch at stats.uwo.ca]
>> Sent: 15 September 2006 00:45
>> To: Mark Pinkerton
>> Cc: r-help at stat.math.ethz.ch
>> Subject: Re: [R] Beta stochastic simulation
>> 
>> On 9/14/2006 5:26 PM, Mark Pinkerton wrote:
>>> Hi Duncan,
>>> I had also validated the logic with a simple test which is why I was
>> surprised by the differences I was seeing from tthe more complex 
>> simulation. I am running R on a Windows 2000 - I'll have to check 
>> which version at my desk tomorrow but it's pretty up to date, maybe 6 
>> monthes old. Attached is a code snippet  from my simulation program 
>> which is used to estimate multi-event annual losses for US hurricanes.
> 
>> The event set being sampled from is quite large (~14000) with each 
>> event and account combination having a unique beta loss distribution. 
>> Simply swapping lines 23 and 24 has the effect on results that I 
>> mentioned in the previous email. The simulation is large enough that 
>> the MC error in the estimated means are negligible.
>> 
>> The code you sent isn't usable, because it's missing your data.  Could
> 
>> you please do the following?
>> 
>>   - verify that the behaviour still happens in the current alpha test 
>> version
>> 
>>   - try to simplify the example code so someone else can run it?  It 
>> could be that certain values of alpha and beta trigger a bug but the 
>> ones I tried were fine.
>> 
>> Duncan Murdoch
>> 
>> 
>> This message and any attachments contain information that may be RMS
> Inc. 
>> confidential and/or privileged.  If you are not the intended recipient
> 
>> (or authorized to receive for the intended recipient), and have 
>> received this message in error, any use, disclosure or distribution is
> strictly
>> prohibited.   If you have received this message in error, please
> notify 
>> the sender immediately by replying to the e-mail and permanently 
>> deleting the message from your computer and/or storage system.
> 
> 
> This message and any attachments contain information that may be RMS Inc. 
> confidential and/or privileged.  If you are not the intended recipient 
> (or authorized to receive for the intended recipient), and have received 
> this message in error, any use, disclosure or distribution is strictly 
> prohibited.   If you have received this message in error, please notify 
> the sender immediately by replying to the e-mail and permanently deleting 
> the message from your computer and/or storage system.



More information about the R-help mailing list