Forum: help
Monitor Forum | Start New ThreadRE: Scaling of TotExp affects iterated (IL) estimation [ Reply ] By: Julien Mc Donald-Guimond on 2023-04-17 13:26 | [forum:49640] |
I understand now! Thank you very much for the quick turnaround M. Henningsen. Your package is very helpful to the community. All the best, Julien |
RE: Scaling of TotExp affects iterated (IL) estimation [ Reply ] By: Arne Henningsen on 2023-04-17 10:32 | [forum:49639] |
The 'full' AIDS model (e.g., estimated with the 'iterative linear' estimation method) is invariant to units of measurement of total expenditure only if alpha_0 adjusts to changes of the units of measurement. If you adjust alpha_0 manually, you get virtually the same results: aidsResult.1b <- aidsEst(priceNames, shareNames, "xFood",data = BlanciX, method = "IL", alpha0 = log( 10 )) all.equal( coef( aidsResult.0 )$alpha, coef( aidsResult.1b )$alpha ) # [1] "Mean relative difference: 1.913937e-07" all.equal( coef( aidsResult.0 )$beta, coef( aidsResult.1b )$beta ) # [1] "Mean relative difference: 2.168397e-07" all.equal( coef( aidsResult.0 )$gamma, coef( aidsResult.1b )$gamma ) # [1] "Mean relative difference: 6.879121e-07" You can search for the 'optimal' values of alpha_0 (which can take some time) and then estimate the AIDS with these optimal values: # optimal alpha_0 with unscaled xFood a0.0 <- aidsBestA0(priceNames, shareNames, "xFood",data = Blanciforti86, stoprange = 0.02, stopiter = 50 ) # estimation with optimal alpha_0 aidsResult.0o <- aidsEst(priceNames, shareNames, "xFood",data = Blanciforti86, method = "IL", alpha0 = a0.0$alpha0 ) # optimal alpha_0 with scaled xFood a0.1 <- aidsBestA0(priceNames, shareNames, "xFood",data = BlanciX, stoprange = 0.02, stopiter = 50 ) # estimation with optimal alpha_0 aidsResult.1o <- aidsEst(priceNames, shareNames, "xFood",data = BlanciX, method = "IL", alpha0 = a0.1$alpha0 ) # comparison all.equal( coef( aidsResult.0o )$alpha, coef( aidsResult.1o )$alpha ) # [1] "Mean relative difference: 0.001127145" all.equal( coef( aidsResult.0o )$beta, coef( aidsResult.1o )$beta ) # [1] "Mean relative difference: 6.353063e-05" all.equal( coef( aidsResult.0o )$gamma, coef( aidsResult.1o )$gamma ) # "Mean relative difference: 0.0009082388" |
Scaling of TotExp affects iterated (IL) estimation [ Reply ] By: Julien Mc Donald-Guimond on 2023-04-14 22:12 | [forum:49634] |
I'm surprised to see that the scaling of total expenditures affects non-trivially the estimated coefficients. Not only alpha (which, being a constant, would change), but also beta and gamma. Any guidance as to why and whether it is normal ? Reproducible example below. Thank you, Julien ``` r require(micEconAids) data( "Blanciforti86" ) Blanciforti86 <- Blanciforti86[ 1:32, ] priceNames <- c( "pFood1", "pFood2", "pFood3", "pFood4" ) shareNames <- c( "wFood1", "wFood2", "wFood3", "wFood4" ) aidsResult.0 <- aidsEst(priceNames, shareNames, "xFood",data = Blanciforti86, method = "IL" ) BlanciX <- Blanciforti86 BlanciX$xFood <- BlanciX$xFood*10 ######## scaling ######### aidsResult.1 <- aidsEst(priceNames, shareNames, "xFood",data = BlanciX, method = "IL" ) all.equal( coef( aidsResult.0 )$alpha, coef( aidsResult.1 )$alpha ) #> [1] "Mean relative difference: 1.065724" all.equal( coef( aidsResult.0 )$beta, coef( aidsResult.1 )$beta ) #> [1] "Mean relative difference: 0.04433987" all.equal( coef( aidsResult.0 )$gamma, coef( aidsResult.1 )$gamma ) #> [1] "Mean relative difference: 0.8122552" ``` <sup>Created on 2023-04-14 by the [reprex package](https://reprex.tidyverse.org) (v2.0.1)</sup> |