Test functions.
test.tsal.quantile.transform(from=0, to=1e6, shape=1, scale=1,
q=tsal.q.from.shape(shape), kappa=tsal.kappa.from.ss(shape,scale),
n=1e5, lwd=0.01, xmin=0, ...)test.tsal.LR.distribution(n=100, reps=100, shape=1, scale=1,
q=tsal.q.from.shape(shape), kappa=tsal.kappa.from.ss(shape,scale),
xmin=0,method="mle.equation",...)
plot.tsal.quantile.transform
plots the relative error in the transformation.
plot.tsal.LR.distribution
plots the likelihood ratio against a
chi-square distribution and returns the result of Kolmgorov-Smirnov
test against theoretical distribution.
lower limit for x
.
upper limit for x
.
shape parameters.
scale parameters. If we have both shape/scale and q/kappa parameters, the latter over-ride.
number of points at which to evaluate the function over the domain or number of sample points.
line width.
minimum x-value (left-censoring threshold).
further arguments to be passed to curve
or plot
,
except xlim
for test.tsal.LR.distribution
.
number of replicates.
estimation method, see tsal.fit
.
Cosma Shalizi (original R code), Christophe Dutang (R packaging)
plot.tsal.quantile.transform
check the accuracy of quantile/inverse quantile transformations
For all parameter values and all x
, qtsal(ptsal(x))
should = x
.
This function displays the relative error in the transformation, which is due
to numerical imprecision. This indicates roughly how far off random variates
generated by the transformation method will be.
If everything is going according to plan, the curve plotted should oscillate
extremely rapidly between positive and negative limits which, while growing,
stay quite small in absolute terms, e.g., on the order of 1e-5 when
x
is on the order of 1e9.
plot.tsal.LR.distribution
checks likelihood ratio estimation accuracy :
\( 2*[(Likelihood at estimated parameters) - (likelihood at true parameters)]\)
should have a chi square distribution with 2 degrees of freedom, at least
asymptotically for large samples.
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