I use this function to adjust the lm models 101 times:
models <- dlply(mee_chua_sort, "mu", function(df)
lm(nachher~vorher, data = df))
now I want to extract not only the estimates from the models - which I do using:
mod_coef<-ldply(models, coef)
I want to be apble to extract also the standard deviation, p-value and so on. If I try to use something like:
mod_coef1<-ldply(models, coef(summary(models))[,'Std.Error'])
I get the error: Error: $ operator is invalid for atomic vectors
Could anybody help me on that? I want to to save the other values in a df as I did with mod_coef
Thanks
The issue is with ldply(models, coef(summary(models)), inside the ldply, you are looping through models and the function needs to work on each element of the list. You need to write a function that does summary first, followed by coef, see