search for: modelobs1

Displaying 1 result from an estimated 1 matches for "modelobs1".

Did you mean: modelobs
2012 Jan 11
3
Accomplishing a loop on multiple columns
...with one column with observed values. I use the function lm to fit the model and calculate r.squared. I manage to do this for each column separately: For example: my calculated results are in the dataframe ?results6?, my observed results in data, (data$observed). #To calculate R2 for column 1: lm.modelobs1 <- lm(results6[,c(1)] ~ data$observed) R2.1 <- summary(lm.modelobs1)["r.squared"] #To calculate R2 for column 91: lm.modelobs91 <- lm(results6[,c(91)] ~ data$observed) R2.91 <- summary(lm.modelobs91)["r.squared"] But I think there has to be a method to do this autom...