BookmarkSubscribeRSS Feed
jleexx35
Calcite | Level 5

I try to find out a number of sample size and effect size. however, glmpower does not work repeated time.

 

what is wrong in the below sas codes?

 

 

 

options pagesize=60 linesize=80 pageno=1 nodate;
data GLMPOWER;
input treatment $ score6 score12 score18 score24 weight @27 ;
datalines;
plac 32 36 39 41 0.5
treat 35 40 48 50 0.5
;


proc print data = GLMPOWER;
TITLE 'GLMPOWER EXAMPLE';
RUN;

proc glm data =glmpower;
class treatment;
weight weight;
model score6 score12 score18 score24 = TREATMENT;
repeated TIME;
run;

 

PROC GLMPOWER DATA=GLMPOWER;

CLASS TREATMENT;
WEIGHT WEIGHT;
MODEL score6 score12 score18 score24 = TREATMENT;
repeated TIME;
POWER
EFFECTS=(TREATMENT)
MTEST = HLT
ALPHA = 0.05
POWER= .9
NTOTAL = .
STDDEV= 3.2
MATRIX("WELLCORR") = LEAR(.6, 1, 4, 1 2 3 4)
CORRMAT = "WELLCORR"
RUN;

ods graphics on;
proc glmpower data =glmpower;
class treatment;
weight weight;
model score6 score12 score18 score24 = treatment;
repeated time;
power
effects = (Treatment)
mtest= hlt
alpha= 0.05
ntotal= 800
power=.
stddev= 3.2
matrix ("wellCorr") = lear( .6, 1,4, 1 2 3 4)
Corrmat= "WellCorr";
plot x= n min=6 step= 3
vary (symbol by stddev, panel by dependent source)
xopts = (ref= 15 30 crossref= yes);
run;
ods graphics off;

9 REPLIES 9
ballardw
Super User

The is very clear about what happens:

9    proc glm data =glmpower;
10   class treatment;
11   weight weight;
12   model score6 score12 score18 score24 = TREATMENT;
13   repeated TIME;
14   run;

NOTE: No multivariate tests performed for TIME due to insufficient error degrees of freedom.


NOTE: No multivariate tests performed for TIME*treatment due to insufficient error degrees of
      freedom.

Your example data does not have enough records to get enough degrees of freedom to do requested actions.

 

jleexx35
Calcite | Level 5

In your correction,  doesnot solve the problem still  if added more subject

 

options pagesize=60 linesize=80 pageno=1 nodate;
data GLMPOWER;
input treatment $ score6 score12 score18 score24 weight @27 ;
datalines;
plac 41 50 61 32 0.5
treat 41 39 72 80 0.5
plac 41 32 12 23 0.5
plac 40 30 12 11 0.5
treat 41 36 39 41 0.5
;


proc print data = GLMPOWER;
TITLE 'GLMPOWER EXAMPLE';
RUN;

proc glm data =glmpower;
class treatment;
weight weight;
model score6 score12 score18 score24 = TREATMENT;
repeated TIME;
run;


PROC GLMPOWER DATA=GLMPOWER;
CLASS TREATMENT;
WEIGHT WEIGHT;
MODEL score6 score12 score18 score24 = TREATMENT;
repeated TIME;
POWER
EFFECTS=(TREATMENT)
UEPSDEF=HF
ALPHA = 0.05
POWER= .9
NTOTAL = .
STDDEV= 3.2
MATRIX("WELLCORR") = LEAR(.6, 1, 4, 1 2 3 4)
CORRMAT = "WELLCORR"
RUN;

UEPSDEF=HF

ods graphics on;
proc glmpower data =glmpower;
class treatment;
weight weight;
model score6 score12 score18 score24 = treatment;
repeated time;
power
effects = (Treatment)
mtest= hlt
alpha= 0.05
ntotal= 800
power=.
stddev= 3.2
matrix ("wellCorr") = lear( .6, 1,4, 1 2 3 4)
Corrmat= "WellCorr";
plot x= n min=6 step= 3
vary (symbol by stddev, panel by dependent source)
xopts = (ref= 15 30 crossref= yes);
run;
ods graphics off;

ballardw
Super User

What makes you think is not working:

I get this as part of the results when I run your code:

The GLM Procedure
Repeated Measures Analysis of Variance

 

Repeated Measures Level Information
Dependent Variable score6 score12 score18 score24
Level of TIME 1 2 3 4


MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no TIME Effect
H = Type III SSCP Matrix for TIME
E = Error SSCP Matrix

S=1 M=0.5 N=-0.5
Statistic Value F Value Num DF Den DF Pr > F
Wilks' Lambda 0.13491054 2.14 3 1 0.4569
Pillai's Trace 0.86508946 2.14 3 1 0.4569
Hotelling-Lawley Trace 6.41231951 2.14 3 1 0.4569
Roy's Greatest Root 6.41231951 2.14 3 1 0.4569


MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no TIME*treatment Effect
H = Type III SSCP Matrix for TIME*treatment
E = Error SSCP Matrix

S=1 M=0.5 N=-0.5
Statistic Value F Value Num DF Den DF Pr > F
Wilks' Lambda 0.26090443 0.94 3 1 0.6209
Pillai's Trace 0.73909557 0.94 3 1 0.6209
Hotelling-Lawley Trace 2.83282115 0.94 3 1 0.6209
Roy's Greatest Root 2.83282115 0.94 3 1 0.6209


 

 

Reeza
Super User

You have a single observation for each treatment. You do not have enough data to do what you want as shown unless you have significantly more data. Nothing is wrong with the code per se.

 


@jleexx35 wrote:

I try to find out a number of sample size and effect size. however, glmpower does not work repeated time.

 

what is wrong in the below sas codes?

 

 

 

options pagesize=60 linesize=80 pageno=1 nodate;
data GLMPOWER;
@input treatment $ score6 score12 score18 score24 weight @27 ;
datalines;
plac 32 36 39 41 0.5
treat 35 40 48 50 0.5
;


proc print data = GLMPOWER;
TITLE 'GLMPOWER EXAMPLE';
RUN;

proc glm data =glmpower;
class treatment;
weight weight;
model score6 score12 score18 score24 = TREATMENT;
repeated TIME;
run;

 

PROC GLMPOWER DATA=GLMPOWER;

CLASS TREATMENT;
WEIGHT WEIGHT;
MODEL score6 score12 score18 score24 = TREATMENT;
repeated TIME;
POWER
EFFECTS=(TREATMENT)
MTEST = HLT
ALPHA = 0.05
POWER= .9
NTOTAL = .
STDDEV= 3.2
MATRIX("WELLCORR") = LEAR(.6, 1, 4, 1 2 3 4)
CORRMAT = "WELLCORR"
RUN;

ods graphics on;
proc glmpower data =glmpower;
class treatment;
weight weight;
model score6 score12 score18 score24 = treatment;
repeated time;
power
effects = (Treatment)
mtest= hlt
alpha= 0.05
ntotal= 800
power=.
stddev= 3.2
matrix ("wellCorr") = lear( .6, 1,4, 1 2 3 4)
Corrmat= "WellCorr";
plot x= n min=6 step= 3
vary (symbol by stddev, panel by dependent source)
xopts = (ref= 15 30 crossref= yes);
run;
ods graphics off;


 

 

jleexx35
Calcite | Level 5

I think for understanding this model, I will explain more about it. 

my main focus is to calculate a number of sample size using glmpower. I directly follow the SAS glmpower reference.  In terms of the reference, the limited info means by time and groups. I exactly follow the step as the reference indicated. however GLM doesnot produce f test results and proglm doesnot run with the sas codes indicate in the reference. I want to get multiple simulations using proc  powerglm but it doesnot produce any output, as well as code of 'repeated time' does not work( changed a red color).

 

can you share your idea in terms of glmpower not glm.

thank you so much!! 

 

Reeza
Super User

@jleexx35 wrote:

I think for understanding this model, I will explain more about it. 

my main focus is to calculate a number of sample size using glmpower. I directly follow the SAS glmpower reference.  In terms of the reference, the limited info means by time and groups. I exactly follow the step as the reference indicated. however GLM doesnot produce f test results and proglm doesnot run with the sas codes indicate in the reference. I want to get multiple simulations using proc  powerglm but it doesnot produce any output, as well as code of 'repeated time' does not work( changed a red color).

 

can you share your idea in terms of glmpower not glm.

thank you so much!! 

 


What reference? Are you trying to calculate a sample size? If so then you would use PROC POWER most likely...

Please explain what you're trying to achieve instead and then we can help to point you in the correct direction. 

Reeza
Super User

PROC GLM will not run with only the two observations. GLMPOWER works fine. The GLMPOWER, you were missing a semicolon and it seems to require integer weights, so I changed them to 1. 

 

data GLMPOWER;
    input treatment $ score6 score12 score18 score24 weight @27;
    datalines;
plac 32 36 39 41 1
treat 35 40 48 50 1
;

proc print data=GLMPOWER;
    TITLE 'GLMPOWER EXAMPLE';
RUN;

PROC GLMPOWER DATA=GLMPOWER;
    CLASS TREATMENT;
    WEIGHT WEIGHT;
    MODEL score6 score12 score18 score24=TREATMENT;
    repeated TIME;
    POWER EFFECTS=(TREATMENT) MTEST=HLT ALPHA=0.05 POWER=.9 NTOTAL=.
STDDEV=3.2 MATRIX("WELLCORR")=LEAR(.6, 1, 4, 1 2 3 4) CORRMAT="WELLCORR";
RUN;

ods graphics on;

proc glmpower data=glmpower;
    class treatment;
    weight weight;
    model score6 score12 score18 score24=treatment;
    repeated time;
    power effects=(Treatment) mtest=hlt alpha=0.05 ntotal=800 power=.
stddev=3.2 matrix ("WELLCORR")=lear(.6, 1, 4, 1 2 3 4) Corrmat="WELLCORR";
    plot x=n min=6 step=3 vary (symbol by stddev, panel by dependent source) 
        xopts=(ref=15 30 crossref=yes);
run;

ods graphics off;

 

 

jleexx35
Calcite | Level 5

If proc powerglm codes are fine, please share your output with me? 

I face continue errors, not codes are not computed at all.

Reeza
Super User

Run the code I posted above and include the errors shown in your response. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 2057 views
  • 2 likes
  • 3 in conversation