Re: [R] [r] regression coefficient for different factors

2011-05-23 Thread Francesco Nutini
: Re: [R] [r] regression coefficient for different factors From: dimitri.liakhovit...@gmail.com To: nutini.france...@gmail.com CC: rb...@atsu.edu; r-help@r-project.org I think you don't need to write temp.data$a ~ temp.data$b just a ~ b On Fri, May 20, 2011 at 11:45 AM, Francesco Nutini

[R] [r] regression coefficient for different factors

2011-05-20 Thread Francesco Nutini
Dear R-helpers, In my dataset I have two continuous variable (A and B) and one factor. I'm investigating the regression between the two variables usign the command lm(A ~ B, ...) but now I want to know the regression coefficient (r2) of A vs. B for every factors. I know that I can obtain this

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Robert Baer
-- From: Francesco Nutini nutini.france...@gmail.com Sent: Friday, May 20, 2011 4:17 AM To: [R] help r-help@r-project.org Subject: [R] [r] regression coefficient for different factors Dear R-helpers, In my dataset I have two continuous variable (A and B

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Francesco Nutini
To: nutini.france...@gmail.com; r-help@r-project.org Subject: Re: [R] [r] regression coefficient for different factors Date: Fri, 20 May 2011 08:07:59 -0500 ?summary produces r^2 in 2nd to last line, as in, set.seed(12); a=rnorm(100); b = runif(100); c = factor(rep(c('No', 'Yes'),50)); df

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Dimitri Liakhovitski
...@atsu.edu To: nutini.france...@gmail.com; r-help@r-project.org Subject: Re: [R] [r] regression coefficient for different factors Date: Fri, 20 May 2011 08:07:59 -0500 ?summary produces r^2 in 2nd to last line, as in, set.seed(12); a=rnorm(100); b = runif(100); c = factor(rep(c('No', 'Yes

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Dimitri Liakhovitski
nutini.france...@gmail.com wrote: Yes Dimitri that's what I mean! Something like this? for(i in levels(c)) { lm(a ~  b *  c , data=mydataset)} And what about to see the output? Thanks! Date: Fri, 20 May 2011 09:46:08 -0400 Subject: Re: [R] [r] regression coefficient for different factors From

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Dimitri Liakhovitski
=mydataset)} And what about to see the output? Thanks! Date: Fri, 20 May 2011 09:46:08 -0400 Subject: Re: [R] [r] regression coefficient for different factors From: dimitri.liakhovit...@gmail.com To: nutini.france...@gmail.com CC: rb...@atsu.edu; r-help@r-project.org Francesco, do

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Greg Snow
- project.org] On Behalf Of Francesco Nutini Sent: Friday, May 20, 2011 3:18 AM To: [R] help Subject: [R] [r] regression coefficient for different factors Dear R-helpers, In my dataset I have two continuous variable (A and B) and one factor. I'm investigating the regression between the two

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Francesco Nutini
in `[.data.frame`(mydataset, niger$site %in% i) : undefined columns selected Date: Fri, 20 May 2011 10:01:39 -0400 Subject: Re: [R] [r] regression coefficient for different factors From: dimitri.liakhovit...@gmail.com To: nutini.france...@gmail.com CC: rb...@atsu.edu; r-help@r-project.org First

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread David Winsemius
: [R] [r] regression coefficient for different factors From: dimitri.liakhovit...@gmail.com To: nutini.france...@gmail.com CC: rb...@atsu.edu; r-help@r-project.org First you have to create something (e.g., a list) that holds your output: mylist-NULL Then you loop through the levels of c and run

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Bill.Venables
3.059960 Bill Venables From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Francesco Nutini [nutini.france...@gmail.com] Sent: 20 May 2011 19:17 To: [R] help Subject: [R] [r] regression coefficient for different factors Dear R

Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Dennis Murphy
...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Francesco Nutini [nutini.france...@gmail.com] Sent: 20 May 2011 19:17 To: [R] help Subject: [R] [r] regression coefficient for different factors Dear R-helpers, In my dataset I have two continuous variable (A and B) and one factor