Re: [R] Dummy variables model

From: Tobias Muhlhofer <t.muhlhofer_at_lse.ac.uk>
Date: Tue 06 Sep 2005 - 00:53:55 EST

So are you guys saying to me that if I have variable firm which is the factor of all firm identifiers, I could just go

lm(y ~ x + firm)

and that will implicitly include a dummy for each level of factor firm, thus making this a fixed effects (aka LSDV) model?

T

Jean Eid wrote:

> You can turn the identity vector of the firms into a factor and do lm ....
> 
> Jean
> 
> On Mon, 5 Sep 2005, Tobias Muhlhofer wrote:
> 
> 

>>Hi, all!
>>
>>Anyone know an easy way to specify the following model.
>>
>>Panel dataset, with stock through time, by firm.
>>
>>I want to run a model of y on a bunch of explanatory variables, and one
>>dummy for each firm, which is 1 for observations that come from firm i,
>>and 0 everywhere else. I have over 200 firms (and a factor variable that
>> contains a firm identifier).
>>
>>Any easy way of going about this, without having to define all these
>>dummies? I checked lme() with random = ~ 1|firm, but the problem is that
>>these are random effects, i.e. that there are firm-by-firm disturbance
>>terms and overall disturbance terms, whereas I want just overall
>>disturbance terms. This is generally called a "fixed effects" model,
>>although it seems like the term "fixed effects" is being used somewhat
>>differently in the context of the nlme package.
>>
>>Toby
>>
>>--
>>**************************************************************************
>>When Thomas Edison invented the light bulb he tried over 2000
>>experiments before he got it to work. A young reporter asked
>>him how it felt to have failed so many times. He said
>>"I never failed once. I invented the light bulb.
>>It just happened to be a 2000-step process."
>>
>>______________________________________________
>>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
>>
> 
> 
> 

-- 
**************************************************************************
When Thomas Edison invented the light bulb he tried over 2000
experiments before he got it to work. A young reporter asked
him how it felt to have failed so many times. He said
"I never failed once. I invented the light bulb.
It just happened to be a 2000-step process."

______________________________________________
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
Received on Tue Sep 06 01:18:12 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:03 EST