Running ‘indices.R’ [1s/1s]
Running the tests in ‘tests/indices.R’ failed.
Complete output:
  > library( "micEconIndex" )
  > options( digits = 4, warn = 1 )
  > 
  > ## function for printIndexing indices
  > printIndices <- function( what, ... ) {
  +   for( i in c( "Laspeyres", "Paasche", "Fisher" ) ) {
  +     cat( "\n", i, "\n" )
  +     if( what == "p" ) {
  +       index <- priceIndex( ..., method = i, weights = TRUE )
  +     } else {
  +       index <- quantityIndex( ..., method = i, weights = TRUE )
  +     }
  +     print( index )
  +     testRowSums <- rowSums( attributes( index )$weights[ !is.na( index ), ] )
  +     names( testRowSums ) <- NULL
  +     if( all.equal( testRowSums,
  +       rep( 1, sum( !is.na( index ) ) ) ) != TRUE ) {
  +       cat( "\nrowSums are not equal to one!!!\n\n" )
  +     }
  +   }
  + }
  > 
  > ## Missong03E7.7
  > if( requireNamespace( 'micEcon', quietly = TRUE ) ) {
  +   data( Missong03E7.7, package = "micEcon" )
  +   ## price indices for Missong03E7.7
  +   printIndices( "p",  c( "p.beef", "p.veal", "p.pork" ),
  +     c( "q.beef", "q.veal", "q.pork" ), 1, Missong03E7.7 )
  +   
  +   ## quantity indices for Missong03E7.7
  +   printIndices( "q",  c( "p.beef", "p.veal", "p.pork" ),
  +     c( "q.beef", "q.veal", "q.pork" ), 1, Missong03E7.7 )
  + }
  
   Laspeyres 
    1986   1987   1988   1989 
  1.0000 0.9840 0.9967 1.1255 
  attr(,"weights")
       p.beef  p.veal p.pork
  1986 0.3076 0.01992 0.6724
  1987 0.3101 0.02063 0.6692
  1988 0.3177 0.02161 0.6607
  1989 0.3060 0.02078 0.6733
  
   Paasche 
    1986   1987   1988   1989 
  1.0000 0.9840 0.9966 1.1251 
  attr(,"weights")
       p.beef  p.veal p.pork
  1986 0.3076 0.01992 0.6724
  1987 0.3082 0.02063 0.6711
  1988 0.3254 0.01727 0.6574
  1989 0.3107 0.01358 0.6757
  
   Fisher 
    1986   1987   1988   1989 
  1.0000 0.9840 0.9966 1.1253 
  attr(,"weights")
       p.beef  p.veal p.pork
  1986 0.3076 0.01992 0.6724
  1987 0.3092 0.02063 0.6702
  1988 0.3215 0.01944 0.6590
  1989 0.3084 0.01718 0.6745
  
   Laspeyres 
    1986   1987   1988   1989 
  1.0000 0.9706 0.8833 0.7429 
  attr(,"weights")
       q.beef  q.veal q.pork
  1986 0.3076 0.01992 0.6724
  1987 0.3057 0.01992 0.6744
  1988 0.3151 0.01592 0.6690
  1989 0.3123 0.01301 0.6746
  
   Paasche 
    1986   1987   1988   1989 
  1.0000 0.9706 0.8833 0.7427 
  attr(,"weights")
       q.beef  q.veal q.pork
  1986 0.3076 0.01992 0.6724
  1987 0.3082 0.02063 0.6711
  1988 0.3254 0.01727 0.6574
  1989 0.3107 0.01358 0.6757
  
   Fisher 
    1986   1987   1988   1989 
  1.0000 0.9706 0.8833 0.7428 
  attr(,"weights")
       q.beef  q.veal q.pork
  1986 0.3076 0.01992 0.6724
  1987 0.3070 0.02028 0.6728
  1988 0.3202 0.01660 0.6632
  1989 0.3115 0.01330 0.6752
  > 
  > ## Bleymueller79E25.1
  > if( requireNamespace( 'micEcon', quietly = TRUE ) ) {
  +   data( Bleymueller79E25.1, package = "micEcon" )
  +   ## price indices for Bleymueller79E25.1
  +   printIndices( "p",  c( "p.A", "p.B", "p.C", "p.D" ),
  +     c( "q.A", "q.B", "q.C", "q.D" ),  1, Bleymueller79E25.1 )
  +   
  +   ## quantity indices for Bleymueller79E25.1
  +   printIndices( "q",  c( "p.A", "p.B", "p.C", "p.D" ),
  +     c("q.A", "q.B", "q.C", "q.D" ), 1, Bleymueller79E25.1 )
  + }
  
   Laspeyres 
   1970  1974  1978 
  1.000 1.697 1.887 
  attr(,"weights")
          p.A    p.B    p.C    p.D
  1970 0.3077 0.1538 0.1282 0.4103
  1974 0.3021 0.1088 0.2266 0.3625
  1978 0.3397 0.1141 0.1766 0.3696
  
   Paasche 
   1970  1974  1978 
  1.000 1.582 1.799 
  attr(,"weights")
          p.A    p.B    p.C    p.D
  1970 0.3077 0.1538 0.1282 0.4103
  1974 0.3200 0.2400 0.1600 0.2800
  1978 0.3226 0.2516 0.1438 0.2820
  
   Fisher 
   1970  1974  1978 
  1.000 1.639 1.843 
  attr(,"weights")
          p.A    p.B    p.C    p.D
  1970 0.3077 0.1538 0.1282 0.4103
  1974 0.3111 0.1744 0.1933 0.3213
  1978 0.3311 0.1829 0.1602 0.3258
  
   Laspeyres 
   1970  1974  1978 
  1.000 1.215 1.546 
  attr(,"weights")
          q.A    q.B     q.C    q.D
  1970 0.3077 0.1538 0.12821 0.4103
  1974 0.3038 0.3165 0.08439 0.2954
  1978 0.2786 0.3234 0.09950 0.2985
  
   Paasche 
   1970  1974  1978 
  1.000 1.133 1.474 
  attr(,"weights")
          q.A    q.B    q.C    q.D
  1970 0.3077 0.1538 0.1282 0.4103
  1974 0.3200 0.2400 0.1600 0.2800
  1978 0.3226 0.2516 0.1438 0.2820
  
   Fisher 
   1970  1974  1978 
  1.000 1.173 1.510 
  attr(,"weights")
          q.A    q.B    q.C    q.D
  1970 0.3077 0.1538 0.1282 0.4103
  1974 0.3119 0.2782 0.1222 0.2877
  1978 0.3006 0.2875 0.1216 0.2903
  > 
  > ## Electricity (Christensen & Greene 1976)
  > if( requireNamespace( 'Ecdat', quietly = TRUE ) ) {
  +   data( "Electricity", package = "Ecdat" )
  +   Electricity <- Electricity[ 1:35, ]
  +   ## preparing electricity data
  +   pNames <- c( "pl", "pk", "pf" )
  +   qNames <- c( "ql", "qk", "qf" )
  +   sNames <- c( "sl", "sk", "sf" )
  +   for( i in 1:3 ) {
  +     Electricity[[ qNames[ i ] ]] <- Electricity[[ sNames[ i ] ]] *
  +       Electricity[[ "cost" ]] / Electricity[[ pNames[ i ] ]]
  +   }
  +   allObs <- !is.na( Electricity$pl )
  +   
  +   ## price indices for Electricity data
  +   printIndices( "p",  pNames, qNames, 1, Electricity )
  +   
  +   ## quantity indices for Electricity data
  +   printIndices( "q",  pNames, qNames, 1, Electricity )
  +   
  +   ## price indices for Electricity data and base=mean
  +   printIndices( "p",  pNames, qNames, allObs, Electricity )
  +   
  +   ## quantity indices for Electricity data and base=mean
  +   printIndices( "q",  pNames, qNames, allObs, Electricity )
  + }
  > 
  > ## Electricity data with some NA prices
  > ## manipulating data of Electricity data
  > if( requireNamespace( 'micEcon', quietly = TRUE ) ) {
  +   ElectricityNaP <- Electricity
  +   for( i in 1:3 ) {
  +     ElectricityNaP[[ pNames[ i ] ]][ c( 2, i * 4, i * 8 ) ] <- NA
  +   }
  +   
  +   ## price indices for Electricity data with some NA prices
  +   printIndices( "p",  pNames, qNames, 1, ElectricityNaP )
  +   
  +   ## quantity indices for Electricity data with some NA prices
  +   printIndices( "q",  pNames, qNames, 1, ElectricityNaP )
  +   
  +   ## price indices for Electricity data with some NA prices and na.rm=TRUE
  +   printIndices( "p",  pNames, qNames, 1, ElectricityNaP, na.rm = TRUE )
  +   
  +   ## quantity indices for Electricity data with some NA prices and na.rm=TRUE
  +   printIndices( "q",  pNames, qNames, 1, ElectricityNaP, na.rm = TRUE )
  +   
  +   ## price indices for Electricity data with some NA prices and base=mean
  +   printIndices( "p",  pNames, qNames, 16, ElectricityNaP )
  +   
  +   ## quantity indices for Electricity data with some NA prices and base=mean
  +   printIndices( "q",  pNames, qNames, allObs, ElectricityNaP )
  +   
  +   ## price indices for Electricity data with some NA prices and na.rm=TRUE and base=mean
  +   printIndices( "p",  pNames, qNames, allObs, ElectricityNaP, na.rm = TRUE )
  +   
  +   ## quantity indices for Electricity data with some NA prices and na.rm=TRUE and base=mean
  +   printIndices( "q",  pNames, qNames, allObs, ElectricityNaP, na.rm = TRUE )
  + }
  Error: object 'Electricity' not found
  Execution halted