Skip to contents

Calculation of a price index

Usage

CalcInd(data, baseVar, pVar, type, groupVar, consumVar = NULL, wVar = NULL)

Arguments

data

The dataset

baseVar

The variable name for the base goods price.

pVar

The variable name for the goods price.

type

The type of index to calculate. Choose from: 'carli', 'dutot', 'jevons'.

groupVar

The variable used for grouping observations - sometimes called the elementary group

consumVar

The variable used for grouping elementary groups. This may be the publishing level.

wVar

The variable used to weight the elementary groups up to the consumer publishing level.

Value

The estimates for the index are returned as a vector of length equal to the number of groups (in groupVar or consumVar if specified).

Examples

{
data(priceData)
# Calculate index for consumer groups
CalcInd(data = priceData, baseVar = "b1", pVar = "p1", groupVar = "varenr", wVar = "weight", 
  consumVar = "coicop", type = "dutot")
CalcInd(data = priceData, baseVar = "b1", pVar = "p1", groupVar = "varenr", wVar = "weight", 
  consumVar = "coicop", type = "carli")
CalcInd(data = priceData, baseVar = "b1", pVar = "p1", groupVar = "varenr", wVar = "weight", 
  consumVar = "coicop", type = "jevons")
  
# Calculate index for elemenatry groups (weighted)
CalcInd(data = priceData, baseVar = "b1", pVar = "p1", groupVar = "varenr", wVar = "weight", 
   type = "dutot")
   
   }
#> Warning: Elementary group weights did not add to one and have been scaled.
#> Warning: Elementary group weights did not add to one and have been scaled.
#> Warning: Elementary group weights did not add to one and have been scaled.
#> Warning: No consumer group variable was specified so an index was calculated for each elementary group.
#> Warning: Elementary group weights did not add to one and have been scaled.
#>         1         2         3         4         5         6         7         8 
#> 1.0491782 0.9916579 1.0919232 0.9971484 0.9776819 1.0122949 1.0082979 1.0410994 
#>         9        10        11        12        13        14        15        16 
#> 1.0657426 1.0458119 1.0126660 1.0087542 1.0119236 1.0202207 1.0154042 1.0204284 
#>        17        18        19        20        21        22        23        24 
#> 1.0404285 1.0635197 1.0343509 0.9839625 1.0591687 1.0296146 1.0179432 1.0114293 
#>        25        26        27        28        29        30        31        32 
#> 0.9980075 1.0325678 1.0184376 0.9917827 1.0438475 1.0516548 1.1019312 1.0255544 
#>        33        34        35        36        37        38        39        40 
#> 1.0059274 1.0195331 1.0264037 1.0193352 0.9949706 1.0335269 1.0005686 1.0757601 
#>        41        42        43        44        45        46        47        48 
#> 1.0841688 0.9949837 0.9997077 1.0276529 1.0164630 1.0287131 1.0475356 1.0274997 
#>        49        50        51        52        53        54        55        56 
#> 1.0186174 1.0312737 1.0722388 1.0139797 1.0168422 1.0754973 1.0071958 1.0202791 
#>        57        58        59        60        61        62        63        64 
#> 1.0026775 1.0058940 1.0030017 0.9997709 0.9799183 1.0478942 1.0110590 1.0115428 
#>        65        66        67        68        69        70        71        72 
#> 1.0739428 0.9794139 1.0212139 0.9870189 1.0317518 0.9650201 1.0614352 1.0221492 
#>        73        74        75        76        77        78        79        80 
#> 1.0274920 1.0415765 1.0500053 1.0021974 1.0667718 1.0605561 1.0751474 1.0336029 
#>        81        82        83        84        85        86        87        88 
#> 1.0863649 1.0437152 1.0501207 1.0057534 1.0676503 1.0302636 1.0008981 1.0675389 
#>        89        90        91        92        93        94        95        96 
#> 0.9959739 1.0268511 1.0201997 0.9777202 1.0279413 1.0009408 1.0264877 1.0103826 
#>        97        98        99       100       101       102       103       104 
#> 1.0170851 1.0384248 1.0000014 1.0177277 1.0345633 1.0300957 1.0476841 1.0164684 
#>       105       106       107       108       109       110       111       112 
#> 1.0127264 1.0475748 1.0351660 1.0249665 1.0114083 1.0502433 1.0598351 1.0119547 
#>       113       114       115       116       117       118       119       120 
#> 1.0299265 1.0200079 1.0427289 0.9906708 1.0518309 1.0123277 1.0134508 1.0079136 
#>       121       122       123       124       125       126       127       128 
#> 1.0058585 1.0632656 1.0373929 0.9685996 1.0243814 1.0172798 1.0434409 0.9756649 
#>       129       130       131       132       133       134       135       136 
#> 1.0363835 1.0958327 1.0206910 0.9865309 0.9908110 1.0040474 0.9931275 1.0179996 
#>       137       138       139       140       141       142       143       144 
#> 1.0079795 1.0078089 1.0476088 1.0340241 1.0201028 1.0562831 1.0297616 1.0270815 
#>       145       146       147       148       149       150       151       152 
#> 1.0314082 1.0641822 1.0495536 1.0333891 1.0183344 1.0253208 1.0093552 1.0100153 
#>       153       154       155       156       157       158       159       160 
#> 1.0308649 1.0048242 1.0614685 1.0775324 0.9815208 1.0292993 0.9982024 1.0133232 
#>       161       162       163       164       165       166       167       168 
#> 1.0129391 1.0301208 1.0049818 1.0209796 1.0605804 0.9603525 0.9858467 1.0418124 
#>       169       170       171       172       173       174       175       176 
#> 1.0218097 1.0433452 1.0616003 1.0282483 1.0462104 0.9881764 1.0256537 1.0233769 
#>       177       178       179       180       181       182       183       184 
#> 1.0605085 1.0214452 1.0091499 1.0175753 1.0171524 0.9930452 1.0530682 1.0687364 
#>       185       186       187       188       189       190       191       192 
#> 1.0602363 1.0094292 1.0511469 1.0330998 1.0204593 1.0404494 1.0349803 0.9897180 
#>       193       194       195       196       197       198       199       200 
#> 1.0027196 1.0410686 1.0322500 1.0577304 1.0199610 1.0255261 0.9869663 1.0227391