Yeah thanks guys.  I can utilize this update function to help clean things
up.  It's not as simple as I was hoping though. Also, Bert, by updating the
data argument, don't I still have to update the model anyway to take
advantage of the extra covariates?

Justin

On Wed, Oct 5, 2011 at 12:55 PM, Bert Gunter <gunter.ber...@gene.com> wrote:

> Ista:
>
> But I think the problem here is how to update the model formula. I see no
> "simple" way to do that (it can be done straightforwardly enough, but I
> wouldn't consider it simple).
>
> ... But perhaps what you meant is to update the data argument like this:
>
> cntrl <- data.frame(...)  ##response + unchanging base variables
>
> mdl1 <- lm(resp ~ ., data =cntrl)  ## just base covariates
>
> mdlx <- update(mdl1, data = cbind(cntrl, xdat) )  ## where xdat is data
> frame with extra covariates.
>
> ?formula
>
>
> Cheers,
> Bert
>
>
> On Wed, Oct 5, 2011 at 12:37 PM, Ista Zahn <iz...@psych.rochester.edu>wrote:
>
>> Hi Justin,
>>
>> On Wed, Oct 5, 2011 at 3:32 PM, justin jarvis
>> <littledude.jar...@gmail.com> wrote:
>> > Hi all,
>> > I am running regressions with many covariates, most of which remain the
>> same
>> > each time (control variables).  Instead of writing 30 demographic
>> variables
>> > every regression, is there a way I could call them all at once using a
>> > variable called, perhaps "demog"?
>>
>> I would create a base model with just the covariates, and then use
>> update() to add other variables.
>>
>> Best,
>> Ista
>>
>> >
>> > I have tried:
>> >> demog <- list(age1, age2, age3) but I get an error when I try to call a
>> > list in a regression.
>> >
>> > I also tried:
>> >> demog <- cbind(age1, age2, age3) which allows me to run a regression,
>> but
>> > this is not practical because when I subset the original data set and
>> run a
>> > regression, this new matrix demog doesn't get subsetted as well, so the
>> > variables are of differing length.
>> >
>> > I'm thinking there is an easy way to do this.  Thanks for any help
>> > guys/gals.
>> >
>> > Justin
>> > PhD student,
>> > University of California, Irvine
>> >
>> >        [[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.
>> >
>>
>>
>>
>> --
>> Ista Zahn
>> Graduate student
>> University of Rochester
>> Department of Clinical and Social Psychology
>> http://yourpsyche.org
>>
>> ______________________________________________
>> 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.
>>
>
>
>
> --
> "Men by nature long to get on to the ultimate truths, and will often be
> impatient with elementary studies or fight shy of them. If it were possible
> to reach the ultimate truths without the elementary studies usually prefixed
> to them, these would not be preparatory studies but superfluous diversions."
>
> -- Maimonides (1135-1204)
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
>
>
>

        [[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.

Reply via email to