Learn R Programming

DiscreteInverseWeibull (version 1.0.2)

lossdiw: Loss function

Description

Quadratic loss function for the method of moments

Usage

lossdiw(x, par, eps = 1e-04, nmax=1000)

Arguments

x
a vector of sample values
par
a vector of parameters ($q$ and $\beta$)
eps
a tolerance error for the computation of first order moments
nmax
a first maximum value for the computation of first order moments

Value

the value of the quadratic loss function $L(x; q, \beta)=(E(X; q, \beta)-m_1)^2+(E(X^2; q, \beta)-m_2)^2$ where $m_1$ and $m_2$ are the first and second order sample moments.

See Also

Ediweibull

Examples

Run this code
n<-100
q<-0.5
beta<-2.5
x<-rdiweibull(n, q, beta)
# loss function computed on the true values
lossdiw(x, c(q, beta))
par<-estdiweibull(x, method="M")
# estimates of the parameters through the method of moments
par
# loss function computed on the estimates derived through
# the method of moments
lossdiw(x, par)
# it should be zero (however, smaller than before...)

Run the code above in your browser using DataLab