SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: About LM and gridSearch [ Reply ]
By: Arne Henningsen on 2011-12-31 15:26
[forum:5383]
Some comments/answers:

a) I did not fully understand what you did to "erase time tendency".

b) You generated "rY" with increasing returns to scale (nu = 1.1) but when estimating the CES function, you do not allow for non-constant returns to scale (vrs = FALSE (default)).

c) The AES between capital/energy and labour is NA, because rho is -1.8, which is not in the economically plausible region.

d) Good luck with your interesting paper. Please do not forget to cite our package ;-) http://EconPapers.repec.org/RePEc:foi:wpaper:2011_9

RE: About LM and gridSearch [ Reply ]
By: zhou sixin on 2011-12-31 14:33
[forum:5382]
Everybody,Happy new year!


Let's go on. In order to erase time tendency, I estimated the elasticity of substitution of the nested CES function again ,but the result is still unsatisfied by dealing all the sequences either with ln function or with diff function.

So I am curious to see the result should be throught the cesCalc function with the coefficients in your article. This graph is the comparison of the two sequences(rY denotes output calcucating by cesCalc, and Y original values).

(picture in attachment)

Seemingly, the two curves are very close. Then, I estimate these coeffectives with the new value (rY), capital(K), energy(E), labor(L). The result printing on the screen confuses me :



> rY<- cesCalc(xNames = c("K", "E", "L"), data = diff_data, coef = c(gamma = 1, delta_1 = 0.7, delta = 0.6, rho_1 = 0.3, rho = 0.5, nu = 1.1), nested = TRUE)
> rY
[1] 78.67668 81.64438 87.02591 91.93226 108.91154 129.60306 148.56787 154.73167 159.24659 166.10976 184.67637 198.64644 211.15321 221.27037 229.09227 238.38870
[17] 245.07028 247.32641 231.35697 231.12630 228.90973 238.73829 260.20244 311.20098 359.98430 430.37758 502.27497 614.67312 706.95042 818.18793
> ln_data
rY Y K L E
1 78.67668 87.29595 230.0000 25.51873 28.39235
2 81.64438 93.68346 262.8198 26.00472 27.21167
3 87.02591 103.61959 298.9697 26.74867 29.07387
4 91.93226 114.97516 347.2937 27.04369 30.80588
5 108.91154 121.36267 405.2872 32.31742 33.31395
6 129.60306 119.23350 483.3837 37.74435 38.59537
7 148.56787 127.04045 560.0446 43.18694 41.28318
8 154.73167 131.29879 622.5111 43.12369 44.77266
9 159.24659 151.88077 673.4511 43.55928 45.74730
10 166.10976 171.04329 724.2061 45.34577 45.62330
11 184.67637 164.65578 788.6824 51.71790 45.66747
12 198.64644 163.23634 857.4769 56.21604 45.65824
13 211.15321 178.85025 920.6933 58.05782 50.84789
14 221.27037 176.01136 977.5615 59.19924 55.89071
15 229.09227 166.07523 1009.3215 58.85234 64.87833
16 238.38870 205.11001 1054.4074 62.18999 62.82319
17 245.07028 209.36835 1107.9439 62.87685 65.74814
18 247.32641 209.36835 1177.2678 62.13855 67.16261
19 231.35697 242.01561 1192.4627 56.52848 65.83100
20 231.12630 225.69198 1177.8898 55.22823 71.89323
21 228.90973 224.98226 1154.3430 54.89796 71.39046
22 238.73829 237.75727 1136.2703 58.12888 73.31512
23 260.20244 262.59759 1154.2699 65.99134 71.77997
24 311.20098 300.92264 1154.6426 81.84298 84.62210
25 359.98430 430.09226 1194.3329 98.85122 90.57951
26 430.37758 476.22427 1305.6002 120.38048 104.44193
27 502.27497 538.67991 1475.0860 144.86032 108.51372
28 614.67312 651.52590 1692.0222 183.89955 118.97560
29 706.95042 620.29808 1965.3853 213.79112 124.69917
30 818.18793 736.50664 2356.6659 243.48226 136.50105
> r1<-cesEst("rY",c("K","E","L"),ln_data,method="LM")
警告信息:
In nls.lm(par = start, fn = residFun, data = data, jac = jac, yName = yName, :
lmder: info = -1. Number of iterations has reached `maxiter' == 50.
> summary(r1)
Estimated CES function with constant returns to scale
Call:
cesEst(yName = "rY", xNames = c("K", "E", "L"), data = ln_data,
method = "LM")
Estimation by non-linear least-squares using the 'LM' optimizer
assuming an additive error term
Convergence NOT achieved after 50 iterations
Message: Number of iterations has reached `maxiter' == 50.
Coefficients:
Estimate Std. Error t value Pr(>|t|)
gamma 3.070981 0.185728 16.535 <2e-16 ***
delta_1 0.969434 0.467478 2.074 0.0381 *
delta 0.006559 0.020725 0.316 0.7516
rho_1 1.113982 5.823779 0.191 0.8483
rho -1.832723 0.786772 -2.329 0.0198 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 5.822162
Multiple R-squared: 0.9989411
Elasticities of Substitution:
Estimate Std. Error t value Pr(>|t|)
E_1_2 (HM) 0.473 1.303 0.363 0.717
E_(1,2)_3 (AU) NA NA NA NA
HM = Hicks-McFadden (direct) elasticity of substitution
AU = Allen-Uzawa (partial) elasticity of substitution


According to my understanding, the elasticities should be around 0.3 and 0.5, but the AES is NA.
what is the reason?

BTW: I do this job for my paper in that a CGE model is applied to investigate the effect of a carbon tax.



RE: About LM and gridSearch [ Reply ]
By: Arne Henningsen on 2011-12-30 13:00
[forum:5380]
You can use argument "tName" of cesEst() to specify a time trend variable.

BTW: Does the coal-mining industry use a fourth (aggregate) input (materials)?

RE: About LM and gridSearch [ Reply ]
By: zhou sixin on 2011-12-30 11:55
[forum:5379]
Dear Arne:

First of all,thank your explanation.

According to your suggestion, I do some work using your (a) and (c), but the results are still unsatisfied.

Maybe, the key reason lies in the data itself that are output, capital,labor and energy of China's coal-mining industry in the period of 1980-2009. Due to data source,it is impossible to get a larger data set. Now, the urgentest question is:

How to include the way of time series data in your micEconCES package?
If the first order difference sequence of these data is stable, is the result estimated by micEconCES package effective based on this sequence?


RE: About LM and gridSearch [ Reply ]
By: Arne Henningsen on 2011-12-30 08:05
[forum:5378]
Dear Zhou Sixin

You wrote:
> summary(cesResult_LM)
> [...]
> The result is NA, I don't know the reason.

Please note that the estimates are not NA; just the standard errors are NA. Given the estimated parameters, the standard errors are probably so large that they cannot be calculated. One reason is probably that the objective function (sum of squared residuals) is not close to its minimum.

> So I try to resort to Grid search
> [...]
> IN that result ,the P values are too large.

I don't think that the P values are too large.

> What is the reason

The P values are probably rather large, because the estimates are rather imprecise.

> ,and what do I do next step?

There are many things that you could do: (a) use other optimisers (e.g. BFGS, PORT) both with and without grid search, (b) use estimates obtained by grid search as starting values, (c) try other nesting structures, (d) include a time trend if you have time series data, (e) try to get a larger data set, (f) plot and analyse the surface of the objective function, (g) try other functional forms (e.g. Translog), ...

About LM and gridSearch [ Reply ]
By: zhou sixin on 2011-12-30 02:44
[forum:5377]
Dr.Arne
I'm zhousixin from Beijing. I have some question about LM. The code is:

> data_coal<-read.table("clipboard",header=T,sep="\t")
> data_coal
Y K L E
1 87.29595 230.0000 25.51873 28.39235
2 93.68346 262.8198 26.00472 27.21167
3 103.61959 298.9697 26.74867 29.07387
4 114.97516 347.2937 27.04369 30.80588
5 121.36267 405.2872 32.31742 33.31395
6 119.23350 483.3837 37.74435 38.59537
7 127.04045 560.0446 43.18694 41.28318
8 131.29879 622.5111 43.12369 44.77266
9 151.88077 673.4511 43.55928 45.74730
10 171.04329 724.2061 45.34577 45.62330
11 164.65578 788.6824 51.71790 45.66747
12 163.23634 857.4769 56.21604 45.65824
13 178.85025 920.6933 58.05782 50.84789
14 176.01136 977.5615 59.19924 55.89071
15 166.07523 1009.3215 58.85234 64.87833
16 205.11001 1054.4074 62.18999 62.82319
17 209.36835 1107.9439 62.87685 65.74814
18 209.36835 1177.2678 62.13855 67.16261
19 242.01561 1192.4627 56.52848 65.83100
20 225.69198 1177.8898 55.22823 71.89323
21 224.98226 1154.3430 54.89796 71.39046
22 237.75727 1136.2703 58.12888 73.31512
23 262.59759 1154.2699 65.99134 71.77997
24 300.92264 1154.6426 81.84298 84.62210
25 430.09226 1194.3329 98.85122 90.57951
26 476.22427 1305.6002 120.38048 104.44193
27 538.67991 1475.0860 144.86032 108.51372
28 651.52590 1692.0222 183.89955 118.97560
29 620.29808 1965.3853 213.79112 124.69917
30 736.50664 2356.6659 243.48226 136.50105

> cesResult_LM<-cesEst("Y",c("K","E","L"),data_coal,method="LM")
> summary(cesResult_LM)
Estimated CES function with constant returns to scale

Call:
cesEst(yName = "Y", xNames = c("K", "E", "L"), data = data_coal,
method = "LM")

Estimation by non-linear least-squares using the 'LM' optimizer
assuming an additive error term
Convergence achieved after 21 iterations
Message: The cosine of the angle between `fvec' and any column of the Jacobian is at most `gtol' in absolute value.

Coefficients:
Estimate Std. Error t value Pr(>|t|)
gamma 3.6684 NA NA NA
delta_1 0.9115 NA NA NA
delta 0.3617 NA NA NA
rho_1 6.7875 NA NA NA
rho 133.5118 NA NA NA

Residual standard error: 27.67831
Multiple R-squared: 0.9748132

Elasticities of Substitution:
Estimate Std. Error t value Pr(>|t|)
E_1_2 (HM) 0.128410 NA NA NA
E_(1,2)_3 (AU) 0.007434 NA NA NA
HM = Hicks-McFadden (direct) elasticity of substitution
AU = Allen-Uzawa (partial) elasticity of substitution


The result is NA, I don't know the reason. So I try to resort to Grid search. the code is:

> cesResult_coal<- cesEst(yName="Y",xNames=c("K","E","L"),data=data_coal,method="LM",rho1=seq(from=-0.6,to=1,by=0.1),rho=seq(from=-0.6,to=1,by=0.1))
警告多于50个(用warnings()来显示第一个到第五十个)
> warnings()
警告信息:
1: In nls.lm(par = start, fn = residFun, data = data, jac = jac, ... :
lmder: info = -1. Number of iterations has reached `maxiter' == 50.
......

Estimated CES function with constant returns to scale

Call:
cesEst(yName = "Y", xNames = c("K", "E", "L"), data = data_coal,
method = "LM", rho1 = seq(from = -0.6, to = 1, by = 0.1),
rho = seq(from = -0.6, to = 1, by = 0.1))

Estimation by non-linear least-squares using the 'LM' optimizer
and a two-dimensional grid search for coefficients 'rho_1', 'rho'
assuming an additive error term
Convergence achieved after 42 iterations
Message: Relative error in the sum of squares is at most `ftol'.

Coefficients:
Estimate Std. Error t value Pr(>|t|)
gamma 4.587e+00 1.606e+00 2.856 0.00429 **
delta_1 -2.086e+00 3.864e+01 -0.054 0.95695
delta 8.549e-04 5.020e-02 0.017 0.98641
rho_1 1.110e-16 2.185e+00 0.000 1.00000
rho 1.000e+00 1.301e+00 0.769 0.44204
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 25.22977
Multiple R-squared: 0.9790723

Elasticities of Substitution:
Estimate Std. Error t value Pr(>|t|)
E_1_2 (HM) 1.0000 2.1854 0.458 0.647
E_(1,2)_3 (AU) 0.5000 0.3252 1.537 0.124
HM = Hicks-McFadden (direct) elasticity of substitution
AU = Allen-Uzawa (partial) elasticity of substitution


IN that result ,the P values are too large.
What is the reason ,and what do I do next step?
Expect your reply.thanks.


Thanks to:
Vienna University of Economics and Business Powered By FusionForge