[R] extract standard errors, write them to file

Indermaur Lukas
Fri, 12 Jan 2007 13:55:26 -0000

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: lukas.indermaur at eawag.ch