BookmarkSubscribeRSS Feed
BlueNose
Quartz | Level 8

Hello all

I wish to simulate data from a logistic regression model, with the following elements:

1. A binary response ( 1 = Treatment worked, 0 = Treatment didn't work)

2. A binary independent variable (1 = Treatment, 0 = Control)

3. For each subject in the sample, there are 2 observations, which are assumed to be correlated.

The purpose is to do a power analysis for a given sample size. Before I try the power analysis, I am not sure how to simulate a single data set of that kind.

I have a copy of Rick Wicklin's book on simulations, I saw the code he wrote for logistic regression. The independent variables there are continuous, and there is no correlation (no clusters), the clusters comes later with a normal dependent variable. I am not sure how to merge the two examples.

One more comment, I would prefer to do it using the data step and not IML, if possible.

Any assistant will be very appreciated !

(when helping you can make up any correlation and proportion you like, I can always change it later).

4 REPLIES 4
Ksharp
Super User

1) Why not post it at IML forum, since you have already mentioned him ? I think he can also do it via Data Step other than IML.

2)I am curious that what is your dependent variables ?  Only A binary response variable ? That could not be possible .

3)What do you mean by 'correlated" , Each subject has two obs ,maybe present  one is for P, another is for 1-P .

4)What do you mean by 'clusters', You mean using STRAT statement in proc logistic ? you can also use  CALSS variable instead of STRAT variable.

BlueNose
Quartz | Level 8

1) I didn't cause a violation of forum rules, publishing a non IML question in an IML forum 🙂

2) My response is binary (1/0)

3) By correlated I mean for example ear drops. It's applied on both ears for each patient, but two ears within the same patients are assumed to be correlated (or can't be assumed not to be). The patient, is then a cluster.

Rick_SAS
SAS Super FREQ

I think the post it is appropriate here, although the Statistical Procedures Community also get lots of questions like this.

You don't need to cross-post to get a particular person to see the post, just use the "at sign" (@) to "mention" them in the post.  For example, I can get to see a post by typing '@xia' at which creates a menu that prompts me to select his name.

For clarity, let's contuinue this discussion at https://communities.sas.com/message/286841#286841

Ksharp
Super User

Sorry. What are your INdependent variables ( X variables) ? Only A binary independent variable ? That could not be possible .

As your description, let me think it is a  PROC SURVEYLOGISTIC  question ?

Simulating data is absolutely good thing for @Rick Wicklin .

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1106 views
  • 0 likes
  • 3 in conversation