+ Reply to Thread
Results 1 to 3 of 3

Thread: sample size calcs - why do these produce different results

  1. #1
    Points: 459, Level: 9
    Level completed: 18%, Points required for next Level: 41

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    sample size calcs - why do these produce different results




    What are the interpretations for each of these?

    data a;
    input z p q e;
    cards;
    1.96 0.95 0.05 0.05
    ;
    data b;
    set a;
    n=(z*z*p*q)/(e*e);
    run;
    proc print; run;

    ****************************;


    proc power;
    onesamplefreq test=z method=normal
    sides = 2
    alpha = 0.05
    nullproportion = 0.90
    proportion = 0.95
    ntotal = .
    power = 0.9;
    run;

  2. #2
    Omega Contributor
    Points: 38,289, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,992
    Thanks
    397
    Thanked 1,185 Times in 1,146 Posts

    Re: sample size calcs - why do these produce different results

    I think it would help to better describe what you are trying to do. Are you just trying to recreate the one-sample z-test sample size formula?

    If so, where is your power value in the first equation? Can you reference or send a link to the formula you are trying to use?
    Stop cowardice, ban guns!

  3. #3
    Omega Contributor
    Points: 38,289, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,992
    Thanks
    397
    Thanked 1,185 Times in 1,146 Posts

    Re: sample size calcs - why do these produce different results


    I believe this is what you are trying to do:

    Code: 
    procpower;
    onesamplefreqtest=z method=normal
    sides = 2
    alpha = 0.05
    nullproportion = 0.90
    proportion = 0.95
    ntotal = .
    power = 0.9;
    run;
     
    data sample_size_calc;
    input z_alpha z_power pop_p sample_p;
    sample_size=(((z_alpha*(sqrt(pop_p*(1-pop_p)))) + (z_power*(sqrt(sample_p *(1- sample_p))))) / (pop_p - sample_p) )**2;
    datalines;
    1.96 1.28 0.90 0.95
    ;
    run;
    
    proc print data=sample_size_calc noobs;
    run;
    
    301 versus 300.654
    Stop cowardice, ban guns!

+ Reply to Thread

           




Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats