Running 'Ch-Basics.R' [3s]
  Comparing 'Ch-Basics.Rout' to 'Ch-Basics.Rout.save' ... OK
  Running 'Ch-Intro.R' [4s]
  Comparing 'Ch-Intro.Rout' to 'Ch-Intro.Rout.save' ... OK
  Running 'Ch-LinearRegression.R' [4s]
  Running 'Ch-Microeconometrics.R' [0s]
  Running 'Ch-Programming.R' [0s]
  Running 'Ch-TimeSeries.R' [0s]
  Running 'Ch-Validation.R' [60s]
  Comparing 'Ch-Validation.Rout' to 'Ch-Validation.Rout.save' ... OK
Running the tests in 'tests/Ch-LinearRegression.R' failed.
Complete output:
  > if(!requireNamespace("splines") ||
  +    !requireNamespace("dynlm") ||
  +    !requireNamespace("plm") ||
  +    !requireNamespace("systemfit") ||
  +    !requireNamespace("nlme")) q()
  Loading required namespace: splines
  Loading required namespace: dynlm
  Loading required namespace: plm
  Loading required namespace: systemfit
  > 
  > ###################################################
  > ### chunk number 1: setup
  > ###################################################
  > options(prompt = "R> ", continue = "+  ", width = 64,
  +   digits = 4, show.signif.stars = FALSE, useFancyQuotes = FALSE)
  R> 
  R> options(SweaveHooks = list(onefig =   function() {par(mfrow = c(1,1))},
  +                             twofig =   function() {par(mfrow = c(1,2))},                           
  +                             threefig = function() {par(mfrow = c(1,3))},
  +                             fourfig =  function() {par(mfrow = c(2,2))},
  +                             sixfig =   function() {par(mfrow = c(3,2))}))
  R> 
  R> library("AER")
  Loading required package: car
  Loading required package: carData
  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: sandwich
  Loading required package: survival
  R> 
  R> suppressWarnings(RNGversion("3.5.0"))
  R> set.seed(1071)
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 2: data-journals
  R> ###################################################
  R> data("Journals")
  R> journals <- Journals[, c("subs", "price")]
  R> journals$citeprice <- Journals$price/Journals$citations
  R> summary(journals)
        subs          price        citeprice     
   Min.   :   2   Min.   :  20   Min.   : 0.005  
   1st Qu.:  52   1st Qu.: 134   1st Qu.: 0.464  
   Median : 122   Median : 282   Median : 1.321  
   Mean   : 197   Mean   : 418   Mean   : 2.548  
   3rd Qu.: 268   3rd Qu.: 541   3rd Qu.: 3.440  
   Max.   :1098   Max.   :2120   Max.   :24.459  
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 3: linreg-plot eval=FALSE
  R> ###################################################
  R> ## plot(log(subs) ~ log(citeprice), data = journals)
  R> ## jour_lm <- lm(log(subs) ~ log(citeprice), data = journals)
  R> ## abline(jour_lm)
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 4: linreg-plot1
  R> ###################################################
  R> plot(log(subs) ~ log(citeprice), data = journals)
  R> jour_lm <- lm(log(subs) ~ log(citeprice), data = journals)
  R> abline(jour_lm)
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 5: linreg-class
  R> ###################################################
  R> class(jour_lm)
  [1] "lm"
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 6: linreg-names
  R> ###################################################
  R> names(jour_lm)
   [1] "coefficients"  "residuals"     "effects"      
   [4] "rank"          "fitted.values" "assign"       
   [7] "qr"            "df.residual"   "xlevels"      
  [10] "call"          "terms"         "model"        
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 7: linreg-summary
  R> ###################################################
  R> summary(jour_lm)
  
  Call:
  lm(formula = log(subs) ~ log(citeprice), data = journals)
  
  Residuals:
      Min      1Q  Median      3Q     Max 
  -2.7248 -0.5361  0.0372  0.4662  1.8481 
  
  Coefficients:
                 Estimate Std. Error t value Pr(>|t|)
  (Intercept)      4.7662     0.0559    85.2   <2e-16
  log(citeprice)  -0.5331     0.0356   -15.0   <2e-16
  
  Residual standard error: 0.75 on 178 degrees of freedom
  Multiple R-squared:  0.557,	Adjusted R-squared:  0.555 
  F-statistic:  224 on 1 and 178 DF,  p-value: <2e-16
  
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 8: linreg-summary
  R> ###################################################
  R> jour_slm <- summary(jour_lm)
  R> class(jour_slm)
  [1] "summary.lm"
  R> names(jour_slm)
   [1] "call"          "terms"         "residuals"    
   [4] "coefficients"  "aliased"       "sigma"        
   [7] "df"            "r.squared"     "adj.r.squared"
  [10] "fstatistic"    "cov.unscaled" 
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 9: linreg-coef
  R> ###################################################
  R> jour_slm$coefficients
                 Estimate Std. Error t value   Pr(>|t|)
  (Intercept)      4.7662    0.05591   85.25 2.954e-146
  log(citeprice)  -0.5331    0.03561  -14.97  2.564e-33
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 10: linreg-anova
  R> ###################################################
  R> anova(jour_lm)
  Analysis of Variance Table
  
  Response: log(subs)
                  Df Sum Sq Mean Sq F value Pr(>F)
  log(citeprice)   1    126   125.9     224 <2e-16
  Residuals      178    100     0.6               
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 11: journals-coef
  R> ###################################################
  R> coef(jour_lm)
     (Intercept) log(citeprice) 
          4.7662        -0.5331 
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 12: journals-confint
  R> ###################################################
  R> confint(jour_lm, level = 0.95)
                   2.5 %  97.5 %
  (Intercept)     4.6559  4.8765
  log(citeprice) -0.6033 -0.4628
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 13: journals-predict
  R> ###################################################
  R> predict(jour_lm, newdata = data.frame(citeprice = 2.11),
  +    interval = "confidence")
      fit   lwr   upr
  1 4.368 4.247 4.489
  R> predict(jour_lm, newdata = data.frame(citeprice = 2.11), 
  +    interval = "prediction")
      fit   lwr   upr
  1 4.368 2.884 5.853
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 14: predict-plot eval=FALSE
  R> ###################################################
  R> ## lciteprice <- seq(from = -6, to = 4, by = 0.25)
  R> ## jour_pred <- predict(jour_lm, interval = "prediction",
  R> ##   newdata = data.frame(citeprice = exp(lciteprice)))  
  R> ## plot(log(subs) ~ log(citeprice), data = journals)
  R> ## lines(jour_pred[, 1] ~ lciteprice, col = 1)    
  R> ## lines(jour_pred[, 2] ~ lciteprice, col = 1, lty = 2)
  R> ## lines(jour_pred[, 3] ~ lciteprice, col = 1, lty = 2)
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 15: predict-plot1
  R> ###################################################
  R> lciteprice <- seq(from = -6, to = 4, by = 0.25)
  R> jour_pred <- predict(jour_lm, interval = "prediction",
  +    newdata = data.frame(citeprice = exp(lciteprice)))  
  R> plot(log(subs) ~ log(citeprice), data = journals)
  R> lines(jour_pred[, 1] ~ lciteprice, col = 1)    
  R> lines(jour_pred[, 2] ~ lciteprice, col = 1, lty = 2)
  R> lines(jour_pred[, 3] ~ lciteprice, col = 1, lty = 2)
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 16: journals-plot eval=FALSE
  R> ###################################################
  R> ## par(mfrow = c(2, 2))
  R> ## plot(jour_lm)
  R> ## par(mfrow = c(1, 1))
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 17: journals-plot1
  R> ###################################################
  R> par(mfrow = c(2, 2))
  R> plot(jour_lm)
  R> par(mfrow = c(1, 1))
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 18: journal-lht
  R> ###################################################
  R> linearHypothesis(jour_lm, "log(citeprice) = -0.5")
  Linear hypothesis test
  
  Hypothesis:
  log(citeprice) = - 0.5
  
  Model 1: restricted model
  Model 2: log(subs) ~ log(citeprice)
  
    Res.Df RSS Df Sum of Sq    F Pr(>F)
  1    179 100                         
  2    178 100  1     0.484 0.86   0.35
  R> 
  R> 
  R> ###################################################
  R> ### chunk number 19: CPS-data
  R> ###################################################
  R> data("CPS1988")
  Error in load(zfile, envir = tmp_env) : empty (zero-byte) input file
  Calls: data -> load
  In addition: Warning message:
  In readChar(con, 5L, useBytes = TRUE) : lzma decoder needed more memory
  Execution halted
Running the tests in 'tests/Ch-Microeconometrics.R' failed.
Complete output:
  
Running the tests in 'tests/Ch-Programming.R' failed.
Complete output:
  
Running the tests in 'tests/Ch-TimeSeries.R' failed.
Complete output: