An undergraduate here, so do not hesitate to let me know if you feel that I'm heading in a wrong direction.
I have a data frame containing panel data across 10 years (hence 120 months). I want to be able to run regression separately for each month (or year). The below shows how I ran the regression for each month, but I need to know how I would combine the regression results together into a matrix possibly. Thank you! Mike ------------------------------- m = max(data$TIME) # define regmatrix for(i in 1:m){ g=runreg(data, i) # attach g to regmatrix } runreg = function(data, index){ datainterim = subset(data, TIME==index) g = lrm(X ~ A + B, datainterim) return(g) } [[alternative HTML version deleted]] ______________________________________________ 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.