[R] Omitting constant in ols() from Design

2005-01-17 Thread Tobias Muhlhofer
Hi!
I need to run ols regressions with Huber-White sandwich estimators and 
the correponding standard errors, without an intercept. What I'm trying 
to do is create an ols object and then use the robcov() function, on the 
order of:

f - ols(depvar ~ ind1 + ind2, x=TRUE)
robcov(f)
However, when I go
f - ols(depvar ~ ind1 + ind2 -1, x=TRUE)
I get the following error:
Error in ols(nareit ~ SnP500 + d3yrtr - 1) :
length of dimnames [2] not equal to array extent
same with +0 instead of -1.
Is there a different way to create an ols object without a constant? I 
can't use lm(), because robcov() needs an object from the Design() series.

Or is there a different way to go about this?
Tobias Muhlhofer
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Omitting constant in ols() from Design

2005-01-17 Thread Achim Zeileis
On Mon, 17 Jan 2005 14:57:33 + Tobias Muhlhofer wrote:

 Hi!
 
 I need to run ols regressions with Huber-White sandwich estimators and
 the correponding standard errors, without an intercept. What I'm
 trying to do is create an ols object and then use the robcov()
 function, on the order of:
 
 f - ols(depvar ~ ind1 + ind2, x=TRUE)
 robcov(f)
 
 However, when I go
 
 f - ols(depvar ~ ind1 + ind2 -1, x=TRUE)
 
 I get the following error:
 
 Error in ols(nareit ~ SnP500 + d3yrtr - 1) :
  length of dimnames [2] not equal to array extent
 
 same with +0 instead of -1.
 
 Is there a different way to create an ols object without a constant? I
 can't use lm(), because robcov() needs an object from the Design()
 series.
 
 Or is there a different way to go about this?

I am not sure if the problem can also be avoided or worked around in
Design, but the functions hccm() from car or vcovHC() from sandwich can
also compute the Huber-White (and other) HC covariance matrix estimates
for fitted lm objects.
For computing the corresponding t-tests or z-tests, you can use the
function coeftest() in lmtest. See the corresponding man page for
examples.

Best,
Z

 Tobias Muhlhofer
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Omitting constant in ols() from Design

2005-01-17 Thread Frank E Harrell Jr
Tobias Muhlhofer wrote:
Hi!
I need to run ols regressions with Huber-White sandwich estimators and 
the correponding standard errors, without an intercept. What I'm trying 
to do is create an ols object and then use the robcov() function, on the 
order of:

f - ols(depvar ~ ind1 + ind2, x=TRUE)
robcov(f)
However, when I go
f - ols(depvar ~ ind1 + ind2 -1, x=TRUE)
I get the following error:
Error in ols(nareit ~ SnP500 + d3yrtr - 1) :
length of dimnames [2] not equal to array extent
same with +0 instead of -1.
Is there a different way to create an ols object without a constant? I 
can't use lm(), because robcov() needs an object from the Design() series.

Or is there a different way to go about this?
Tobias Muhlhofer
ols does not support this.  Sorry.
--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html