Indermaur Lukas said the following on 1/12/2007 7:55 AM: > Hello > > I want to repeatedly extract coefficients and standard errors from a GLM and > write them into a file (1row=all coefficients of model A, 2 row=all > coefficients of model B, etc.). I can extract coefficients but not standard > errors. furthermore I fail to write extracted values line by line into the > predifined matrix G. > > I appreciate any idea to solve the problem > > best regards > > Lukas > > > > #---------start > code------------------------------------------------------------------------------------------------------------------------------------ > > global <- formula(logHRS~Ri + E + Co + LWD +Alwd > +W + T2 + A + N + Sex + y) #1 > richness_evenness <- formula(logHRS~Ri + E + D1 + D2 +D3 +D4 + D5 > + D6 + N + Sex + y) #2 > > all_models <- c(global, richness_evenness) > for (i in 1:length(all_models)) > { > ts.model <- glm(all_models[[i]],family=gaussian,data=t.data) > G <- matrix(NA,length(all_models),length(all_models)) > G <- coefficients(ts.model) #regression coefficents > (betas) > } > write.table(G, paste(t.url, file="Coefficients.txt"), sep="\t", quote=F) > > #---------end > code------------------------------------------------------------------------------------------------------------------------------------- > > > > °°° > Lukas Indermaur, PhD student > eawag / Swiss Federal Institute of Aquatic Science and Technology > ECO - Department of Aquatic Ecology > Überlandstrasse 133 > CH-8600 Dübendorf > Switzerland > > Phone: +41 (0) 71 220 38 25 > Fax : +41 (0) 44 823 53 15 > Email: [EMAIL PROTECTED] > www.lukasindermaur.ch > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code.
Your code is barely readable because of poor spacing, but I believe you want: coef(summary(ts.model))[, 1:2] --sundar ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.