Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
482 views
in Technique[技术] by (71.8m points)

r - Error in using gmm function: Error in ar.ols(x, aic = aic, order.max = order.max, na.action = na.action, : 'order.max' must be < 'n.used'

Im trying to do a gmm using this data:

X <- cbind(rep(1,800), data$Prices,data$Efectivity)
delta <- data$delta_j_i
Z <- cbind(rep(1,800),data$Price_Active_Ingredient,data$Mean_Price_Secundary_Ingredients)

I'm performing the gmm in this way:

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)

But after some iterations then give the error: Error in ar.ols(x, aic = aic, order.max = order.max, na.action = na.action, : 'order.max' must be < 'n.used'

Do you know what is happening?

question from:https://stackoverflow.com/questions/65907708/error-in-using-gmm-function-error-in-ar-olsx-aic-aic-order-max-order-max

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...