Turn on suggestions

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

Showing results for

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

Options

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 02-10-2016 03:19 AM
(3215 views)

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

- Tags:
- logistic
- procedures

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you, now it is clear.

**Don't miss out on SAS Innovate - Register now for the FREE Livestream!**

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.