Thanks all. Dennis provided the answer I was looking for - deviance(lm).

Cheers,

Brian

On Tue, Jan 25, 2011 at 8:48 PM, Dennis Murphy <djmuser@gmail.com> wrote:

> Hi:
>
> On Tue, Jan 25, 2011 at 10:36 AM, Greg Snow <Greg.Snow@imail.org> wrote:
>
>> It is not clear what you are doing or why you are doing it.  If you tell
>> us your ultimate goal we may be able to help you find a way that does not
>> require all the computing that you are doing.
>>
>> How do you get your coefficients? Are you using lm? Have you looked at the
>> resid function?
>>
>
> Thanks, Greg. I totally agree that a clearer explanation of the goals of
> this computing problem would be (very) useful. R has a number of ways to
> process subsets of data efficiently. One approach (although not unique)
> would be to (a) split the data into multiple subgroups; (b) run a lm() model
> in each subgroup; (c) export the model objects to a list; (d) extract the
> pieces of the output you want for all models run. Several examples of how to
> do this with enhanced apply-like functions in the plyr package are in the
> list archives, so this can be done with a bit of thinking and an
> understanding of what is wanted/needed...especially if you will need to do
> multiple sets of extractions from your set of model objects.
>
> If you find yourself doing the same thing over and over in R, you can bet
> there's a much more efficient way to do the computations. An explanation of
> the goals, a subset of data that illustrates the problem (preferably in
> dput() form) and showing what you've tried would be useful.
>
> Dennis
>
>>
>> --
>>
>> Gregory (Greg) L. Snow Ph.D.
>> Statistical Data Center
>> Intermountain Healthcare
>> greg.snow@imail.org
>> 801.408.8111
>>
>>
>> > -----Original Message-----
>> > From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-
>> > project.org] On Behalf Of Brian J Mingus
>> > Sent: Tuesday, January 25, 2011 9:08 AM
>> > To: R-help@r-project.org
>> > Subject: [R] Extracting SSE from lm
>> >
>> > Apologies for this simple question -
>> >
>> > Given the number of comparisons I need to do it has become somewhat
>> > laborious to compute the SSE manually. I first have to extract the
>> > coefficients, build the model and run the model on the data. So far I
>> > haven't found any method in R that will do this for me. Is there a
>> > method
>> > that I haven't seen, or is there a small function I could write that
>> > would
>> > do this, and how might I go about that?
>> >
>> > Thanks,
>> >
>> > Brian
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > 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.
>>
>
>

	[[alternative HTML version deleted]]

