Learn R Programming

micEconAids (version 0.6-20)

lrtest.aidsEst: Likelihood Ratio test for Almost Ideal Demand Systems

Description

Testing hypothesis in Almost Ideal Demand Systems by a Likelihood Ratio test.

Usage

# S3 method for aidsEst
lrtest( object, … )

Arguments

object

a fitted model object of class aidsEst.

further fitted model objects of class aidsEst.

Value

An object of class anova, which contains the log-likelihood value, degrees of freedom, the difference in degrees of freedom, likelihood ratio Chi-squared statistic and corresponding p value. See documentation of lrtest in package "lmtest".

Details

lrtest.aidsEst consecutively compares the fitted model object object with the models passed in .

See Also

aidsEst, lrtest (package "lmtest"), logLik.aidsEst

Examples

Run this code
# NOT RUN {
   # Using data published in Blanciforti, Green & King (1986)
   data( Blanciforti86 )
   # Data on food consumption are available only for the first 32 years
   Blanciforti86 <- Blanciforti86[ 1:32, ]

   # names of prices and expenditure shares
   priceNames <- c( "pFood1", "pFood2", "pFood3", "pFood4" )
   shareNames <- c( "wFood1", "wFood2", "wFood3", "wFood4" )

   # estimation with symmetry and homogeneity imposed
   estResult <- aidsEst( c( "pFood1", "pFood2", "pFood3", "pFood4" ),
      c( "wFood1", "wFood2", "wFood3", "wFood4" ), "xFood",
      data = Blanciforti86 )

   # estimation with only homogeneity imposed
   estResultHom <- aidsEst( c( "pFood1", "pFood2", "pFood3", "pFood4" ),
      c( "wFood1", "wFood2", "wFood3", "wFood4" ), "xFood",
      data = Blanciforti86, sym = FALSE )

   # unrestricted estimation
   estResultUnr <- aidsEst( c( "pFood1", "pFood2", "pFood3", "pFood4" ),
      c( "wFood1", "wFood2", "wFood3", "wFood4" ), "xFood",
      data = Blanciforti86, sym = FALSE, hom = FALSE )

   # LR tests
   lrtest( estResult, estResultHom, estResultUnr, estResult )

   ## Estimation with a demand shifter: linear trend
   Blanciforti86$trend <- c( 0:( nrow( Blanciforti86 ) - 1 ) )
   estResultTrend <- aidsEst( priceNames, shareNames, "xFood",
      data = Blanciforti86, shifterNames = "trend" )

   # LR tests
   lrtest( estResult, estResultTrend )
# }

Run the code above in your browser using DataLab