Skip to contents

R6 class for the multilook Gamma law \(\Gamma(\mu, L)\); see dgammasar(). The maximum likelihood estimator of \(\mu\) is the sample mean and \(L\) solves \(\log L - \psi^{(0)}(L) = \log\bar z - \overline{\log z}\).

Super class

SARModel -> GammaSAR

Methods

Inherited methods


GammaSAR$new()

Create a Gamma model.

Usage

GammaSAR$new(mu = 1, L = 1)

Arguments

mu

Mean.

L

Number of looks.


GammaSAR$density()

(Log-)density.

Usage

GammaSAR$density(x, log = FALSE)

Arguments

x

Numeric vector of intensities.

log

Return log-densities?


GammaSAR$random()

Simulate intensities.

Usage

GammaSAR$random(n)

Arguments

n

Number of observations.


GammaSAR$fit()

Fit by maximum likelihood.

Usage

GammaSAR$fit(x, L = NULL)

Arguments

x

Numeric vector of positive intensities.

L

Known number of looks. If NULL (default) it is estimated.


GammaSAR$entropy()

Shannon entropy.

Usage

GammaSAR$entropy()


GammaSAR$entropy_variance()

Asymptotic variance of the entropy estimator (closed form).

Usage

GammaSAR$entropy_variance(n = self$n)

Arguments

n

Sample size.


GammaSAR$clone()

The objects of this class are cloneable with this method.

Usage

GammaSAR$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

set.seed(1)
z <- rgammasar(500, mu = 2, L = 4)
m <- GammaSAR$new()$fit(z)
m
#> <Gamma> fitted to n = 500 observations
#>   mu = 1.97692
#>   L = 3.86696
#>   logLik = -666.161
#>   Shannon entropy = 1.33232
m$entropy()
#> [1] 1.332323
m$entropy_variance()
#> [1] 0.001113651
generics::tidy(m)
#> # A tibble: 2 × 4
#>   term  estimate std.error fixed
#>   <chr>    <dbl>     <dbl> <lgl>
#> 1 mu        1.98    0.0450 FALSE
#> 2 L         3.87    0.235  FALSE