Date: Mon, 5 May 1997 12:54:43 -0400
Reply-To: Randy Collica <Randy.Collica@HLO.MTS.DEC.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Randy Collica <Randy.Collica@HLO.MTS.DEC.COM>
Organization: Digital Semiconductor
Subject: Re: interaction terms, logistic regression, and model selection
Content-Type: text/plain; charset=us-ascii
Timothy S. Killian wrote:
>
> Can anyone help me with this problem?
>
> I don't know if I am having trouble with SAS or I don't know enough
> about stats. I have a dichotomous DV and several categorical IVs. I
> want to enter interaction terms into my model. For example, does the
> gender of a parent (m, f), relationsip with the parent (close,
> notclose), and the relationship with the parent (stepparent,
> biological), make a difference whether or not a child should help the
> aging parent with things around the house?
>
> I have no problem with simple main effects. How about interaction
> terms? (eg., parentgen*relwpar).
>
> I created interaction terms such as stepparent/close;
> stepparent/notclose; etc. However, I am trying to choose the best
> model, so when I put all the vars. in the model, SAS will not accept
> this.
>
> Is it because I have a problem with SAS or maybe I don't understand the
> stats?
Hello Tim,
Well, your problem may be more with how SAS likes the
variables. If you SAS dataset is organized like the
following:
DV IV1 IV2 IV... IVn
1 1 0 0 1
0 0 1 0 0
0 1 0 1 1
1 0 1 0 0
. . . . .
. . . . .
Then for each observation of DV response variable you should
have an observation for each of your explainatory variables
IVn. To make an interaction term, SAS does not need you
to create an additional variable which is the interaction
of IV1 with IV2, IV1*IV2 for example unless you are using
Proc Logistic. If you use Proc Genmod you can use the
same syntax as in Proc GLM or Mixed like
proc genmod data=xyz ;
class iv1 iv2 ;
model dvn = iv1 iv2 iv1*iv2 /dist=binomial link=logit type3
pscale;
run;
quit;
The above code will generate the interaction term and
run a likelihood ratio chi-sq. test using type3 LR tests
and also do a person scaling in case you have overdispersion
in your response variables.
You can also express your dataset in events/trials form
in Proc Genmod if that is easier for you.
proc genmod data=xyz2 ;
class iv1 iv2;
model dvncount / dvntrial = iv1 iv2 iv1*iv2 /dist=binomial
link=logit type3 pscale;
run;
quit;
and your dataset should look something like:
DV IV1 IV2 IV... IVn
1 1 0 0 1
0 0 1 0 0
0 1 0 1 1
1 0 1 0 0
. . . . .
. . . . .
DVNCOUNT DVNTRIAL IV1 IV2 IV.....IVn
10 25 0 0 1 0
12 30 1 0 . .
15 40 0 1 . .
. . . . . .
Regards,
Randy