如何解决使用 gmm 函数时出错:ar.ols(x, aic = aic, order.max = order.max, na.action = na.action, : 'order.max' must be < 'n.used' 中的错误
我正在尝试使用此数据进行 gmm:
X <- cbind(rep(1,800),data$Prices,data$Efectivity)
delta <- data$delta_j_i
Z <- cbind(rep(1,data$Price_Active_Ingredient,data$Mean_Price_Secundary_Ingredients)
我正在以这种方式执行 gmm:
start <- inv(t(X)%*%X)%*%(t(X)%*%delta)
fusion <- cbind(delta,X,Z)
g <- function(tet,x) {
beta0 <- tet[1]
alpha <- tet[2]
beta1 <- tet[3]
xi <- matrix((x[,1])-beta0-(alpha*x[,2])-(beta1*x[,3]))
G <- (1/800)*(t(x[,5:7])%*%xi)
gmm <- t(G)%*%G
print(gmm)
return(gmm)
}
result_gmm <- gmm(g,x=fusion,t0=betas)
但是经过一些迭代之后给出错误:Error in ar.ols(x,aic = aic,order.max = order.max,na.action = na.action,: 'order.max' 必须是
你知道发生了什么吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。