is there a fast way to enter many interaction terms?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

is there a fast way to enter many interaction terms?

Marina-29
Hi,

I have a logistical question - I need to compute about 500 interaction
terms, therefore, I'm wondering if there are any shortcuts for doing this?
As opposed to just computing one, and then copying many times in the
syntax.

Thanks!

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: is there a fast way to enter many interaction terms?

Maguin, Eugene
Marina,

I think there are two interaction variable structures that you may be faced
with. One, the simplest, is that you have one variable, call it X, that will
interact with each of a list of variables, call this list A1 to A30 B29 to
B46. This structure is easily accomodated with a Do repeat command.

Do repeat a=A1 to A30 B29 to B46/b=X_A1 X_A2 ... X_B46.
+  compute b=X*a.
End repeat.

The other structure is that you have a list of variables that will interact
with another list of variables. There are two substructures to consider
here. One is where the two lists are, for example, A1 to A30 and B29 to B46.
The key elements are that variables in each list have a common stem, in this
example: A and B. This allows you to use the loop command with vectors. Like
this:

Vector A=A1 to A30/B=B29 to 46/C(210). /* Note that 210=30*7.
Loop #i=1 to 30.
+  loop=#j=1 to 7.
+     compute C((#i-1)*30+#j)=A*B
+  end loop.
End loop.

Comments: The naming of the interaction variable, C1 to C210, is clumsy and
not informative. It might be possible to fix this with a macro to rename
variables. I can offer no advice on doing this. Perhaps others will.

The other substructure is where the two lists are, for example, A2 A17 B2
C89 G18 and B24 I45 N23 G14 O56. So there is no common stem as there was in
the previous substructure. I can offer no help here. I'm not sure there is
anything can be done unless it can be done in either macro, script or
Python. Perhaps others will comment.

Gene Maguin

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD