[R] algorithm -- generating combinations
Warnes, Gregory R
gregory_r_warnes at groton.pfizer.com
Sat May 4 16:06:17 CEST 2002
It sounds like you want to do 'all possible subsets' regression. There are
a couple of packages that address this, leaps and subsets. See
If you really want to examine all possible subsets yourself, you can use the
te combinations() from the package gregmisc to compute all the combinations
of the column names.
> -----Original Message-----
> From: Lukas Kubin [mailto:lukas.kubin at permonik.com]
> Sent: Saturday, May 04, 2002 4:15 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] algorithm -- generating combinations
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> I would like to code a script which processess all possible
> of matrix columns. The purpose of such operation is to
> automatically find
> best combination of factors (not those factors in mean of R, but
> explaining factors -- independent variables) received from lm(). The
> independent variables are present in columns of the matrix.
> I am not a skilled programmer and I would like to ask someone
> to help me
> create an algorithm generating the factors' combination so
> that I can work
> with them further. What I need is: Let's say I have 3 matrix
> columns --
> x1, x2, x3. The algorithm returns combinations x1 x2 x3; x1
> x2; x2 x3; x1
> x3; x1; x2; x3. It should also allow to limit the resulting set of
> variables to contain at least a given number of items. For
> example: limit
> is 2, algorithm returns x1 x2 x3; x1 x2; x2 x3 and x1 x3.
> Which format should be the returned result? A vector? I will
> need to use
> it way like: matrix[, c(1, 2, 3)] for a returned set x1 x2 x3.
> I am almost sure all I am looking for has someone already done. I will
> appreciate any help.
> Thank you.
> - --
> Lukas Kubin
> lukas.kubin at permonik.com
> phone: 00420603836180
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.5 (GNU/Linux)
> Comment: Made with pgp4pine 1.75-6
> -----END PGP SIGNATURE-----
> r-help mailing list -- Read
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To:
> r-help-request at stat.math.ethz.ch
Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help