terça-feira, 18 de agosto de 2015

Potencia do Teste

*-----------------------------------------------+                                 
 | Generated: Friday, November 27, 2014 21:46:37 |                                 
 | Data: \                                       |                                
 +----------------------------------------------*;                                
       title;                                                                  
       footnote;                                                              
 *** Calculate Power ***;                                                     
 data WORK._SAMPOW_;                                                           
    do NTRT = 4;                                                              
       NDF  = NTRT - 1;                                                       
       do STD = 2.64;                                                          
          VAR = STD * STD;                                                    
          do ALPHA = 0.05;                                                    
             TALPHA = 1 - ALPHA;                                              
             do CSS = 32,75;                                                  
                CSSV = CSS / VAR;                                             
                do N = 2 to 30 by 1;                                           
                   DDF   = NTRT * (N - 1);                                    
                   FCRIT = finv(TALPHA, NDF, DDF);                            
                   NC    = N * CSSV;                                           
                   POWER = sdf('f', FCRIT, NDF, DDF, NC);                     
                   output;                                                    
                end;                                                           
             end;                                                             
          end;                                                                
       end;                                                                   
    end;                                                                      
    label NTRT  = "# Treatments"                                              
          CSS   = "CSS of Means"                                              
          ALPHA = "Alpha"                                                     
          POWER = "Power"                                                     
          N     = "N per Group"                                               
          STD   = "Standard Deviation";                                       
 run;                                                                         
                                                                              
 proc format;                                                                 
    picture PFMT low -< .01  = '<.01' (noedit)                                
                 .01.99  = '9.999'                                        
                 .99 <- high = '>.99' (noedit);                               
 run;                                                                         
 proc sort data=WORK._SAMPOW_;                                                
   by CSS ;                                                                    
 run;                                                                         
 *** Print Results ***;                                                       
 proc print data=WORK._SAMPOW_ label noobs;                                   
    title1 "One-Way ANOVA";                                                   
    title2 "# Treatments = 4   Standard Deviation = 2.64   Alpha = 0.05";     
    by CSS ;                                                                   
    id CSS ;                                                                  
    var N POWER;                                                              
    format POWER PFMT.;                                                        
 run;                                                                         
 *** Create ID Variable for Plots ***;                                        
 data WORK._SAMPOW_;                                                          
    set WORK._SAMPOW_;                                                        
    PLTID = trim(put(CSS,best8.));                                            
 run;                                                                         
 *** Power Curves ***;                                                         
 goptions ctext=BLACK ftext=SWISS htext=1;                                    
                                                                              
 proc gplot data=WORK._SAMPOW_ ;                                               
    plot POWER * N = PLTID                                                    
          / vaxis = axis1     haxis  = axis2        caxis = BLACK             
            lvref = 20                    legend = legend1                    
            lhref = 20                                                        
            frame             cframe = CXF7E1C2                               
            description = "Plot of Power vs. N per Group" name = 'POWR';      
    ** Generate multiple SYMBOL statements in case **;                        
    ** user has limited colors available           **;                        
    symbol1   i=join w=1 v=none l=1;                                          
    symbol2   i=join w=1 v=none l=2;                                          
    symbol3   i=join w=1 v=none l=3;                                          
    symbol4   i=join w=1 v=none l=4;                                          
    symbol5   i=join w=1 v=none l=5;                                          
    symbol6   i=join w=1 v=none l=6;                                          
    symbol7   i=join w=1 v=none l=7;                                          
    symbol8   i=join w=1 v=none l=8;                                          
    symbol9   i=join w=1 v=none l=9;                                          
    symbol10  i=join w=1 v=none l=10;                                         
    legend1 label=('CSS of Means' position=(middle left))                     
            frame;                                                            
    axis1   offset=(3 pct) minor=none width=1 label=(a=90 r=0)                
            order=(0 to 1 by .2);                                             
    axis2   offset=(3 pct) minor=none width=1;                                
 run;                                                                         
 quit;                                                                        
 goptions reset=all device=WIN ; 






Resultado Programa

Nenhum comentário:

Postar um comentário