[R] Status of the "bs" Package

krusty the klown alessandrobarbiero at libero.it
Tue Nov 9 14:48:48 CET 2010


Perhaps there's a problem with the function rbs, that generates a random
sample from the Birnbaum-Saunders distribution.
The rgbs function (package gbs)  does it better.
Look at these code and results:
> library(bs)
> set.seed(1)
> alpha<-0.17
> beta<-130
> x<-rbs(n=1000,alpha,beta)
> # sample mean
> mean(x)
[1] 150.8288
> # expected value
> beta*(1+alpha^2/2)
[1] 131.8785
> est1bs(x)
$beta.start
[1] 149.9556

$alpha
[1] 0.1079173

$beta
[1] 149.9558

$converge
[1] "TRUE"

$iteration
[1] 2

> #not fine
> library(gbs)
> #
> set.seed(1)
> x<-rgbs(n=1000,alpha,beta)
> # sample mean
> mean(x)
[1] 131.7481
> # expected value
> beta*(1+alpha^2/2)
[1] 131.8785
> est1bs(x)
$beta.start
[1] 129.7422

$alpha
[1] 0.1758475

$beta
[1] 129.7421

$converge
[1] "TRUE"

$iteration
[1] 2

> #fine


-- 
View this message in context: http://r.789695.n4.nabble.com/Status-of-the-bs-Package-tp827806p3033734.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list