I tried to solve for a 2*1 matrix of GMM estimators with the following code:
x<-rnorm(50, mean = 3, sd = 2)
y<-rnorm(50, mean = 4, sd = 1)
z_1<-as.matrix(x)
z_2<-as.matrix(y)
e<-function(RGAAA,x,y)
{m1<-exp(-x/RGAAA[1])-1
m2<-exp(-y/RGAAA[2])-1
f<-cbind(m1,m2)
return(f)}
summary(gmm(e,cbind(z_1,z_2),c(1,1),method="BFGS",control=1e-12))
However, they yield the error message:
Error in P$g(P$t0, x) : argument "y" is missing, with no default
Could anyone help me find out what went wrong? Thanks a lot!