Sorry for possible newbie question. I am using micEconCES package in R and keep getting the "Error in start[[i]] : subscript out of bounds" message. At first I thought it was the data - that one of my variables was needed to be transformed or something. It used to be log(raw_timeseries_data)*100, and I took away the *100 to fit my data more closely the data generated in an example.
I have tried using the methods in this post Subscript out of bounds - general definition and solution? But the problem is, when I try to look up the dimensions of the "start", it shows nothing. Here's a part of the code from the command line:
> options(error=recover)
> cesNlsLT <- nls( y2 ~ gamma * ( delta * x1^(-rho) + (1 - delta) * x2^(-rho) )^(-phi / rho),
data = LTTrialData, start = c(gamma = 0.5, delta = 0,5, rho = 0.25, phi = 1))
This gives:
Error in start[[i]] : subscript out of bounds
Enter a frame number, or 0 to exit
1: nls(y2 ~ gamma * (delta * x1^(-rho) + (1 - delta) * x2^(-rho))^(-phi/rho), data = LTTrialData, start = c(gamma = 0.5,
2: nlsModel(formula, mf, start, wts)
Selection: 1
Called from: top level
Browse[1]> ls()
[1] "algorithm" "cl" "control" "data" "env" "form2" "formula" "lenVar"
[9] "lower" "mf" "model" "mWeights" "n" "na.action" "not.there" "pnames"
[17] "respLength" "start" "subset" "trace" "upper" "var" "varIndex" "varNames"
[25] "varNamesRHS" "weights" "wts"
Part of my data:
Browse[1]> data
x1 x2 y2
1 13.37293 6.310031 8.272156
2 13.39282 6.606810 8.296000
3 13.31085 6.386308 8.292540
4 13.33683 6.680705 8.275467
5 13.40671 6.347887 8.317865
6 13.40392 6.456606 8.314906
dimensions of my data:
Browse[1]> dim(data)
[1] 75 3
And when I try to browse the dimensions of "start" ir gives me
NULL
Browse[1]> dim(start)
NULL:
But the "start" itself is:
Browse[1]> start
gamma delta rho phi
0.50 0.00 5.00 0.25 1.00
Could this be due to inappropriate parameter setting of gamma, delta, rho and phi? My problem is, I have no idea how to set them. I was kind'a hoping that this micEconCES package was for that - production function parameter estimation. But I'm just trying it out, and thought that I'd just wing it with the same parameters that were given in an example where randomly generated data is used.
Edit: user jav here pointed out that it was a typo in the values of my parameters. I had written a colon where a point should have been. I have corrected it, but now I'm getting a completely different error.
> cesNlsLT <- nls( y2 ~ gamma * ( delta * x1^(-rho) + (1 - delta) * x2^(-rho) )^(-phi / rho), + data = LTTrialData, start = c(gamma = 0.5, delta = 0.5, rho = 0.25, phi = 1))
> Error in numericDeriv(form[[3L]], names(ind), env) : Missing value or an infinity produced when evaluating the model