Quantcast

regsubsets {leaps}

classic Classic list List threaded Threaded
3 messages Options
fgg
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

regsubsets {leaps}

fgg
Hi,

I'd like to run regsubsets for model selection by exhaustive search. I have a list with 20 potential explanatory variables, which represent the real and the imaginary parts of 10 "kinds" of complex numbers:

x <- list(r1=r1, r2=r2, r3=r3, ..., r10=r10, i1=i1, i2=i2, i3=i3, ..., i10=i10)

Is there an easy way to constrain the model search so that "r"s and "i"s are treated as pairs that should always appear together in the models? i.e., in a way where only models like these:

y ~ r1, i1
y ~ r3, i3, r8, i8
y ~ r1, i1, r4, i4, r5, i5

are considered in the search, and models like the ones below are not:

y ~ r1, i8
y ~ r1, r3
y ~  r9, i5, i7

Sorry if this isn't very clear!

Thanks
fgg
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: regsubsets {leaps}

fgg
I've tried grouping the real and imaginary parts as a single complex number, e.g.

> z1 <- complex(real=r1, imaginary=i1)

Although complex variables are not allowed in lm, I can run regsubsets just fine:

> z <- cbind(z1, z2, z3, ..., z10)
> bestsubs <- regsubsets(z, y, nbest=1, nvmax=5, intercept=T, method="exhaustive", names=dimnames(x)[2])

The problem is that the code is using only one coefficient for each "z" (probably for the amplitude), and not one for the real part and one for the imaginary part, as I'd like to.

> coef(bestsubs,3)
(Intercept)         z1         z3         z4
 -397.43425   -35.86687   202.20521   716.02103

Any suggestions?

Thanks
fgg
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: regsubsets {leaps}

fgg
This post has NOT been accepted by the mailing list yet.
Hi there,

I keep getting emails from Nabble saying that this post "has not yet been accepted by the mailing list and is still in the pending status." Can people see it? It's not showing as pending to me.

Thanks
Loading...