[R] GMM: "The covariance matrix of the coefficients is singular"
Fernando Martinez
fernando.martinez07 at imperial.ac.uk
Tue Jun 8 17:41:02 CEST 2010
Hi All,
I'm trying to estimate some parameters in my model via GMM using the
function gmm(), but I keep getting the message "The covariance matrix of
the coefficients is singular". I've changed the moment conditions and
the initial value of the parameters, and I still get this message. Are
the results valid after receiving this message? Any ideas on how to get
rid of it?
My code:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Function g, where E[g]=0:
g <- function(theta,x){
N <- length(x)
#Transform parameters in order to make them x>0, x<0 or 0<x<1
a <- exp(theta[1])
b <- -exp(theta[2])
mu_s <- exp(theta[3])
prob <- exp(theta[4])/(1+exp(theta[4]))
sigma <- exp(theta[5])
sigma_s <- exp(theta[6])
nt1 <- diff(x) - a - b*x[-N]
m1 <- nt1
m2 <- nt1^2 - (sigma^2-2*prob*(mu_s^2+sigma_s^2))/(1-2*prob)
m3 <- nt1^3
m4 <- nt1^4 -
(-2*prob*mu_s^4-12*mu_s^2*sigma_s^2*prob+3*sigma^4-6*prob*sigma_s^4)/(1-2*prob)
m5 <- nt1^5
m6 <- nt1^6 -
(-2*prob*mu_s^6-30*prob*mu_s^4*sigma_s^2-90*prob*mu_s^2*sigma_s^4+15*sigma^6-30*prob*sigma_s^6)/(1-2*prob)
g <- cbind(m1, m2, m3, m4, m5, m6)
return(g)
}
Initial value for the parameters:
tet0
[1] 12.1824940 -0.7408182 20.0855369 0.5000250 2.0137527 2.2255409
Calling the function:
res <- gmm(g,x,tet0)
Warning message:
In FinRes.baseGmm.res(z, Model_info) :
The covariance matrix of the coefficients is singular
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Cheers,
Fernando
More information about the R-help
mailing list