Skip to content
Prev 280052 / 398506 Next

shorter way of coding

Hi
With lm you can use several dependent variables to get result, but I do 
not know if it works with gam.

You can put y1 - y300 to list and than use lapply or for cycle to do the 
analysis and store results in a list (list.y).

something like (untested)

for (i in 1:300) {

b[i] <- gam(list.y[i]~s(x1,x2, k=100, data=dat)

}

Regards
Petr
http://www.R-project.org/posting-guide.html