[R] Return values in fExtremes package

David Scott d.scott at auckland.ac.nz
Thu Jan 7 23:17:25 CET 2010


Tim Smith wrote:
> Hi,
> 
> I was usuing the fExtemes package, and wanted to obtain some of the values returned from the function gumbelFit(). For example, in the following code, I would like to access 'mu' and 'beta' from the object 'para'. How should I go about doing this? Is there any generic method to access the object?
> -----------------------------------
>  >library("fExtremes") 
>  >ss <- gumbelSim(model = list(mu = 0, beta = 1), n = 1000, seed = NULL)
>> para <- gumbelFit(ss)
>> print(para)
> 
> Title:
>  Gumbel Parameter Estimation 
> 
> Call:
>  gumbelFit(x = ss)
> 
> Estimation Type:
>   gum mle 
> 
> Estimated Parameters:
>          mu        beta 
> 0.005449572 1.010874131 
> 
> Description
>   Thu Jan 07 13:14:28 2010 
> 
>> class(para)
> [1] "fGEVFIT"
> attr(,"package")
> [1] "fExtremes"
> -----------------------------------

You could track back through the functions gumbelFit and .gevFit to see 
what is returned by gumbelFit, or spend some time reading documentation, 
but as in many such cases str is your friend:

 > ss <- gumbelSim(model = list(mu = 0, beta = 1), n = 1000, seed = NULL)
 > para <- gumbelFit(ss)
 > str(para)
Formal class 'fGEVFIT' [package "fExtremes"] with 8 slots
   ..@ call       : language gumbelFit(x = ss)
   ..@ method     : chr [1:2] "gum" "mle"
   ..@ parameter  :List of 3
   .. ..$ block : num 1
   .. ..$ type  : chr "mle"
   .. ..$ gumbel: logi TRUE
   ..@ data       :List of 2
   .. ..$ x          :Time Series:
  Name:               object
Data Matrix:
  Dimension:          1000 1
  Column Names:       GUMBEL
  Row Names:           ...
Positions:
  Start:
  End:
With:
  Format:             counts
  FinCenter:
  Units:              GUMBEL
  Title:              Signal Series Object
  Documentation:      Fri Jan 08 11:12:09 2010
   .. ..$ blockmaxima:Time Series:
  Name:               object
Data Matrix:
  Dimension:          1000 1
  Column Names:       GUMBEL
  Row Names:           ...
Positions:
  Start:
  End:
With:
  Format:             counts
  FinCenter:
  Units:              GUMBEL
  Title:              Signal Series Object
  Documentation:      Fri Jan 08 11:12:32 2010
   ..@ fit        :List of 8
   .. ..$ n         : int 1000
   .. ..$ data      : num [1:1000] 1.134 0.215 2.011 -0.352 5.048 ...
   .. ..$ par.ests  : Named num [1:2] 0.0352 0.9929
   .. .. ..- attr(*, "names")= chr [1:2] "mu" "beta"
   .. ..$ par.ses   : Named num [1:2] 0.0331 0.0244
   .. .. ..- attr(*, "names")= chr [1:2] "mu" "beta"
   .. ..$ varcov    : num [1:2, 1:2] 0.001094 0.000254 0.000254 0.000597
   .. .. ..- attr(*, "dimnames")=List of 2
   .. .. .. ..$ : chr [1:2] "mu" "beta"
   .. .. .. ..$ : chr [1:2] "mu" "beta"
   .. ..$ converged : int 0
   .. ..$ nllh.final: num 1567
   .. ..$ llh       : num 1567
   ..@ residuals  : num [1:1000] 0.718 0.434 0.872 0.228 0.994 ...
   ..@ title      : chr "Gumbel Parameter Estimation"
   ..@ description: chr "Fri Jan 08 11:12:32 2010"
 > para at fit$par.ests
         mu       beta
0.03515609 0.99286204
 >



David Scott



_________________________________________________________________
David Scott	Department of Statistics
		The University of Auckland, PB 92019
		Auckland 1142,    NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email:	d.scott at auckland.ac.nz,  Fax: +64 9 373 7018

Director of Consulting, Department of Statistics



More information about the R-help mailing list