Similar Threads:
1.Issues with power analysis using PROC MIXED (long)
Greetings! (Sorr this is long...)
We are designing a longitudinal study, and have the luxury of some
pilot data available to us for planning purposes. The pilot data
suggest that there is an important effect of the predictor ( on
the outcome (. I decided to use some of the methodology described
in chapter 12 of SAS for Mixed Models to identify the minimum number
of subjects needed to detect the effect observed in the pilot data
with 80% power. The result from that analysis was that we require
impossibly large numbers of subjects.
I found this somewhat surprising, and wanted to explore the
methodology from the book under much simpler circumstances without any
longitudinal component. Using either PROC POWER or PROC GLMPOWER for a
simple 2sample ttest or ANOVA, we require a total of 40 subjects
(twice the pilot study sample size) to detect the observed effect.
Online calculators give the same requirement. The methods in Chap 12
of SAS for Mixed Models, however, require impossibly large sample
sizes, even for the greatly simplified example. I realize that this
sledge hammer approach would not be done in normal practice, but the
results should be the same.
I am certainly missing a crucial point. Any ideas??
**The pilot data;
data d1;
input x y;
datalines;
0 0
0 0
0 0
0 5
0 0
0 0
0 5
0 5
0 5
0 5
0 10
1 5
1 5
1 5
1 0
1 15
1 5
1 10
1 0
1 5
;
run;
** regress y on x and get type3 test output. This is directly from
section 12.2 in the book. Note that there are no random effects;
ods output tests3=t3;
proc mixed data = d1;
model y = x ;
run;
data f_power;
set t3;
noncen=numDF*FValue;
alpha=0.05;
FCrit = finv(1Alpha, NumDF, DenDF, 0);
Power = 1probF(FCrit,NumDF,DenDF,NonCen);
run;
proc print noobs data = f_power; run;
****Fstatistic for predictor x is 4.32 (p=0.052) bservedpower is
about 50%;
***** data augmenting by doubling the observed data so that we have 40
subjects with same response and predictor profile as in the pilot
sample. This is also from the book p482.;
data AugD1;
set d1;
do i = 1 to 2;
output;
end;
run;
***** Compute denominator degrees of freedom with augmented data;
ods output tests3=t3Aug;
proc mixed data = AugD1;
model y = x;
run;
********** Place ddfm from augmented data result into macrovar df;
proc sql; select dendf into :df from t3Aug; quit;
%put &df;
******* New Power with augmented data;
ods output tests3=t3Update;
proc mixed data = d1;
model y = x / ddf=&df.;
run;
data f_power2;
set t3update;
noncen=numDF*FValue;
alpha=0.05;
FCrit=finv(1Alpha,NumDF, DenDF, 0);
Power = 1probF(FCrit,NumDF,DenDF,NonCen);
run;
proc print noobs data = f_power2; run;
****Fstatistic for predictor x is still 4.32 (p=0.0445) bserved
power is only 0.52;
****The result is that with double the subjects we achieve only 52%
power to detect the pilot data effect size. You can augment the pilot
data by a factor of 20 and power is still only about 54%.;
2.UPDATE power analysis using SAS proc mixed
A little while back I posted a message about difficulties using PROC
MIXED for power analysis following chapter 12 in SAS System for Mixed
Models. I've since been in contact with Walt Stroup who identified
some errors in chapter 12. Below is a revision of code for section
12.2.
The revision uses the variance components estimates for the original
dataset in the replicate data analysis and power calculations.
title1 "Output 12.1 from the book";
ods select covparms tests3 ;
proc mixed data=mice nobound cl ;
class cage condition diet;
model gain= conditiondiet / solution ddfm=satterth;
random cage cage*condition;
ods output tests3=t3 ;
run;
data f_power;
set t3;
Noncen = NumDF*FValue;
Alpha = 0.05;
FCrit = finv(1Alpha,NumDF,DenDF,0);
Power = 1  probf(FCrit,NumDF,DenDF,Noncen);
run;
title1 "Output 12.1 from the book (continued) ";
proc print data=f_power;
run;
data Mice1;
set mice;
cage = cage+6;
data mice2;
set mice mice1;
run;
title1 "REVISED Output 12.2 from the book";
ods select tests3;
proc mixed data=mice2 nobound cl noprofile; **** Do not profile the
likelihood for resid. variance;
parms (5.0292) (6.2415) (31.5567)/ noiter ; **** use var comp
ests from original dataset;
class cage condition diet;
model gain=conditiondiet /s ddfm=satterth;
random cage cage*condition;
ods output tests3 = tAug;
run;
data f_power2;
set tAug;
Alpha = 0.05;
Noncen = NumDF*FValue;
FCrit = finv(1Alpha,NumDF,DenDF,0);
Power = 1  probf(FCrit,NumDF,DenDF,Noncen);
run;
title1 "REVISED Output 12.3 from the book";
proc print data=f_power2;
run;
3.using proc mixed to do SUR analysis  still no improvement!
Hi all:
Although I incorporated a quoted description as suggested by Paul and
Matthew, I'm still getting error messages. Below you can see the log
file. Many thanks to Dale, David, Paul, and Matthew for suggestions to
improve my code. Any help is appreciated.
This is what I'm trying to do:
proc mixed;
class id time;
model rcon=time vis*time val*time /s noint;
repeated time/subject=id type AR(1) r=1,2 rcorr=1,2;
contrast 'equality of vis over time' vis*time 1 0 1, 0 1 1;
run;
This the log file I get:
NOTE: SAS initialization used:
real time 1.84 seconds
cpu time 0.44 seconds
1 options ls=80;
2 data dis1;
3 infile '/home504/pacar/data1.txt';
4 input time idno visd vald taskd rcon tcon sat grd gpa;
5 int=rcon*tcon;
6 run;
NOTE: The infile '/home504/pacar/data1.txt' is:
File Name=/home504/pacar/data1.txt,
Owner Name=pacar,Group Name=ba_rsc,
Access Permission=rwrr,
File Size (bytes)=7903
NOTE: 156 records were read from the infile '/home504/pacar/data1.txt'.
The minimum record length was 48.
The maximum record length was 51.
NOTE: The data set WORK.DIS1 has 156 observations and 11 variables.
NOTE: DATA statement used:
real time 0.67 seconds
cpu time 0.12 seconds
7 proc print data=dis1;
8 run;
NOTE: There were 156 observations read from the data set WORK.DIS1.
NOTE: PROCEDURE PRINT used:
real time 0.15 seconds
cpu time 0.01 seconds
9 proc mixed method=ml data=dis1;
10 title "regressing rel con on div var";
NOTE: PROCEDURE MIXED used:
real time 0.02 seconds
cpu time 0.00 seconds
ERROR: Variable NAME not found.
NOTE: The SAS System stopped processing this step because of errors.
11 class idno time;
12 model rcon=time visd*time vald*time/s noint;
13 repeated time/subject=idno type=ar(1) r=1,2 rcorr=1,2;
14 contrast 'equality of visd over time' visd*time 1 0 1, 0 1 1;

22
ERROR 22322: Syntax error, expecting one of the following: a name,
INTERCEPT.
15 run;
Thanks in advance.
F. Pinar Acar, Ph.D.
Department of Business Administration
Middle East Technical University
4.SUR linear restriction using Proc Syslin
Is there any economical way to apply Proc Syslin to test a linear
restriction across many models in a SUR?
I am working with CRSP financial data where each column's financial
variables are stacked by firm. In SAS tutorials, each firm would have its
own columns of variables. However, using the 'by statement' does allow SUR
modeling without requiring the data to by rearranged side by side, as
shown in the pseudocode below:
proc syslin SUR;
by firm;
model ret = vwretd dummy;
Is there an equivalent 'by statement' that can be used with stest to
impose a linear restriction across models? Such that the following psuedo
code for imposing the crossmodel linear restriction ('dummy' has no
impact on each firm individually),
proc syslin SUR;
mod001: model ret = vwretd dummy;
mod002: model ret = vwretd dummy;
[...]
mod100: model ret = vwretd dummy;
progs: stest model1.dummy = model2.dummy = [...] = model3.dummy =0;
could be written without expliciting writing 100 models and 100
restrictions.
5.Using proc freq : add column after doing freq
Hi Every one,
i am doing following
proc freq data= ****;
tables a*b*e/ list out= abc;
run;
i have normal abnormal and not reported in B,
were as i have only normal and abnormal in E, i dont have not
reported.
here a is 1;
this is how my output looks like

Normal Abnormal Total
+
++
Normal
9 0 9
+
++
Abnormal 
0 3 3
+
++
Not Reported *
1 0 1
+
++
Total
10 31 13
in data set abc:
obs A
B E COUNT PERCENT
1 1 Normal
Normal 99 75.5725
2 1 Abnormal
Abnormal 31 23.6641
3 1 Not Reported *
Normal 1 0.7634
How do i add not reported in E so my o/p looks like

Normal Abnormal not reported Total
+
++
Normal
9 0 0 9
+
++
Abnormal 
0 3 0 3
+
++
Not Reported *
1 0 0 1
+
++
Total
10 31 0 13
Thanks,
Raghu
6. Fw: Cost analyses using PROC GENMOD using link=log and dist=gamma
7. Cost analyses using PROC GENMOD using link=log and dist=gamma
8. proc mianalyze the random effect of null model using proc mixed