1

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?

carles
  • 11
  • 1

0 Answers0