s-news
[Top] [All Lists]

Re: automate writing formulas

To: "Kamil Toth" <kamiltoth@yahoo.com>
Subject: Re: automate writing formulas
From: "Douglas Bates" <bates@stat.wisc.edu>
Date: Mon, 31 Jul 2006 07:25:16 -0500
Cc: s-news@lists.biostat.wustl.edu
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=Ym1WjvP63FxUWdo1FjKDSCePBHZNT2DbOM1tUYFVci+3YV1lHz1laZk1lIs0W8gnbcnYQhbcH26gIkjeT7VTI34xvejpHcjvV7YCFFZSDnxDXIpClyWWIkg9XLb/ViXNt2fOAmXEisksSW0fNS/kr/wE57qE9m9RrIvey6GgKLo=
In-reply-to: <20060729223630.14477.qmail@web35812.mail.mud.yahoo.com>
References: <20060729223630.14477.qmail@web35812.mail.mud.yahoo.com>
On 7/29/06, Kamil Toth <kamiltoth@yahoo.com> wrote:

Folks:
I have encountered a really funny problem. I am trying to apply the "lm" to
the regression problem with hundreds (possibly even thousands) exploratory
variables. Putting aside for the time being the question of computational
feasibility and/or accuracy, let me ask how to make even the first step in
modeling, i.e. to write a formula. I need to have something like this:
F~x1+x2+x3+....+x1000. I do not want of course to write all the "x"s by
hands. But how to automate writing the formula?

One way to do this is to create a data frame tha contains only the
response and the explanatory variables and use a formula of the form

lm(y ~ ., myDataFrame)

That formula is interpretted to mean "fit y to all the other variables
in myDataFrame".

I don't think this answer will be terribly useful to you because
questions of computational feasibility and accuracy and even
interpretability will begin to dominate long before you get to 1000
explanatory variables.

<Prev in Thread] Current Thread [Next in Thread>