SlideShare uma empresa Scribd logo
1 de 30
Estimating Sample Size  through Simulations  Wuchen Zhao Department of Preventive Medicine University of Southern California Arthur Li City of Hope National Cancer Center
Background ,[object Object],[object Object],[object Object]
Background ,[object Object],[object Object]
PROC POWER ,[object Object],[object Object],[object Object],[object Object]
PROC POWER ,[object Object],[object Object],[object Object],[object Object],[object Object]
PROC POWER proc   power ; twosamplemeans   test =diff groupmeans  =  250  |  265 stddev  =  50 alpha  =  0.05 sides  =  1 npergroup  =  . power  =  0.8 ; run ;
PROC POWER The POWER Procedure Two-sample t Test for Mean Difference Fixed Scenario Elements Distribution  Normal Method  Exact Number of Sides  1 Alpha  0.05 Group 1 Mean  250 Group 2 Mean  265 Standard Deviation  50 Nominal Power  0.8 Null Difference  0 Computed N Per Group Actual  N Per Power  Group 0.802  139
Calculating Sample Size Through Simulation ,[object Object],Q e :  proportion of subjects allocated to drug group  Q c  = 1 – Q e d =  μ 1  –  μ 2
Calculating Sample Size Through Simulation ,[object Object]
Calculating Sample Size Through Simulation ,[object Object],Let
Calculating Sample Size Through Simulation ,[object Object],[object Object],[object Object],[object Object],[object Object]
Calculating Sample Size Through Simulation ,[object Object],%let  sim_n = 2000000; %let  mu_drug = 250; %let  mu_placebo = 265; %let  sigma = 50; data  sim (drop = i seed); retain  seed  1 ; length  group $  7. ; do  i =  1   to  &sim_n; if  ranuni(seed) <  0.5   then   do ; group =  'drug' ; weight = &mu_drug + &sigma * rannor(seed); end ; else   do ; group =  'placebo' ; weight = &mu_placebo + &sigma * rannor(seed); end ; output ; end ; run ;
Calculating Sample Size Through Simulation ,[object Object],title   &quot;The first 5 observations of simulated data&quot; ; proc   print   data  = sim ( obs  =  5 )  noobs ; run ; The first 5 observations of simulated data  group  weight drug  240.039 drug  269.829 placebo  318.472 drug  218.788 placebo  376.986
Calculating Sample Size Through Simulation ,[object Object],proc   ttest   data  = sim; class  group; var  weight; ods   output  ttests = stats; run ; title   'The T-test Result' ; proc   print   data  = stats  noobs ; run ; The T-test Result  Variable  Method  Variances  tValue  DF  Probt weightloss  Pooled  Equal  -211.37  2E6  <.0001 weightloss  Satterthwaite  Unequal  -211.37  2E6  <.0001
Calculating Sample Size Through Simulation ,[object Object],The T-test Result  Variable  Method  Variances  tValue  DF  Probt weightloss  Pooled  Equal  -211.37  2E6  <.0001 weightloss  Satterthwaite  Unequal  -211.37  2E6  <.0001 Average contribution of each person to the total test statistics
Calculating Sample Size Through Simulation ,[object Object]
Calculating Sample Size Through Simulation ,[object Object],%let  alpha = 0.05; %let  power = 0.80; %let  sides = 1; data  size_n(keep = alpha power  z_alpha z_beta tvalue expected_t n); set  stats; if  method =  'Pooled' ; z_alpha = probit( 1  - &alpha/&sides); z_beta = probit(&power); expected_t = abs(tvalue)/sqrt(&sim_n); n=((z_alpha+z_beta)** 2 /expected_t** 2 )/ 2 ; run ;
Calculating Sample Size Through Simulation ,[object Object],title   'The required sample size for each group' ; proc   print   data =size_n  noobs ; run ; The required sample size for each group  expected_ tValue  z_alpha  z_beta  t  n -211.37  1.64485  0.84162  0.14946  138.378
Calculating Sample Size For Interaction Through Simulation ,[object Object],[object Object],[object Object]
Calculating Sample Size For Interaction Through Simulation ,[object Object],[object Object],[object Object],Drug Group: Placebo Group:
Calculating Sample Size For Interaction Through Simulation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Calculating Sample Size For Interaction Through Simulation ,[object Object],[object Object],%let  sim_n=1000000; %let  p_drug=0.3; %let  mean_cal=2500; %let  sd_cal=1000; %let  alpha=10; %let  beta1=5; %let  beta2=-0.004; %let  beta3=0.0025; %let  sd_error=5;
Calculating Sample Size For Interaction Through Simulation ,[object Object],data  sim (drop = seed i); retain  seed  1 ; do  i= 1   to  &sim_n; if  ranuni(seed) < &p_drug  then  drug= 1 ; else  drug= 0 ; calorie = &mean_cal + &sd_cal * rannor(seed); weightloss = &alpha + &beta1*drug + &beta2* calorie +    &beta3*drug*calorie +  &sd_error*rannor(seed); output ; end ; run ;
Calculating Sample Size For Interaction Through Simulation ,[object Object],title   'The frist 5 observations of the simulated data' ; proc   print   data =sim ( obs = 5 )  noobs ; run ; The frist 5 observations of the simulated data  drug  calorie  weightloss 1  2300.78  18.7863 0  1416.68  15.5247 0  3187.84  8.4472 1  1905.82  12.3007 0  1258.70  -2.8413
Calculating Sample Size Through Simulation ,[object Object],proc   glm   data  = sim; model  weightloss = drug calorie drug*calorie/ solution ; ods   output  parameterestimates=pe; quit ; title   'The result from the linear regression' ; proc   print   data =pe; run ; The result from the linear regression    Obs  Dependent  Parameter  Estimate  StdErr  tValue  Probt   1  weightloss  Intercept  9.999851985  0.01605913  622.69  <.0001 2  weightloss  drug  5.032458567  0.02931489  171.67  <.0001 3  weightloss  calorie  -0.003996279  0.00000597  -669.75  <.0001 4  weightloss  drug*calorie  0.002481769  0.00001089  227.91  <.0001
Calculating Sample Size Through Simulation ,[object Object],The result from the linear regression    Obs  Dependent  Parameter  Estimate  StdErr  tValue  Probt   1  weightloss  Intercept  9.999851985  0.01605913  622.69  <.0001 2  weightloss  drug  5.032458567  0.02931489  171.67  <.0001 3  weightloss  calorie  -0.003996279  0.00000597  -669.75  <.0001 4  weightloss  drug*calorie  0.002481769  0.00001089  227.91  <.0001
Calculating Sample Size Through Simulation ,[object Object],%let  alpha=0.05; %let  power=0.80; %let  sides=2; data  size_n(keep=z_alpha z_beta tvalue expected_t n); set  pe; if  parameter= 'drug*calorie' ; z_alpha = probit( 1  - &alpha/&sides); z_beta = probit(&power); expected_t = abs(tvalue)/sqrt(&sim_n); n = (z_alpha + z_beta)** 2 /expected_t** 2 ; run ;
Calculating Sample Size Through Simulation ,[object Object],title   'The Sample Size for Testing the Interaction' ; proc   print   data =size_n  noobs ; run ; The Sample Size for Testing the Interaction  expected_ tValue  z_alpha  z_beta  t  n 227.91  1.95996  0.84162  0.22791  151.112 ,[object Object]
Conclusion ,[object Object],[object Object],[object Object],[object Object],[object Object]
Conclusion ,[object Object],[object Object]

Mais conteúdo relacionado

Destaque

Power Analysis and Sample Size Determination
Power Analysis and Sample Size DeterminationPower Analysis and Sample Size Determination
Power Analysis and Sample Size Determination
Ajay Dhamija
 

Destaque (20)

Determining the Sample Size
Determining the Sample SizeDetermining the Sample Size
Determining the Sample Size
 
Power Analysis and Sample Size Determination
Power Analysis and Sample Size DeterminationPower Analysis and Sample Size Determination
Power Analysis and Sample Size Determination
 
Two sample t-test
Two sample t-testTwo sample t-test
Two sample t-test
 
HFS3283 paired t tes-t and anova
HFS3283 paired t tes-t and anovaHFS3283 paired t tes-t and anova
HFS3283 paired t tes-t and anova
 
Sampling Design in Applied Marketing Research
Sampling Design in Applied Marketing ResearchSampling Design in Applied Marketing Research
Sampling Design in Applied Marketing Research
 
What is a paired samples t test
What is a paired samples t testWhat is a paired samples t test
What is a paired samples t test
 
Chapter8
Chapter8Chapter8
Chapter8
 
Sampling and Inference_Political_Science
Sampling and Inference_Political_ScienceSampling and Inference_Political_Science
Sampling and Inference_Political_Science
 
1.Why do we need to calculate samplesize?
1.Why do we need to calculate samplesize?1.Why do we need to calculate samplesize?
1.Why do we need to calculate samplesize?
 
3. Calculate samplesize for prevalence studies
3. Calculate samplesize for prevalence studies3. Calculate samplesize for prevalence studies
3. Calculate samplesize for prevalence studies
 
Sample size calculation
Sample size calculationSample size calculation
Sample size calculation
 
2. Tools to calculate samplesize
2. Tools to calculate samplesize2. Tools to calculate samplesize
2. Tools to calculate samplesize
 
Sample size calculation
Sample  size calculationSample  size calculation
Sample size calculation
 
Sample size calculation - a brief overview
Sample size calculation - a brief overviewSample size calculation - a brief overview
Sample size calculation - a brief overview
 
What is an independent samples-t test?
What is an independent samples-t test?What is an independent samples-t test?
What is an independent samples-t test?
 
Student's T-Test
Student's T-TestStudent's T-Test
Student's T-Test
 
Basic Statistical Concepts and Methods
Basic Statistical Concepts and MethodsBasic Statistical Concepts and Methods
Basic Statistical Concepts and Methods
 
Sample determinants and size
Sample determinants and sizeSample determinants and size
Sample determinants and size
 
Hypothesis testing; z test, t-test. f-test
Hypothesis testing; z test, t-test. f-testHypothesis testing; z test, t-test. f-test
Hypothesis testing; z test, t-test. f-test
 
RESEARCH METHOD - SAMPLING
RESEARCH METHOD - SAMPLINGRESEARCH METHOD - SAMPLING
RESEARCH METHOD - SAMPLING
 

Semelhante a Estimating sample size through simulations

MLlectureMethod.ppt
MLlectureMethod.pptMLlectureMethod.ppt
MLlectureMethod.ppt
butest
 
MLlectureMethod.ppt
MLlectureMethod.pptMLlectureMethod.ppt
MLlectureMethod.ppt
butest
 
DataIDSalaryCompaMidpoint AgePerformance RatingServiceGenderRaiseD.docx
DataIDSalaryCompaMidpoint AgePerformance RatingServiceGenderRaiseD.docxDataIDSalaryCompaMidpoint AgePerformance RatingServiceGenderRaiseD.docx
DataIDSalaryCompaMidpoint AgePerformance RatingServiceGenderRaiseD.docx
theodorelove43763
 
A05 Continuous One Variable Stat Tests
A05 Continuous One Variable Stat TestsA05 Continuous One Variable Stat Tests
A05 Continuous One Variable Stat Tests
Leanleaders.org
 
A05 Continuous One Variable Stat Tests
A05 Continuous One Variable Stat TestsA05 Continuous One Variable Stat Tests
A05 Continuous One Variable Stat Tests
Leanleaders.org
 
20140602 statistical power - husnul and nur
20140602   statistical power - husnul and nur20140602   statistical power - husnul and nur
20140602 statistical power - husnul and nur
Muhammad Khuluq
 

Semelhante a Estimating sample size through simulations (20)

MLlectureMethod.ppt
MLlectureMethod.pptMLlectureMethod.ppt
MLlectureMethod.ppt
 
MLlectureMethod.ppt
MLlectureMethod.pptMLlectureMethod.ppt
MLlectureMethod.ppt
 
Lab manual_statistik
Lab manual_statistikLab manual_statistik
Lab manual_statistik
 
Test of significance (t-test, proportion test, chi-square test)
Test of significance (t-test, proportion test, chi-square test)Test of significance (t-test, proportion test, chi-square test)
Test of significance (t-test, proportion test, chi-square test)
 
Diabetes data - model assessment using R
Diabetes data - model assessment using RDiabetes data - model assessment using R
Diabetes data - model assessment using R
 
WEKA:Credibility Evaluating Whats Been Learned
WEKA:Credibility Evaluating Whats Been LearnedWEKA:Credibility Evaluating Whats Been Learned
WEKA:Credibility Evaluating Whats Been Learned
 
WEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been LearnedWEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been Learned
 
Week 10 GEE Data Examples v2.pptx
Week 10 GEE Data Examples v2.pptxWeek 10 GEE Data Examples v2.pptx
Week 10 GEE Data Examples v2.pptx
 
Factorial Experiments
Factorial ExperimentsFactorial Experiments
Factorial Experiments
 
report
reportreport
report
 
DataIDSalaryCompaMidpoint AgePerformance RatingServiceGenderRaiseD.docx
DataIDSalaryCompaMidpoint AgePerformance RatingServiceGenderRaiseD.docxDataIDSalaryCompaMidpoint AgePerformance RatingServiceGenderRaiseD.docx
DataIDSalaryCompaMidpoint AgePerformance RatingServiceGenderRaiseD.docx
 
P Chart Tutorial
P Chart TutorialP Chart Tutorial
P Chart Tutorial
 
Statistics
StatisticsStatistics
Statistics
 
Testing a claim about a mean
Testing a claim about a mean  Testing a claim about a mean
Testing a claim about a mean
 
A05 Continuous One Variable Stat Tests
A05 Continuous One Variable Stat TestsA05 Continuous One Variable Stat Tests
A05 Continuous One Variable Stat Tests
 
A05 Continuous One Variable Stat Tests
A05 Continuous One Variable Stat TestsA05 Continuous One Variable Stat Tests
A05 Continuous One Variable Stat Tests
 
20140602 statistical power - husnul and nur
20140602   statistical power - husnul and nur20140602   statistical power - husnul and nur
20140602 statistical power - husnul and nur
 
Sample Size: A couple more hints to handle it right using SAS and R
Sample Size: A couple more hints to handle it right using SAS and RSample Size: A couple more hints to handle it right using SAS and R
Sample Size: A couple more hints to handle it right using SAS and R
 
A04 Sample Size
A04 Sample SizeA04 Sample Size
A04 Sample Size
 
A04 Sample Size
A04 Sample SizeA04 Sample Size
A04 Sample Size
 

Último

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Último (20)

Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Estimating sample size through simulations

  • 1. Estimating Sample Size through Simulations Wuchen Zhao Department of Preventive Medicine University of Southern California Arthur Li City of Hope National Cancer Center
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. PROC POWER proc power ; twosamplemeans test =diff groupmeans = 250 | 265 stddev = 50 alpha = 0.05 sides = 1 npergroup = . power = 0.8 ; run ;
  • 7. PROC POWER The POWER Procedure Two-sample t Test for Mean Difference Fixed Scenario Elements Distribution Normal Method Exact Number of Sides 1 Alpha 0.05 Group 1 Mean 250 Group 2 Mean 265 Standard Deviation 50 Nominal Power 0.8 Null Difference 0 Computed N Per Group Actual N Per Power Group 0.802 139
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.