On Tuesday 05 February 2008 (15:54:26), Daniel Dunn wrote: > I have a related question. Suppose I generate a series of linear models > > modco=list() > modco[[length(modco)+1]]=lm(normskvop ~ I(nts^0.5)-1, data = colo, > weights=wtz) > modco[[length(modco)+1]]=lm(normskvop ~ I(nts^0.5)-1, data = colo, > weights=wtz, subset=sector!="X") > modco[[length(modco)+1]]=lm(normskvop ~ I(nts^0.5)-1, data = colo, > weights=wtz, subset=sector!="A") > modco[[length(modco)+1]]=lm(normskvop ~ I(nts^0.5)-1, data = colo, > weights=wtz, subset=sector=="A") > modco[[length(modco)+1]]=lm(normskvop ~ I(nts^0.5)-1, data = colo, > weights=wtz, subset=sector=="M") > > I would like to have a table of the coefficients (including the t value & > the Pr(>|t|) value) of the five models akin to Peter Dalgaard's elegant > "sapply(t,unlist)" solution below. >
If I am not mistaken, what you want is the following: 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))) Best, 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.