Здравствуйте! Подскажите, пожалуйста, в чем ошибка? Код для генетического алгоритма
panel <- read.dta("D://Diplom.dta")
> s=1
> p=74L #number of variables
> n=975L #number of observation = 13 years*75 region
> maxReg=10L
> X=panel#data
> y=panel[ ,10]#lnInnovOutput
> ###initial data
> Gmax = 500
> C= 500
> m=1000
> DATA<-list (X=X, y=y, n=n, p=p, maxk=10, lognn = log(n)/n)
> #BIC
> OF1<-function(x,data)
+ {
+ q<-qr(data$X[,x])
+ e<-qr.resid(q,data$y)
+ (log(crossprod(e))+2*p*data$lognn)
+ }
> ### AIC
> OF2<-function(x,data)
+ {
+ q<-qr(data$X[,x])
+ e<-qr.resid(q,data$y)
+ log(crossprod(e)/data$n)+2*sum(x)/data$n
+ }
> OF2(x0,DATA)
[,1]
[1,] -0.1909722
> ### HQIC
> OF3<-function(x,data)
+ {
+ q<-qr(data$X[,x])
+ e<-qr.resid(q,data$y)
+ log(crossprod(e)/data$n)+2*sum(x)*log(log(n))/n
+ }
> ###initial solutions
> K<-logical(DATA$p)
> for (i in 1:m)
+ {
+ x0<-logical(DATA$p)
+ temp<-sample.int(DATA$maxk,1L)
+ temp<-sample.int(DATA$p,temp)
+ x0[temp]<-TRUE
+ K<-cbind(K,x0) ###create a matrix from vectors
+ }
> K<-K[,-1] #K-matrix of initial solutions
> KOF<-numeric(m)#matrix of OF values of K
> for (i in 1:m) {KOF[i]<-OF(K[,i],DATA)}
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?