[R] Dummy variables model

Christoph Buser buser at stat.math.ethz.ch
Mon Sep 5 16:47:16 CEST 2005


Hi

If you'd like to fit a fixed effect model without random
effects, you can use lm() or aov() (see ?lm and ?aov). If your
variable is a factor (?factor) then you can specify your model
in lm() without coding all dummy variables.

Regards,

Christoph Buser

--------------------------------------------------------------
Christoph Buser <buser at stat.math.ethz.ch>
Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology)	8092 Zurich	 SWITZERLAND
phone: x-41-44-632-4673		fax: 632-1228
http://stat.ethz.ch/~buser/
--------------------------------------------------------------


Tobias Muhlhofer writes:
 > 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 at 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
 > 
 > 
 > !DSPAM:431c4675196241771238468!




More information about the R-help mailing list