?summary.lm suggests that you can use $r.squared or $adj.r.squared. (Look under value)
Two style notes: preallocate your beta vector (don't grow it dynamically like you are doing now) and it's generally a little safer to use summary(....)[["r.squared"]] than the dollar sign notation. (Though it won't matter here) Michael On Wed, Feb 1, 2012 at 4:09 PM, Botrel <pamela.bot...@hotmail.com> wrote: > I'm needing to remove the R-squared , and put this in a vector. It's the same > that I do with the Beta or alfa in a linear regression: > > beta <- vector() ## beta > > for (i in 1:ncol(ret)){ > > beta[i] <- summary(lm((ret[,i] - ret.selic.ibov[,1]) ~ rmrf[,1] + > max[,1]))*$coef[[2]]* > } > > So, I need to know what I'll put after* $*. > > Thanks. > > -- > View this message in context: > http://r.789695.n4.nabble.com/R-squared-how-can-I-do-to-put-this-in-a-vector-tp4349460p4349460.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. ______________________________________________ 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.