How to fit Weibull distribution using "MME" method and find the estimates in R I am trying to fit a Weibull distribution using Moments Matching Estimation (MME) method. Specifically I am trying to estimate the shape parameter $k$ and the
scale $\lambda$.
I am currently using R and the package fitdistrplus.  Below is the code used to fit the weibull distribution in R from the fitdistrplus and actuar package.
a <- rweibull(100, 10,1)
weibul_mme <- mmedist(a, "weibull", order = 1:2)

But I am getting the below error
Error in mmedist(a, "weibull", order = 1:2) : 
  the empirical moment function must be defined

It would be helpful if anyone can tell me what mistake I am making or provide some reading material for the same.
 A: The Weibull distribution is defined as 
$$f(x) = \left\{ \frac{k}{\lambda} \left( \frac{x}{\lambda} \right)^{k-1} \exp\left( - \frac{x}{\lambda}\right)^k \right\} \ \ \ \mbox{for} \ \  x\geq 0$$ 
and the raw moments are given as
$$m_j(\lambda,k) := \mathbb E[X^j] = \lambda^j \Gamma\left(1  +\frac{j}{k}\right),$$
where $\Gamma(.)$ is the Gamma function (Wiki on Weibull distribution). 
To estimate the parameters $\theta := (\lambda,k)$ using a random sample $\{x_i\}_{i=1}^n$ of draws from the Weibull distribution it is first noted that the raw moments are a function of the parameters $\theta$. Given a guess of parameters the raw moments can therefore be calculated and can be compared to the raw sample moments defined as
$$ \bar x^j := \frac{1}{n} \sum_i x_i^j.$$
By the Law of Large Numbers the sample moments should match the theoretical moments $m_j(\theta) = m_j(\lambda,k)$. This motivates the method of trying to find the correct parameters $\theta_0 = (\lambda_0,k_0)$ by minimizing sum of squared errors 
$$Q(\lambda,k) =  \sum_j \sum_i (m_j(\lambda,k) - x_i^j)^2.$$ 
This type of estimator can be justified within method of moments set up, general method of moments, extremum estimator (see for example Newey and McFadden (1994) Large Sample Estimation and Hypothesis Testing).
In R this method is implemented in the fitdistrplus package (fitdistrplus on CRAN) with the accompanying article fitdistrplus: An R Package for Fitting Distributions by  Marie Laure Delignette-Muller and Christophe Dutang (see the R journal).
Here is a small sample code illustrating the use:
  #simulate a sample
  mysample  <-  rweibull(1000, 3, 1)

  #function to calculate sample raw moment
  memp  <-  function(x, order) mean(x^order)

  #fit by MME
  mmedist(mysample, "weibull", order=c(1, 2), memp=memp, 
    start=list(shape=10, scale=10), lower=0, upper=Inf)

The code works by using the function memp to calculate the raw sample moments of some order $j$ based on the sample mysample. This is then matched with the theoretical moment using numerical optimization solving 
$$\min_{\lambda,k} Q(\lambda,k),$$
using the solver optim according to package documentation.
