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
- /
- General Programming
- /
- heteroscedastic variances

Topic Options

- 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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-23-2013 10:45 PM

Does anyone know of a SAS code to generate heteroscedastic variances for two groups (i.e., treatment vs. control)?

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

Posted in reply to dessert_fox

02-25-2013 10:49 AM

I think we need more information on what you're looking for.

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

Posted in reply to Reeza

03-03-2013 10:49 PM

Sorry I did not provide that much information to my earlier question. So basically, I want to simulate data where I can estimate and compare the variance between two groups (i.e., treatment vs. control) and it could be a simple t test, or ANOVA, or a multilevel model.

Thanks Reeza!

Rommel

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

Posted in reply to dessert_fox

03-03-2013 11:39 PM

You should be looking at contrast or estimate statements with hovtest= bf welch lavene .

These options will give you different variance tests. A good book with examples is analysis of messy data volume 1 by milliken and johnson.

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

Posted in reply to dessert_fox

02-25-2013 12:58 PM

Do you want to *simulate*, *estimate* or *compare* variances for two groups? - PG

PG

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

Posted in reply to PGStats

03-03-2013 10:46 PM

Yes, I wanted to simulate where the treatment group has a greater variance compared to the control group. Any model could do: t-test, ANOVA, or better yet a multilvel model.

Thanks,

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

Posted in reply to dessert_fox

03-04-2013 12:27 PM

OK, here is a simulation of ANOVA with two groups, in the equal and unequal variances cases :

**data test;****length case $16;****call streaminit(384239);****case = "EQUAL VARIANCES";****do group = "A", "B";**** do _n_ = 1 to 50;**** x = rand("NORMAL", 10, 2);**** output;**** end;**** end;****case = "UNEQUAL VARIANCES";****group = "A";****do _n_ = 1 to 50;**** x = rand("NORMAL", 10, 2);**** output;**** end;****group = "B";****do _n_ = 1 to 50;**** x = rand("NORMAL", 10, 3);**** output;**** end;****run; **

**proc glm data=test;****by case;****class group;****model x = group;****means group / hovtest welch;****run;**

PG

PG

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

Posted in reply to PGStats

03-04-2013 08:03 PM

PG,

Thanks so much. This would give me a good starting point to learn how to simulate.

Rommel

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

Posted in reply to PGStats

03-06-2013 06:13 PM

PGStats,

I've strated writing simulation codes for multilevel mediation model for normal and non-normal combined with heteroscedastic variance. Would you be kind enough to take a look at my codes when you happen to have time?

Thanks so much for the help.

Rommel

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

Posted in reply to dessert_fox

03-07-2013 08:08 AM

Rommel,

Do you have SAS/IML licensed? If so, then take a look through 's blog, and find a wealth of information regarding simulation, with special parts on simulating from multivariable normal distributions, and correlated/clustered observations. IML is so much more powerful for simulation than DATA step programming that if simulation is going to be a major part of your work, you should consider getting a license.

Steve Denham

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

Posted in reply to SteveDenham

03-07-2013 08:59 PM

Yes Steve I have a SAS-IML license. And I have already looked through Rick Wicklin's blog and it's been very helpful. But right I would say I'm still at the very basic level of doing simulation. I wonder if at this point it's already ok to learn simulation in SAS-IML. I never knew it was more powerful though. But yes, I will start learnin SAS-IML. In fact, I already pre-ordered his book on simulation.

I really appreciate your advice.

Thanks Steve!

Rommel

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

Posted in reply to dessert_fox

09-28-2013 07:04 AM

Rick's book on simulation is excellent (not surprising) and starts with the very basics.

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

Posted in reply to PGStats

09-26-2013 06:54 PM

Thanks so much PG. One more question if you don't mind, do you have a sample simulation code to generate multilevel data?

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

Posted in reply to sirerwin

09-26-2013 08:55 PM

Please be more precise. What would you like that data to look like?

PG

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

Posted in reply to PGStats

09-28-2013 01:44 AM

Specifically, I want to generate a multilevel data where I have a treatment and a control group with the following

conditions:

a) two levels of clusters (20 and 40 groups)

b) two levels of sample size (10 for small sample and 20 for medium-sized sample)

c) for each sample size, 1/2 is assigned to treatment and 1/2 is to control

Given these, I want to generate data from a nonnormal distribution (chi-square dist with df=1) and a

heteroscedastic variance where treatment to control variance ratio is 8:1.

From there I want to assess how nonnormality and heteroscedasticity affects the power and type I error of a statistical test.

Thanks so much, PG! Let me know if you need more details.