Question

I obtained a fit for a stable distribution using the "fBasics" package:

>lstab

Title:
 Stable Parameter Estimation 

Call:
 .qStableFit(x = x, doplot = doplot, title = title, description = description)

Model:
 Stable Distribution

Estimated Parameter(s):
    alpha      beta     gamma     delta 
   0.8750    0.1260  299.7113 2917.4148 

Now R says to me that:

> class(lstab)
[1] "fDISTFIT"
attr(,"package")
[1] "fBasics"

How am I supposed to access the values of lstab? (Note: the function used for the fit was stableFit)

with fitdistr(), objects can be accessed using the $ sign, but there it doesn’t work:

> lstab$title
Error in lstab$title : $ operator not defined for this S4 class
Was it helpful?

Solution

str(lstab)
Formal class 'fDISTFIT' [package "fBasics"] with 6 slots
  ..@ call       : language .qStableFit(x = x, doplot = doplot, title = title, description = description)
  ..@ model      : chr "Stable Distribution"
  ..@ data       :'data.frame': 231635 obs. of  1 variable:
  .. ..$ x: num [1:231635] 2658 2789 3184 3033 2658 ...
  ..@ fit        :List of 1
  .. ..$ estimate: Named num [1:4] 0.875 0.126 299.711 2917.415
  .. .. ..- attr(*, "names")= chr [1:4] "alpha" "beta" "gamma" "delta"
  ..@ title      : chr "Stable Parameter Estimation"
  ..@ description: chr "Thu Apr 17 16:07:36 2014 by user: "

So for example:

> lstab@fit
$estimate
    alpha      beta     gamma     delta 
   0.8750    0.1260  299.7113 2917.4148 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top