turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Proc logistic with class variable - weighted vs. u...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-10-2016 03:19 AM

Dear All,

I came across a problem when I ran proc logistic with class variable with weights and without weights. For some cases I got "close" the same estimates while for others totally diferrent.

The input data set (SAMPLE.zip - 60 rows) is attachted to this post as well as the SAS code I executed.

```
proc sort data=sample.sample;
by class_var var1 var2;
run;
/*Generate weights*/
proc summary data=sample.sample nway;
class class_var var1 var2 target_var;
output out=sample.weights(drop=_type_ rename=(_freq_= weight));
run;
/*With weights*/
proc logistic data = sample.weights;
class class_var /param = GLM;
model target_var(EVENT = '1') = class_var var1 * class_var var2 * class_var /noint;
weight weight;
ods output ParameterEstimates = sample.wparamest Association = sample.wassocest;
run;
title;
/*Without weights*/
proc logistic data = sample.sample;
class class_var /param = GLM;
model target_var(EVENT = '1') = class_var var1 * class_var var2 * class_var /noint;
ods output ParameterEstimates = sample.paramest Association = sample.assocest;
run;
title;
proc compare base=sample.paramest compare=sample.wparamest;
run;
```

There are two cases:

1. Using the sample data set without weights (in this case the input table has 60 rows)

2. Using the weights table containing the weight variable that is also used in the proc logistic. (in this case the input table has 57 rows, in 3 cases the weights are 2).

When I compare the results I get differencies as follows:

Could you please tell me what could cause these differencies?

Thank you!

BR,

Gabor

Accepted Solutions

Solution

02-11-2016
04:43 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-10-2016 08:51 AM

All Replies

Solution

02-11-2016
04:43 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-10-2016 08:51 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-11-2016 04:55 AM

Thank you Rick for your comment, using FREQ instead of WEIGHT solved my problem.

There is still one thing that is not clear for me. In the article you say the followings:

1. "A frequency variable tells the procedure that there are more observations than there are rows in the data set. When you run a frequency analysis, your analysis should agree with the same analysis run on the "expanded data," which is the data set in which each row represents a single observation."

2. "In the regression context, if you use integer counts as weights, the parameter estimates are the same as when you use the counts for frequencies".

From 1 and 2 I have the parameter estimates with integer weights = parameter estimates with frequencies = parameter estimates for the "expanded data".

However, in my test case this clearly does NOT hold since some of my parameter estimates are different.

What could be the issue here?

Thank you for your answer.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-11-2016 05:35 AM

I wrote that article for LINEAR regression. As you have observed, the weights affect the parameter estimates nonlinearly in logisitc regression and other generalized regression models.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-11-2016 06:15 AM

Thank you, now it is clear.