| Date: | Mon, 14 Oct 1996 22:02:46 GMT |
| Reply-To: | dmclerran@fhcrc.org |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
|
|
| From: | Netnews Server <NETNEWS@AMERICAN.EDU> |
| Organization: | Fred Hutchinson Cancer Research Center |
| Subject: | Re: hypothesis testing in PROC LOGISTIC |
|---|
In <53rcep$4nj@GSB-Kwanza.Stanford.EDU>, doncram@leland.Stanford.EDU (Donald
Peter Cram) writes:
>Is it possible to test equality of coefficients, and perform other tests,
>in PROC LOGISTIC like one can in PROC REG? How can I do hypothesis
>testing in LOGISTIC?
>
>Below is a sample program that doesn't work.
>
>
>data sodas;
>title "Analysis of Soda Preferences";
>input soda $ cola sweet sub1-sub5;
>cards;
>coke 1 0 2 5 1 3 4
>pepsi 1 1 1 6 2 4 3
>tab 1 0 6 1 3 6 2
>dietpepsi 1 0 5 2 4 5 1
>sevenup 0 1 3 3 5 2 5
>sprite1 0 1 4 4 6 1 6
>sprite2 0 0 4 4 6 1 6
>sprite3 0 0 4 4 6 1 6
>;
>
>
>proc reg data=sodas;
> model cola = sweet sub1 sub2;
> test sub1 = sub2;
> test sub1 = 0;
>
>proc logistic descending data=sodas;
> model cola = sweet sub1 sub2;
> test sub1 = sub2;
> test sub1 = 0;
>
>The PROC REG works fine but the test statement in PROC LOGISTIC
>yields:
>ERROR 180-322: Statement is not valid or it is used out of proper order.
>
Don,
Instead of using PROC LOGISTIC, try PROC GENMOD. GENMOD has a contrast
statement which can be employed to provide tests for linear combinations
of the predictor variables. In order to fit a logistic regression in
GENMOD, you must specify the model in events/trials syntax. In your
dataset, you have only the events part (since you have a binary response
instead of a binomial response). Thus, you must first create the trials
variable. In this example, trials would be a constant=1. The syntax
for GENMOD would then be:
proc genmod data=sodas;
model cola/denom = sweet sub1 sub2 / error=binomial;
contrast "Sub1=?Sub2"
sub1 1
sub2 -1 / wald;
contrast "Sub1=?0"
sub1 1 / wald;
run;
If you do not specify the wald option, then GENMOD will compute a
likelihood ratio test under the contrast constraint. By specifying WALD,
your second test is identical to the p-value which is returned in the
table of parameter estimates.
(Note that for the data you presented, GENMOD and LOGISTIC return
different tables of parameter estimates because there is "quasi-complete
separation of data points". I presume that you have more data that you
would actually employ in your regression.)
Dale McLerran
Fred Hutchinson Cancer Research Center Ph: (206) 667-2926
1124 Columbia Street Fax: (206) 667-5977
Seattle, WA 98104
|