search for: modelobs91

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

Did you mean: modelobs1
2012 Jan 11
3
Accomplishing a loop on multiple columns
...ately: 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 automatically and not 91 times. I tried to use a for loop: ###(length(C) = 91) results7<-data.frame(lm.modelobs=rep(NA,length(C))) for (i in (1:91...