library (micEconAids) alcohol.df<- read.table("C:/Temp/alcohol.txt", header=T) # estimation with symmetry and homogeneity imposed, & Translog Price Index # First obtain best value for Alpha0: bestA0 <- aidsBestA0( c( "PB", "PW", "PS" ),c( "WB", "WW", "WS" ), "M", data = alcohol.df ) # Now estimate the model by Iteratice Least Squares: estResult <- aidsEst( c( "PB", "PW", "PS" ),c( "WB", "WW", "WS" ), "M", method="IL", maxiter=1000,alpha0=bestA0\$alpha0, data = alcohol.df ) print( estResult ) elas( estResult ) summary(estResult) #NOW PREPARE FOR TESTING VARIOUS RESTRICTIONS # names of prices and expenditure shares priceNames <- c( "PB", "PW", "PS" ) shareNames <- c( "WS", "WW", "WS") # estimation with only homogeneity imposed estResultHom <- aidsEst( c( "PB", "PW", "PS" ), c( "WB", "WW", "WS" ), "M", data = alcohol.df, method="IL", maxiter=1000,alpha0=bestA0\$alpha0, sym = FALSE ) # unrestricted estimation estResultUnr <- aidsEst( c( "PB", "PW", "PS" ), c( "WB", "WW", "WS" ), "M", data = alcohol.df, method="IL", maxiter=1000,alpha0=bestA0\$alpha0, sym = FALSE, hom = FALSE ) # LR tests lrtest( estResult, estResultHom, estResultUnr, estResult ) print(estResultUnr) elas(estResultUnr) summary(estResultUnr) # Is the estimated expenditure function monotoinc increasing in prices, # implying that all demanded quantities and expenditure shares are positive? aidsMono( priceNames, "M", coef = coef( estResultUnr ),data = alcohol.df )