Description Usage Arguments Details Value Author(s) References See Also Examples
Given prices, total expenditure and coefficients this function calculates the demanded quantities and expenditure shares based on the Almost Ideal Demand System.
1 2 3 4 5 6 |
priceNames |
a vector of strings containing the names of the prices. |
totExpName |
a string containing the variable name of total expenditure. |
coef |
a list containing the coefficients alpha, beta, gamma, and (only for the translog price index) alpha0. |
data |
a data frame containing the data. |
priceIndex |
a character string specifying the price index
(see |
basePrices |
a vector specifying the base prices for the Paasche, Laspeyres, and Tornqvist price index. |
baseShares |
a vector specifying the base expenditure shares for the Laspeyres, simplified Laspeyres, and Tornqvist index. |
object |
an object of class |
newdata |
an optional data frame which should contain the variables for the prediction. If omitted, the data frame used for the estimation is used also for the prediction. |
observedShares |
logical. Using observed shares? (see details). |
... |
currently not used. |
The predict
method for objects of class aidsEst
extracts all relevant elements from an object returned by aidsEst
and passes them as arguments to aidsCalc
.
The optional argument observedShares
determines
whether fitted (default) or observed expenditure shares are
used in the price index of the LA-AIDS.
aidsCalc
and
the predict
method for objects of class aidsEst
return a list with following elements:
shares |
a data frame containing the calculated expenditure shares. |
quantities |
a data frame containing the calculated quantites. |
Arne Henningsen
Deaton, A.S. and J. Muellbauer (1980) An Almost Ideal Demand System. American Economic Review, 70, p. 312-326.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | data( Blanciforti86 )
# Data on food consumption are available only for the first 32 years
Blanciforti86 <- Blanciforti86[ 1:32, ]
priceNames <- c( "pFood1", "pFood2", "pFood3", "pFood4" )
shareNames <- c( "wFood1", "wFood2", "wFood3", "wFood4" )
## LA-AIDS
estResult <- aidsEst( priceNames, shareNames, "xFood",
data = Blanciforti86, priceIndex = "S" )
# using observed shares in the Stone index
lnp <- aidsPx( "S", priceNames, Blanciforti86, shareNames )
fitted <- aidsCalc( priceNames, "xFood", coef = coef( estResult ),
data = Blanciforti86, priceIndex = lnp )
fitted$shares # equal to estResult$wFitted
fitted$quant # equal to estResult$qFitted
# now the same with the predict method
fitted2 <- predict( estResult, observedShares = TRUE )
all.equal( fitted, fitted2 )
# using fitted shares in the Stone index
fitted <- aidsCalc( priceNames, "xFood", coef = estResult$coef,
data = Blanciforti86, priceIndex = "S" )
# now the same with the predict method
fitted2 <- predict( estResult )
all.equal( fitted, fitted2 )
## AIDS
estResult <- aidsEst( priceNames, shareNames, "xFood",
data = Blanciforti86, method = "IL" )
fitted <- aidsCalc( priceNames, "xFood", coef = coef( estResult ),
data = Blanciforti86 )
fitted$shares # equal to estResult$wFitted
fitted$quant # equal to estResult$qFitted
fitted2 <- predict( estResult )
all.equal( fitted, fitted2 )
|
Loading required package: lmtest
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
Loading required package: micEcon
If you have questions, suggestions, or comments regarding one of the 'micEcon' packages, please use a forum or 'tracker' at micEcon's R-Forge site:
https://r-forge.r-project.org/projects/micecon/
w1 w2 w3 w4
1947 0.3157643 0.1878447 0.1332187 0.3631723
1948 0.3168673 0.1720323 0.1352067 0.3758937
1949 0.3084886 0.1831714 0.1356166 0.3727233
1950 0.3116970 0.1689490 0.1370012 0.3823528
1951 0.3165723 0.1648801 0.1364117 0.3821359
1952 0.3039028 0.1817326 0.1366444 0.3777202
1953 0.3063394 0.1840031 0.1367489 0.3729085
1954 0.2978888 0.1824126 0.1393270 0.3803716
1955 0.2994621 0.1953323 0.1377422 0.3674634
1956 0.2924386 0.2097147 0.1376028 0.3602438
1957 0.2980723 0.1972295 0.1378935 0.3668047
1958 0.2941508 0.1953809 0.1380429 0.3724254
1959 0.3009149 0.2002055 0.1363608 0.3625189
1960 0.3001748 0.2060106 0.1359521 0.3578624
1961 0.2983617 0.2055501 0.1366668 0.3594214
1962 0.3038579 0.2044422 0.1355719 0.3561280
1963 0.2958507 0.2152075 0.1358531 0.3530887
1964 0.2929931 0.2231546 0.1354370 0.3484153
1965 0.3027429 0.2148688 0.1340877 0.3483006
1966 0.3131337 0.2063085 0.1327759 0.3477819
1967 0.3163254 0.2098139 0.1321802 0.3416805
1968 0.3127958 0.2186249 0.1312832 0.3372961
1969 0.3236850 0.2086370 0.1300080 0.3376699
1970 0.3291370 0.2066492 0.1292560 0.3349578
1971 0.3176356 0.2121555 0.1313186 0.3388903
1972 0.3260603 0.2081093 0.1290951 0.3367354
1973 0.3314610 0.1960497 0.1283402 0.3441491
1974 0.3179440 0.2136414 0.1312162 0.3371984
1975 0.3230558 0.2045031 0.1319696 0.3404714
1976 0.3318719 0.2063247 0.1296668 0.3321366
1977 0.3137694 0.2164033 0.1323796 0.3374477
1978 0.3185847 0.2116569 0.1311244 0.3386340
q1 q2 q3 q4
1947 1.645047 1.0841222 0.7939424 1.944224
1948 1.528557 1.0126306 0.7681342 1.973896
1949 1.518343 1.0285024 0.7494603 2.006972
1950 1.466563 0.9870012 0.7424046 2.016334
1951 1.472676 0.9760787 0.7488635 1.970211
1952 1.465715 1.0040304 0.7525986 2.006077
1953 1.561456 1.0504368 0.7381546 1.908949
1954 1.507629 1.0311050 0.7165978 1.875997
1955 1.628759 1.0997990 0.7055530 1.847291
1956 1.693589 1.1441599 0.7065718 1.810832
1957 1.627386 1.1031583 0.6967052 1.860987
1958 1.509279 1.0497535 0.7034952 1.983983
1959 1.622806 1.1047623 0.6958974 1.974637
1960 1.674682 1.1330585 0.6955233 1.948919
1961 1.672621 1.1328416 0.6900349 1.916098
1962 1.699479 1.1434464 0.6845355 1.964353
1963 1.717531 1.1634301 0.6914465 1.958038
1964 1.761341 1.1842827 0.7000381 1.909866
1965 1.759437 1.1754750 0.7030588 1.973396
1966 1.778068 1.1729451 0.7096968 1.997224
1967 1.893497 1.2261001 0.7086496 1.936189
1968 1.915972 1.2382834 0.7333856 1.935098
1969 1.921927 1.2274733 0.7419548 1.939998
1970 1.972652 1.2426294 0.7428473 1.897051
1971 1.936081 1.2388722 0.7359396 1.878411
1972 1.913648 1.2213932 0.7576590 1.976300
1973 1.774493 1.1535978 0.7735006 2.175827
1974 1.900709 1.2328689 0.6934158 2.006409
1975 1.917665 1.2343439 0.6763956 1.960441
1976 2.058931 1.2791250 0.7160900 1.820368
1977 2.016317 1.2645408 0.7411603 1.666404
1978 1.948125 1.2365090 0.7484548 1.813277
[1] TRUE
[1] TRUE
w1 w2 w3 w4
1947 0.3170010 0.1878049 0.1328869 0.3623072
1948 0.3167985 0.1718239 0.1352046 0.3761731
1949 0.3075299 0.1830703 0.1358508 0.3735490
1950 0.3128814 0.1691010 0.1367120 0.3813056
1951 0.3145666 0.1644348 0.1368928 0.3841058
1952 0.3030763 0.1817814 0.1368562 0.3782861
1953 0.3062363 0.1841194 0.1367863 0.3728580
1954 0.2991248 0.1830028 0.1390652 0.3788072
1955 0.2998191 0.1957453 0.1376912 0.3667445
1956 0.2937748 0.2104522 0.1373238 0.3584492
1957 0.2982560 0.1976630 0.1378896 0.3661913
1958 0.2931390 0.1957260 0.1383338 0.3728013
1959 0.3002700 0.2004129 0.1365476 0.3627695
1960 0.2997461 0.2062659 0.1360867 0.3579012
1961 0.2981775 0.2059068 0.1367490 0.3591667
1962 0.3033644 0.2045964 0.1357176 0.3563216
1963 0.2969248 0.2157949 0.1356277 0.3516525
1964 0.2931206 0.2236699 0.1354456 0.3477639
1965 0.3024146 0.2150357 0.1341849 0.3483648
1966 0.3125328 0.2061376 0.1329161 0.3484135
1967 0.3177922 0.2098577 0.1318089 0.3405411
1968 0.3141389 0.2187062 0.1309389 0.3362160
1969 0.3234615 0.2081811 0.1300225 0.3383349
1970 0.3276214 0.2058570 0.1295759 0.3369457
1971 0.3188392 0.2120940 0.1310011 0.3380657
1972 0.3258235 0.2075581 0.1291011 0.3375173
1973 0.3334656 0.1956351 0.1277775 0.3431218
1974 0.3172819 0.2133295 0.1313624 0.3380262
1975 0.3230947 0.2041923 0.1319440 0.3407690
1976 0.3302778 0.2054885 0.1300111 0.3342225
1977 0.3134557 0.2162523 0.1324461 0.3378459
1978 0.3179930 0.2113028 0.1312422 0.3394619
q1 q2 q3 q4
1947 1.651490 1.0838926 0.7919652 1.939593
1948 1.528225 1.0114038 0.7681221 1.975363
1949 1.513624 1.0279349 0.7507542 2.011418
1950 1.472135 0.9878894 0.7408375 2.010811
1951 1.463345 0.9734429 0.7515045 1.980367
1952 1.461729 1.0042999 0.7537652 2.009082
1953 1.560930 1.0511008 0.7383563 1.908690
1954 1.513884 1.0344412 0.7152511 1.868281
1955 1.630701 1.1021241 0.7052914 1.843677
1956 1.701327 1.1481838 0.7051389 1.801811
1957 1.628389 1.1055831 0.6966855 1.857875
1958 1.504087 1.0516077 0.7049773 1.985985
1959 1.619328 1.1059069 0.6968509 1.976002
1960 1.672291 1.1344625 0.6962117 1.949131
1961 1.671588 1.1348073 0.6904502 1.914740
1962 1.696719 1.1443092 0.6852712 1.965421
1963 1.723767 1.1666056 0.6902994 1.950073
1964 1.762107 1.1870178 0.7000823 1.906295
1965 1.757529 1.1763878 0.7035687 1.973760
1966 1.774656 1.1719733 0.7104460 2.000851
1967 1.902277 1.2263562 0.7066592 1.929733
1968 1.924199 1.2387441 0.7314618 1.928901
1969 1.920599 1.2247911 0.7420374 1.943819
1970 1.963568 1.2378658 0.7446857 1.908309
1971 1.943418 1.2385134 0.7341601 1.873840
1972 1.912258 1.2181585 0.7576945 1.980889
1973 1.785225 1.1511582 0.7701089 2.169332
1974 1.896751 1.2310691 0.6941886 2.011335
1975 1.917896 1.2324677 0.6762643 1.962155
1976 2.049042 1.2739411 0.7179916 1.831801
1977 2.014301 1.2636582 0.7415327 1.668370
1978 1.944507 1.2344402 0.7491274 1.817711
[1] TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.