Generalized method of moments with logarithmic distribution

I am trying to execute gmm on a log-normal sample.

This is a normal distribution example

n <- 1000

x <- rnorm(n, mean = 4, sd = 2)
g <- function(tet, x)
{
  m1 <- (tet[1] - x)
  m2 <- (tet[2]^2 - (x - tet[1])^2)
  m3 <- x^3 - tet[1]*(tet[1]^2 + 3*tet[2]^2)
  f <- cbind(m1, m2, m3)
  return(f)
}
library(gmm)
gmm(g, x, c(0, 0))

      

I would like to do the same with log-normal, that's my code:

x<-rlnorm(1000,3,5)
g <- function(tet, x)
{
  m1 <- exp(tet[1]+1/2*(tet[2]^2)) -x
  m2 <- exp(2*tet[1]+1/2*2^2*(tet[2]^2)) -x^2
  # m2 <- (exp(tet[2]^2)-1)*(exp(tet[1]+1/2*(tet[2]^2)))^2 -x^2
   m3 <- exp(3*tet[1]+1/2*3^2*(tet[2]^2)) -x^3
   f <- cbind(m1, m2, m3)
  return(f)
}
gmm(g, x, c(0, 0))

      

but the error message

Error in solve.default(w, gbar) : 
  system is computationally singular: reciprocal condition number = 1.968e-34

      

I use this formula: wikipedia link for normal log state

Any idea why it isn't working?

+3


source to share


1 answer


Problems arise from the covariance matrix of the empirical moment of moments that are not reversible. This is necessary if you want to compute the optimal weight matrix (w). You may try:

gt <- g(c(0,0),x)
solve(var(gt))

      

Since seed(123)

I have very large numbers in the moment covariance matrix for a logarithmic estimate:



             m1           m2           m3
m1 1.236396e+13 8.183621e+20 6.004444e+28
m2 8.183621e+20 6.010799e+28 4.647952e+36
m3 6.004444e+28 4.647952e+36 3.702954e+44

      

This is probably why this matrix is ​​not reversible. You can read a more detailed explanation on Cross validation .

0


source







All Articles