Re: [R] Sorting data for multiple regressions

2007-08-06 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 04.08.2007 07:49:16:

> Well, R has a by() function that does what you want, and its help page 
> contains an example of doing regression by group.
> 
> (There are other ways.)

E.g. you can split your data into list

d.s <- split(data, data$site)

and then use lapply to perform your task on all parts of this list
result <- lapply(d.s, function)

Regards
Petr

> 
> On Fri, 3 Aug 2007, Paul Young wrote:
> 
> > So I am trying to perform a robust regression (fastmcd in the robust
> > package) on a dataset and I want to perform individual regressions 
based
> 
> fastmcd does not do regression ... or I would have adapted the ?by 
> example to show you.
> 
> > on the groups within the data.  We have over 300 sites and we want to
> > perform a regression based on the day of week and the hour for every
> > site.  I was wondering if anyone knows of a "'by' command similar to 
the
> > one used in SAS that automatically groups the data for the 
regressions.
> > If not, does anyone have any tips on how to split the data into 
smaller
> > sets and then perform the regression on each set.  I am new to R, so I
> > don't know all of the common work arounds and such.  At the moment the
> > only method I can think of is to split the data using condition
> > statements and manually running the regression on each set.  Thanks or
> > your help
> >
> > -Paul
> 
> 
> -- 
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
> 
> __
> R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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.


Re: [R] Sorting data for multiple regressions

2007-08-03 Thread Prof Brian Ripley
Well, R has a by() function that does what you want, and its help page 
contains an example of doing regression by group.

(There are other ways.)

On Fri, 3 Aug 2007, Paul Young wrote:

> So I am trying to perform a robust regression (fastmcd in the robust
> package) on a dataset and I want to perform individual regressions based

fastmcd does not do regression ... or I would have adapted the ?by 
example to show you.

> on the groups within the data.  We have over 300 sites and we want to
> perform a regression based on the day of week and the hour for every
> site.  I was wondering if anyone knows of a "'by' command similar to the
> one used in SAS that automatically groups the data for the regressions.
> If not, does anyone have any tips on how to split the data into smaller
> sets and then perform the regression on each set.  I am new to R, so I
> don't know all of the common work arounds and such.  At the moment the
> only method I can think of is to split the data using condition
> statements and manually running the regression on each set.  Thanks or
> your help
>
> -Paul


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch 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] Sorting data for multiple regressions

2007-08-03 Thread Paul Young
So I am trying to perform a robust regression (fastmcd in the robust
package) on a dataset and I want to perform individual regressions based
on the groups within the data.  We have over 300 sites and we want to
perform a regression based on the day of week and the hour for every
site.  I was wondering if anyone knows of a "'by' command similar to the
one used in SAS that automatically groups the data for the regressions.
If not, does anyone have any tips on how to split the data into smaller
sets and then perform the regression on each set.  I am new to R, so I
don't know all of the common work arounds and such.  At the moment the
only method I can think of is to split the data using condition
statements and manually running the regression on each set.  Thanks or
your help

-Paul
 
 _

 
CONFIDENTIALITY NOTICE\ IMPORTANT: This communication, toget...{{dropped}}

__
R-help@stat.math.ethz.ch 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.