cochrane.orcutt.jva: Cochrane-Orcutt Estimation

Description Usage Arguments Details Value References See Also Examples

View source: R/cochraneorcuttjva.R

Description

Interactive method using to solve first order autocorrelation problems. This procedure estimates both autocorrelation and beta coefficients recursively until we reach the convergence (8th decimal). The residuals are computed after estimating Beta using EGLS approach and Rho is estimated using the previous residuals.

Usage

1
cochrane.orcutt.jva(reg, convergence = 8, max.iter = 100)

Arguments

reg

a linear model built with lm function

convergence

decimal value to reach for convergence, 8 as default

max.iter

the maximum number of iterations to try before giving up on convergence, 100 as default

Details

This is a duplicate of the cochrane.orcutt() function from package orcutt version 2.2, with the addition of an upper limit on the number of iterations to avoid an infinite while() loop.

Value

An object of class "orcutt". See cochrane.orcutt

References

Verbeek M. (2004) A guide to modern econometrics, John Wiley & Sons Ltd, ISBN:978-88-08-17054-5

See Also

cochrane.orcutt

Examples

1
2
3
4
5
6
7
8
# example from orcutt package that converges
  data(icecream, package="orcutt")
  lm <- lm(cons ~ price + income + temp, data=icecream)
  cochrane.orcutt.jva(lm)
# another example that doesn't converge
  mydat <- data.frame(year=2013:2017, meas=c(14.8, 10.7, 6.2, 4, 3.9))
  lmfit <- lm(meas ~ year, data=mydat)
  cochrane.orcutt.jva(lmfit)

JVAdams/jvamisc documentation built on Aug. 11, 2021, 6:43 a.m.