On Wednesday 06 February 2008 (09:34:53), Dieter Menne wrote:
> Martin Elff <elff <at> sowi.uni-mannheim.de> writes:
> > modco <- list(
> >     lm(normskvop ~ I(nts^0.5)-1, data = colo,weights=wtz),
> >     lm(normskvop ~ I(nts^0.5)-1, data = colo,weights=wtz,
> > subset=sector!="X"), lm(normskvop ~ I(nts^0.5)-1, data =
> > colo,weights=wtz, subset=sector!="A"), lm(normskvop ~ I(nts^0.5)-1, data
> > = colo,weights=wtz, subset=sector=="A"), lm(normskvop ~ I(nts^0.5)-1,
> > data = colo,weights=wtz, subset=sector=="M") )
> >
> > sapply(modco,function(x) coef(summary(x)))
>
> This works, but consider if
>
> lm(normskvop ~ I(nts^0.5)-1+sector, data = colo,weights=wtz),
>
> is a better approach anyway.

Hmm. Maybe if Daniel intended to do:

# Note now it is sector=="A" instead of sector!="A"

 modco <- list( 
       lm(normskvop ~ I(nts^0.5)-1, data = colo,weights=wtz,
                                           subset=sector=="X"),
       lm(normskvop ~ I(nts^0.5)-1, data = colo,weights=wtz,
                                           subset=sector=="A"),
       lm(normskvop ~ I(nts^0.5)-1, data = colo,weights=wtz,
                                           subset=sector=="A"),
       lm(normskvop ~ I(nts^0.5)-1, data = colo,weights=wtz,
                                           subset=sector=="M")
       )

But in that case 
lm(normskvop ~ sector/I(nts^0.5), data = colo,weights=wtz)

or

lm(normskvop ~ sector/I(nts^0.5) - sector, data = colo,weights=wtz)

would be the "better" approach.

Martin

______________________________________________
R-help@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.

Reply via email to