Description Usage Arguments Details Value Author(s) References See Also Examples
This function allows data to be fit to the inverse hyperbolic sine distribution using maximum likelihood estimation. This function uses the maxLik
package to perform its estimations.
1 2 3 4 
X.f 
A formula specifying the data, or the function of the data with parameters, that should be used in the maximisation procedure. 
mu.f, sigma.f, lambda.f, k.f 
formulas including variables and
parameters that specify the functional form of the parameters in the inverse hyperbolic sine loglikelihood function. 
data 
an optional data frame in which to evaluate the variables in 
start 
a named list or named numeric vector of starting estimates for every parameter. 
subset 
an optional vector specifying a subset of observations to be used in the fitting process. 
method 
A list of the methods to be used. May include "NR" (for NewtonRaphson), "BFGS" (for BroydenFletcherGoldfarbShanno), "BHHH" (for BerndtHallHallHausman), "SANN" (for Simulated ANNealing), "CG" (for Conjugate Gradients), or "NM" (for NelderMead). Lowercase letters (such as "nr" for NewtonRaphson) are allowed. The default method is the "BFGS" method. 
constraints 
either 
follow.on 
logical; if TRUE, and there are multiple methods, then the last set of parameters from one method is used as the starting set for the next. 
iterlim 
If provided as a vector of the same length as 
... 
further arguments that are passed to the selected maximisation routine in the 
The parameter names are taken from start
. If there is a name of a parameter or some data found on the righthand side of one of the formulas but not found in data
and not found in start
, then an error is given.
Below is a nonexhaustive list of further arguments that may be passed in to the ihs.mle
function (see maxLik
documentation for more details):
fixed
parameters that should be fixed at their starting values:
a vector of character strings indicating the names of the fixed
parameters (parameter names are taken from argument start
). May not be used in BHHH
algorithm.
print.level
a larger number prints more working information.
tol
, reltol
the absolute and relative convergence tolerance (see
optim
). May not be used in BHHH
algorithm.
finalHessian
how (and if) to calculate the final Hessian. Either
FALSE
(not calculate), TRUE
(use analytic/numeric
Hessian) or "bhhh"
/"BHHH"
for information equality
approach.
parscale
A vector of scaling values for the parameters.
Optimization is performed on 'par/parscale' and these should
be comparable in the sense that a unit change in any element
produces about a unit change in the scaled value. (see
optim
). May not be used in BHHH
algorithm.
Note that not all arguments may be used for every maximisation algorithm at this time. If multiple methods are supplied (i.e. length(method) > 1
), all arguments are employed for each method (except for iterlim
, which is allowed to vary for different methods).
If multiple methods are supplied, and some methods fail to initialise properly, a warning will be given. If every method fails to initialise, an error is given.
If only one method is specified, ihs.mle
returns a list of class "MLE"
.
If multiple methods are given, ihs.mle
returns a list of class "mult.MLE"
with each component containing the results of each maximisation procedure. Each component is a list of class "MLE"
.
A list of class "MLE"
has the following components:
parameters 
the names of the given parameters taken from 
maximum 

estimate 
estimated parameter value. 
gradient 
vector, last gradient value which was calculated. Should be close to 0 if normal convergence. 
gradientObs 
matrix of gradients at parameter value 
hessian 
Hessian at the maximum (the last calculated value if not converged). 
code 
return code:

message 
a short message, describing 
last.step 
list describing the last unsuccessful step if

fixed 
logical vector, which parameters are constants. 
iterations 
number of iterations. 
type 
character string, type of maximization. 
constraints 
A list, describing the constrained optimization
(

Carter Davis, carterdavis@byu.edu
Henningsen, Arne and Toomet, Ott (2011). "maxLik: A package for maximum likelihood estimation in R" Computational Statistics 26(3), 443458. DOI 10.1007/s0018001002171.
The maxLik
package and its documentation. The ihs.mle
simply uses its functions to maximize the inverse hyperbolic sine loglikelihood.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  ### Showing how to fit a simple vector of data to the inverse
### hyperbolic sine distribution.
require(graphics)
require(stats)
set.seed(123456)
x = rnorm(100)
X.f = X ~ x
start = list(mu = 0, sigma = 2, lambda = 0, k = 1)
result = ihs.mle(X.f = X.f, start = start)
sumResult = summary(result)
print(result)
coef(result)
print(sumResult)
### Comparing the fit
xvals = seq(5, 5, by = 0.05)
coefs = coef(result)
mu = coefs[1]
sigma = coefs[2]
lambda = coefs[3]
k = coefs[4]
plot(xvals, dnorm(xvals), type = "l", col = "blue")
lines(xvals, dihs(xvals, mu = mu, sigma = sigma,
lambda = lambda, k = k), col = "red")

Loading required package: maxLik
Loading required package: miscTools
Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443458. DOI 10.1007/s0018001002171.
If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's RForge site:
https://rforge.rproject.org/projects/maxlik/
Warning messages:
1: In log(k) : NaNs produced
2: In log(k) : NaNs produced
Maximum Likelihood estimation
BFGS maximization, 73 iterations
Return code 0: successful convergence
LogLikelihood: 140.6543 (4 free parameter(s))
Estimate(s): 0.01679615 0.9893086 0.7061181 14.32567
[1] 0.01679615 0.98930857 0.70611810 14.32567428

Maximum Likelihood estimation
BFGS maximization, 73 iterations
Return code 0: successful convergence
LogLikelihood: 140.6543
4 free parameters
Estimates:
Parameters Estimate Std. error t value Pr(> t)
1 mu 0.0168 0.09897 0.1697 8.652e01
2 sigma 0.9893 0.07119 13.8977 6.541e44
3 lambda 0.7061 3.00496 0.2350 8.142e01
4 k 14.3257 4.19566 3.4144 6.392e04

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.