Reputation: 751
I have the data below.
I wish to apply logistic regression. Here the response variable is the proportion of dead. Here is how I analyzed the data in R:
dose <- c(1.6907, 1.7242, 1.7552, 1.7842,
1.8113, 1.8369, 1.8610,1.8839)
total<- c(59,60,62,56,63,59,62,60)
dead<- c(6,13,18,28,52,53,61,60)
y <- dead/total
lineer.model <- glm(y ~ dose,family=binomial(link=logit), weights=total)
I want to do the exactly the same analysis in SAS. Can anyone please help me with that? Here is what i did in SAS, but thats not working. Any idea why
data beetle_data;
input dose total dead;
y = dead/total;
datalines;
1.6907 59 6
1.7242 60 13
1.7552 62 18
1.7842 56 28
1.8113 63 52
1.8369 59 53
1.8610 62 61
1.8839 60 60
;
proc logistic data=beetle_data;
model y =dose/link=logit dist=binomial;
run;
Upvotes: 1
Views: 706
Reputation: 1299
SAS would allow you to apply a frequency weight using a weight statement (check proc logistic on SAS help page). However, you'll need to manipulate your data somewhat:
dose died count
1.6907 0 53
1.6907 1 6
1.7242 0 47
1.7242 1 13... etc.
Also, your dose variable's range is too small, causing the estimate to be too large, I'd suggest multiply it with some bigger number like 100, or even 1000 to make the coefficient and odds ratio more manageable (aka, change the unit from liter to milliliter).
Question:
I want to do the exactly the same analysis in SAS. Can anyone please help me with that? Here is what i did in SAS, but thats not working. Any idea why
data beetle_data;
input dose total dead;
y = dead/total;
datalines;
1.6907 59 6
1.7242 60 13
1.7552 62 18
1.7842 56 28
1.8113 63 52
1.8369 59 53
1.8610 62 61
1.8839 60 60
;
proc logistic data=beetle_data;
model y =dose/link=logit dist=binomial;
run;
Answer:
PROC LOGISTIC runs only logistic regression, unlike GLM and GENMOD you do not need to specify distribution. Here is how I'd do it, but there can be a faster way that I am not aware of.
data beetle_data;
input dose total dead;
y = dead/total;
datalines;
1.6907 59 6
1.7242 60 13
1.7552 62 18
1.7842 56 28
1.8113 63 52
1.8369 59 53
1.8610 62 61
1.8839 60 60
;
data beetleDead;
set beetle_data;
killed = 1;
drop total;
rename dead = beetleCount;
run;
data beetleSurvived;
set beetle_data;
killed = 0;
beetleCount = total - dead;
drop total dead;
run;
data beetleAll;
set beetleDead beetleSurvived;
run;
proc logistic data=beetleAll;
model killed = dose;
weight beetleCount;
run;
Upvotes: 4
Reputation: 226871
Based on this SAS document (google "sas proc logistic binomial") it looks like this should do it:
proc genmod data=beetle;
model dead/total=dose / link=logit dist=binomial;
Based on this it looks like your data above are actually the same, standard Bliss (1935) data set referred to in the link above.
Upvotes: 2