Loglikelihood and fit functions.
tsal.loglik(x, shape, scale, q=tsal.q.from.shape(shape),
kappa=tsal.kappa.from.ss(shape,scale), xmin=0)tsal.fit(x, xmin=0, method=c("mle.equation", "mle.direct", "leastsquares"), ...)
#
# Note that this function ONLY works with the shape-scale parameterization
# Inputs: shape, scale, left-censoring threshold
tsal.fisher(shape, scale, xmin=0)
tsal.loglik
returns the loglikelihood as a numeric.
tsal.fit
returns NA
when estimation aborts
or a list with components (type
, q
, kappa
, shape
,
scale
, loglik
, n
, xmin
,
method
) when estimation succeeds.
vector of quantiles.
shape parameters.
scale parameters.
minimum x-value.
A character string for the estimation method:
"mle.equation"
(default), "mle.direct"
, "leastsquares"
.
further arguments to be passed to the estimation method.
Cosma Shalizi (original R code), Christophe Dutang (R packaging)
tsal.loglik
computes the loglikelihood of a sample x
.
tsal.fisher
calculates the Fisher information matrix, for asymptotic variances and
covariances of the maximum likelihood estimates of shape and scale
First row/column corresponds to shape, second to scale
Convergence to the asymptotic normal distribution can be slow, so for limited
data you should bootstrap.
tsal.fit
estimates parameters by solving maximum likelihood equations when
method="mle.equation"
, by minimizing the log-likelihood (directly) when
method="mle.direct"
, by minimizing the square difference between the
empirical and theoretical distribution functions.
This function is a wrapper for the actual methods:
tsal.fit.mle.equation
(solve maximum likelihood estimating equations);
tsal.fit.mle.direct
(numerical likelihood maximization); and
tsal.fit.leastsquares
(least-squares curve-fitting to the empirical
distribution);
prettying up the results in all cases.
Maximum Likelihood Estimation for q-Exponential (Tsallis) Distributions, http://bactra.org/research/tsallis-MLE/ and https://arxiv.org/abs/math/0701854.
#####
# (1) fit
x <- rtsal(20, 1/2, 1/4)
tsal.loglik(x, 1/2, 1/4)
tsal.fit(x, method="mle.equation")
tsal.fit(x, method="mle.direct")
tsal.fit(x, method="leastsquares")
Run the code above in your browser using DataLab