我试图以隐式形式估计下面的非线性模型的参数:它的表达式不是由y = f(x; theta)u给出的,而是由u = g(x,y; theta)给出的u随机项,x和y是解释和解释的变量 . 不可能从g获得f(因为g不能在y中反转和/或g在u中不是加性的) . 下面的NLS和GMM都没有运行 . 我在NLS和GMM文档中找不到关于这个问题的任何内容,所以我想知道该怎么做 . 我将不胜感激这个主题的任何帮助 .

更具体地说,我考虑了g的以下规范(但不运行NLS和GMM):

#
# The DGP
#
set.seed(34567)
N <- 1000 # sample size
x <- rnorm(N) # explanatory variable
u <- rnorm(N) # u is the random term or the model
y <- (81 - 3*x*x)*(1+exp(u)) # y = h(x,u;theta) is the explained variable
summary(y)
#
# The NLS regression: we know that the true functional form is u = g(x,y;theta) and E[u]=0 
# but we do not know that the DGP is obtained for theta_0=81 and theta_1=3 
#
x2 <- x*x
NLS_reg <- function(theta_0, theta_1) {
  log( y / (theta_0 - theta_1*x2) - 1 ) 
}
nls_out <- nls(0 ~ NLS_reg(theta_0, theta_1), start = list(theta_0 = 84.3, theta_1 = 3.25), trace = T)
summary(nls_out)
#
# The GMM regression
#
require("gmm")
iota <- rep(1,N)
data <- data.matrix(cbind(y, iota, x, x2))
GMM_reg <- function(data, theta_0, theta_1) {
  y <- as.numeric(data[,1])
  x2 <- as.numeric(data[,4])
  return( log( y / (theta_0*iota-theta_1*x2) - 1 ) )
}
moments <- function(data, theta_0, theta_1) {
  z <- data.matrix(data[, 2:4])
  m <- z * as.vector(GMM_reg(data, theta_0, theta_1))
  return(cbind(m))
}
GMM_out <- gmm(g=moments, x = data, t0 = c(78,2.6), type = "iterative", crit = 1e-3, wmatrix = "optimal", method = "Nelder-Mead", control = list(reltol = 1e-3, maxit = 100))
summary(GMM_out)