[R] Exception in NeweyWest - Pre-Whitening necessary?
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Fri Sep 9 17:56:35 CEST 2011
On Fri, 9 Sep 2011, Simon Zehnder wrote:
> Hi guyz,
>
> I have run my algorithm in R (see http://pastebin.com/q84Tujfg) and got
> the following error:
This is not reproducible. There is only the script but no information
about how it is called. Also, within your script you call
NeweyWest(regression) -- however, "regression" is not defined within the
script!
> Error in ar.ols(x, aic = aic, order.max = order.max, na.action = na.action, :
> 'order.max' must be < 'n.used'
NeweyWest call ar() essentially with order.max = as.integer(prewhite)
which defaults to 1. Thus, the error must be caused by a model with
n.used <= 1 which suggests that it is not a very sensible model to start
with.
> I am pretty sure, that the error comes from the NeweyWest function in
> line 45, as the NeweyWest function uses the ar.ols() function for pre
> whitening. Does anyone has an idea how to circumvent this? Can I just
> shut off pre whitening?
Why don't you read the documentation in ?NeweyWest or in
vignette("sandwich", package = "sandwich")?
Z
> I am thankful for every suggestion.
>
> Simon
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list