OCTRI PSS Simulations in R Seminar.pdf

DATE: SEPTEMBER 21, 2023 PRESENTED BY: ROBIN BAUDIER, MSPH, MFA, STAFF BIOSTATISTICIAN WITH THE BDP
Power and Sample Size Simulations in R
OCTRI Research Forum
TOPICS COVERED
Brief overviews of
 Power and Sample Size (PSS)
concepts
 Monte Carlo Simulations
 Using Monte Carlo Simulations to
calculate PSS
How to perform PSS simulations in R
 Simulating variables
 Using loops
 Looping tests on simulated datasets to
calculate power
 Examples of complex PSS simulations
 Packages that can make things a little
easier
POWER & SAMPLE SIZE CALCULATIONS
A VERY BRIEF OVERVIEW
FOR MORE INFORMATION ON THE BASICS OF PSS CALCULATIONS
 Check out the OCTRI PSS 101 Seminar, co-developed by Meike Niederhausen, PhD and Alicia
Johnson, MPH, and presented most recently by Alicia Johnson in July:
 RECORDING: https://echo360.org/media/bd0064c8-327c-4b56-8279-9558cd307125/public
 SLIDES: https://drive.google.com/file/d/1691RWaDzzRkjbdhbfjfxO7yKESRUjuAn/view
Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214
Power is the probability of correctly rejecting the null hypothesis
What is power?
α is the probability of
incorrectly rejecting
the null hypothesis
1 - α
1 - β
Critical Value
Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214
Statistical test example: one-tailed T-test
α = 0.05
1 - α
1 - β
0 1.645
Reject the null
hypothesis if t > 1.645
d.f.: n1+n2-2
t
Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214
1 - β
Prediction example: bootstrapping ML model
How do you determine if an machine learning (ML) model performs
better than chance? You can create a null distribution by randomly
permuting the outcome variable on your dataset a large number of
times (e.g., 999) and run ML model on each dataset.
1 – (proportion of random R2 < real data model R2) = p-value
ML model R2
H0: R2 = 0
HA: R2 > 0
Reject H0 if proportion of random R2 less than
model R2 ≥95%
α = 0.05
Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214
PSS simulation example:
In PSS simulations, rather than modeling the null distribution
as you do in bootstrapping, you simulate the HA distribution
(with a specified N, effect size, SD, etc) a large number of
times and assess what proportion of statistical tests
performed on simulated data are able to detect the effect of
interest
What is the probability of
correctly rejecting the null
hypothesis (power) with the
specified effect size, N, and α?
Power = proportion of models (performed on data
simulated with HA distributions) with p-values <α
HA models
with p< α
HA models
with p≥ α
Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214
PSS simulation example:
In PSS simulations, rather than modeling the null distribution
as you do in bootstrapping, you simulate the HA distribution
(with a specified N, effect size, SD, etc) a large number of
times and assess what proportion of statistical tests
performed on simulated data are able to detect the effect of
interest
What is the probability of
correctly rejecting the null
hypothesis (power) with the
specified effect size, N, and α?
Power = proportion of models (performed on data
simulated with HA distributions) with p-values <α
HA models
with p< α
HA models
with p≥ α
What if you don’t have good power?
OCTRI PSS Simulations in R Seminar.pdf
Also need to
know:
• What’s your
data
distribution and
structure?
• What statistical
test/model are
you planning to
use?
POWER & SAMPLE SIZE SIMULATIONS
WHEN, WHAT & HOW
WHEN SHOULD YOU USE A PSS SIMULATION?
 When there isn’t an easier way. Before you start down the road of power
simulations, check whether any R packages exist for the power simulation you
want to perform!
PSS R PACKAGES https://med.und.edu/research/daccota/_files/pdfs/berd
c_resource_pdfs/sample_size_r_module.pdf
 Monte Carlo Simulation (aka, Monte Carlo Method or a multiple
probability simulation) is a mathematical technique invented during
WWII by John von Neumann and Stanislaw Ulam that is used to
estimate the possible outcomes of an uncertain event (e.g.,
modeling nuclear fission to develop atomic bombs).
 Because the element of chance (similar to a game of roulette) is
core to the modeling approach, it’s named after the well-known
casino district in Monaco.
 They are used in a wide range of fields and applications, including
financial risk assessment and long-term forecasting, estimating the
duration or cost of projects, analyzing weather patterns, traffic flow,
and in a wide swath of applications in biomedical research.
WHAT IS A MONTE CARLO SIMULATION?
 Monte Carlo Simulation (aka, Monte Carlo Method or a multiple
probability simulation) is a mathematical technique invented during
WWII by John von Neumann and Stanislaw Ulam that is used to
estimate the possible outcomes of an uncertain event (e.g.,
modeling nuclear fission to develop atomic bombs).
 Because the element of chance (similar to a game of roulette) is
core to the modeling approach, it’s named after the well-known
casino district in Monaco.
 They are used in a wide range of fields and applications, including
financial risk assessment and long-term forecasting, estimating the
duration or cost of projects, analyzing weather patterns, traffic flow,
and in a wide swath of applications in biomedical research.
WHAT IS A MONTE CARLO SIMULATION?
WHAT IS A MONTE CARLO SIMULATION?
 Monte Carlo Simulation (aka, Monte Carlo Method or a multiple
probability simulation) is a mathematical technique invented during
WWII by John von Neumann and Stanislaw Ulam that is used to
estimate the possible outcomes of an uncertain event (e.g.,
modeling nuclear fission to develop atomic bombs).
 Because the element of chance (similar to a game of roulette) is
core to the modeling approach, it’s named after the well-known
casino district in Monaco.
 They are used in a wide range of fields and applications, including
financial risk assessment and long-term forecasting, estimating the
duration or cost of projects, analyzing weather patterns, traffic flow,
and in a wide swath of applications in biomedical research.
HOW DOES A MONTE CARLO FORECASTING SIMULATION WORK?
 Three basic steps:
 Specify probability distributions of the independent variables (distribution,
range, correlations, etc)
 Set up your hypothesized predictive model, including dependent (outcome)
variable and the independent variable(s) (predictors & covariates)
 Run simulations of your model repeatedly, using generated random values of
the independent variables every time to created a predicted value of the
outcome. Do this until enough results are gathered to make a probability
distribution of your forecasted outcome.
HOW DOES A MONTE CARLO PSS SIMULATION WORK?
 Three basic steps:
 Specify probability distributions and of the independent and dependent variables (distribution,
range, correlations, etc) based on your hypothesized predictive model of the true relationship
between variables
 Run simulations repeatedly, generating random values of the independent and dependent
variables every time, and test your model’s ability to detect their true relationship at the
specified N /effect size/alpha. Do this repeatedly to assess what proportion of your simulated
results can detect the true relationship between predictor and outcome (i.e., p-value < alpha).
This is your power.
 If you’re happy with your power from the previous step, skip this step. If you’re power is too low
(e.g., <0.80), increase your N or effect size. If you’re power is higher than you need, you can
lower the N or effect size to find the minimum detectable at the desired power.
YES, BUT HOW DO YOU ACTUALLY DO THIS IN R?
 The rest of this seminar will be taking place in the R Studio environment. Code and data used is
available in Posit cloud by following this link:
https://posit.cloud/spaces/409887/join?access_code=VJ50mLqZ55QM8kAGEAGZfd5ZPnOfCw0
8LvW8i7Qv
 The next few slides will briefly walk you through the process of accessing seminar code, which can
be done now or at a later date using the above link
JOINING POSIT SPACE
 Sign up for free Posit Cloud account:
https://posit.cloud/plans/free
 After you are logged in, click link to the
shared workspace:
https://posit.cloud/spaces/409887/join?a
ccess_code=VJ50mLqZ55QM8kAGEAGZfd5
ZPnOfCw08LvW8i7Qv
 When prompted, say “Yes” to Join Space
JOINING POSIT SPACE
Click
this
OPEN PROJECT
Click this to
open a
temporary
copy
Click + to
make
yourself a
permanent
copy
OPEN PSS SIMULATIONS IN R.RMD FILE
Open code
Questions?
1 of 25

Recommended

ProbErrorBoundROM_MC2015 by
ProbErrorBoundROM_MC2015ProbErrorBoundROM_MC2015
ProbErrorBoundROM_MC2015Mohammad Abdo
135 views9 slides
Probabilistic Error Bounds for Reduced Order Modeling M&C2015 by
Probabilistic Error Bounds for Reduced Order Modeling M&C2015Probabilistic Error Bounds for Reduced Order Modeling M&C2015
Probabilistic Error Bounds for Reduced Order Modeling M&C2015Mohammad
157 views9 slides
RDO_01_2016_Journal_P_Web by
RDO_01_2016_Journal_P_WebRDO_01_2016_Journal_P_Web
RDO_01_2016_Journal_P_WebSahl Martin
708 views21 slides
Md simulation and stochastic simulation by
Md simulation and stochastic simulationMd simulation and stochastic simulation
Md simulation and stochastic simulationAbdulAhad358
113 views23 slides
Simulation notes by
Simulation notesSimulation notes
Simulation notesmelkamu desalew
288 views24 slides
Quantifying petrophysical Uncertainties Spe 93125-ms by
Quantifying petrophysical Uncertainties Spe 93125-msQuantifying petrophysical Uncertainties Spe 93125-ms
Quantifying petrophysical Uncertainties Spe 93125-msAli .Y.J
620 views6 slides

More Related Content

Similar to OCTRI PSS Simulations in R Seminar.pdf

MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN... by
MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN...MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN...
MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN...Daksh Raj Chopra
2.5K views64 slides
Kinetic bands versus Bollinger Bands by
Kinetic bands versus Bollinger  BandsKinetic bands versus Bollinger  Bands
Kinetic bands versus Bollinger BandsAlexandru Daia
30 views7 slides
Gene's law by
Gene's lawGene's law
Gene's lawHoopeer Hoopeer
24 views10 slides
Six Sigma Methods and Formulas for Successful Quality Management by
Six Sigma Methods and Formulas for Successful Quality ManagementSix Sigma Methods and Formulas for Successful Quality Management
Six Sigma Methods and Formulas for Successful Quality ManagementIJERA Editor
40 views4 slides
ABDO_MLROM_PHYSOR2016 by
ABDO_MLROM_PHYSOR2016ABDO_MLROM_PHYSOR2016
ABDO_MLROM_PHYSOR2016Mohammad Abdo
120 views7 slides
Thesis Statement On Graphene by
Thesis Statement On GrapheneThesis Statement On Graphene
Thesis Statement On GrapheneCynthia Smith
2 views42 slides

Similar to OCTRI PSS Simulations in R Seminar.pdf(20)

MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN... by Daksh Raj Chopra
MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN...MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN...
MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN...
Daksh Raj Chopra2.5K views
Kinetic bands versus Bollinger Bands by Alexandru Daia
Kinetic bands versus Bollinger  BandsKinetic bands versus Bollinger  Bands
Kinetic bands versus Bollinger Bands
Alexandru Daia30 views
Six Sigma Methods and Formulas for Successful Quality Management by IJERA Editor
Six Sigma Methods and Formulas for Successful Quality ManagementSix Sigma Methods and Formulas for Successful Quality Management
Six Sigma Methods and Formulas for Successful Quality Management
IJERA Editor40 views
Machine Status Prediction for Dynamic and Heterogenous Cloud Environment by jins0618
Machine Status Prediction for Dynamic and Heterogenous Cloud EnvironmentMachine Status Prediction for Dynamic and Heterogenous Cloud Environment
Machine Status Prediction for Dynamic and Heterogenous Cloud Environment
jins0618166 views
Aj Copulas V4 by jainan33
Aj Copulas V4Aj Copulas V4
Aj Copulas V4
jainan331.4K views
Max Kuhn's talk on R machine learning by Vivian S. Zhang
Max Kuhn's talk on R machine learningMax Kuhn's talk on R machine learning
Max Kuhn's talk on R machine learning
Vivian S. Zhang5.5K views
Data Trend Analysis by Assigning Polynomial Function For Given Data Set by IJCERT
Data Trend Analysis by Assigning Polynomial Function For Given Data SetData Trend Analysis by Assigning Polynomial Function For Given Data Set
Data Trend Analysis by Assigning Polynomial Function For Given Data Set
IJCERT178 views
Machine Learning Guide maXbox Starter62 by Max Kleiner
Machine Learning Guide maXbox Starter62Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62
Max Kleiner65 views
2. System Simulation modeling unit i by Amita Gautam
2. System Simulation modeling unit i2. System Simulation modeling unit i
2. System Simulation modeling unit i
Amita Gautam79 views
Random Forest Ensemble of Support Vector Regression for Solar Power Forecasting by Mohamed Abuella
Random Forest Ensemble of Support Vector Regression for Solar Power ForecastingRandom Forest Ensemble of Support Vector Regression for Solar Power Forecasting
Random Forest Ensemble of Support Vector Regression for Solar Power Forecasting
Mohamed Abuella425 views
Monte carlo simulation by k1kumar
Monte carlo simulationMonte carlo simulation
Monte carlo simulation
k1kumar575 views
Performance characterization in computer vision by potaters
Performance characterization in computer visionPerformance characterization in computer vision
Performance characterization in computer vision
potaters498 views
Monte carlo simulation in food application by Priya darshini
Monte carlo simulation in food applicationMonte carlo simulation in food application
Monte carlo simulation in food application
Priya darshini654 views

Recently uploaded

3196 The Case of The East River by
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East RiverErickANDRADE90
17 views4 slides
CRM stick or twist workshop by
CRM stick or twist workshopCRM stick or twist workshop
CRM stick or twist workshopinfo828217
11 views16 slides
PRIVACY AWRE PERSONAL DATA STORAGE by
PRIVACY AWRE PERSONAL DATA STORAGEPRIVACY AWRE PERSONAL DATA STORAGE
PRIVACY AWRE PERSONAL DATA STORAGEantony420421
5 views56 slides
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int... by
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...DataScienceConferenc1
5 views17 slides
Amy slides.pdf by
Amy slides.pdfAmy slides.pdf
Amy slides.pdfStatsCommunications
5 views13 slides
Dr. Ousmane Badiane-2023 ReSAKSS Conference by
Dr. Ousmane Badiane-2023 ReSAKSS ConferenceDr. Ousmane Badiane-2023 ReSAKSS Conference
Dr. Ousmane Badiane-2023 ReSAKSS ConferenceAKADEMIYA2063
5 views34 slides

Recently uploaded(20)

3196 The Case of The East River by ErickANDRADE90
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East River
ErickANDRADE9017 views
CRM stick or twist workshop by info828217
CRM stick or twist workshopCRM stick or twist workshop
CRM stick or twist workshop
info82821711 views
PRIVACY AWRE PERSONAL DATA STORAGE by antony420421
PRIVACY AWRE PERSONAL DATA STORAGEPRIVACY AWRE PERSONAL DATA STORAGE
PRIVACY AWRE PERSONAL DATA STORAGE
antony4204215 views
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int... by DataScienceConferenc1
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...
Dr. Ousmane Badiane-2023 ReSAKSS Conference by AKADEMIYA2063
Dr. Ousmane Badiane-2023 ReSAKSS ConferenceDr. Ousmane Badiane-2023 ReSAKSS Conference
Dr. Ousmane Badiane-2023 ReSAKSS Conference
AKADEMIYA20635 views
[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ... by DataScienceConferenc1
[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ...[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ...
[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ...
Ukraine Infographic_22NOV2023_v2.pdf by AnastosiyaGurin
Ukraine Infographic_22NOV2023_v2.pdfUkraine Infographic_22NOV2023_v2.pdf
Ukraine Infographic_22NOV2023_v2.pdf
AnastosiyaGurin1.4K views
[DSC Europe 23] Luca Morena - From Psychohistory to Curious Machines by DataScienceConferenc1
[DSC Europe 23] Luca Morena - From Psychohistory to Curious Machines[DSC Europe 23] Luca Morena - From Psychohistory to Curious Machines
[DSC Europe 23] Luca Morena - From Psychohistory to Curious Machines
4_4_WP_4_06_ND_Model.pptx by d6fmc6kwd4
4_4_WP_4_06_ND_Model.pptx4_4_WP_4_06_ND_Model.pptx
4_4_WP_4_06_ND_Model.pptx
d6fmc6kwd47 views
Data about the sector workshop by info828217
Data about the sector workshopData about the sector workshop
Data about the sector workshop
info82821715 views
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo... by DataScienceConferenc1
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init... by DataScienceConferenc1
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ... by DataScienceConferenc1
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...
Chapter 3b- Process Communication (1) (1)(1) (1).pptx by ayeshabaig2004
Chapter 3b- Process Communication (1) (1)(1) (1).pptxChapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
ayeshabaig20047 views
Product Research sample.pdf by AllenSingson
Product Research sample.pdfProduct Research sample.pdf
Product Research sample.pdf
AllenSingson29 views

OCTRI PSS Simulations in R Seminar.pdf

  • 1. DATE: SEPTEMBER 21, 2023 PRESENTED BY: ROBIN BAUDIER, MSPH, MFA, STAFF BIOSTATISTICIAN WITH THE BDP Power and Sample Size Simulations in R OCTRI Research Forum
  • 2. TOPICS COVERED Brief overviews of  Power and Sample Size (PSS) concepts  Monte Carlo Simulations  Using Monte Carlo Simulations to calculate PSS How to perform PSS simulations in R  Simulating variables  Using loops  Looping tests on simulated datasets to calculate power  Examples of complex PSS simulations  Packages that can make things a little easier
  • 3. POWER & SAMPLE SIZE CALCULATIONS A VERY BRIEF OVERVIEW
  • 4. FOR MORE INFORMATION ON THE BASICS OF PSS CALCULATIONS  Check out the OCTRI PSS 101 Seminar, co-developed by Meike Niederhausen, PhD and Alicia Johnson, MPH, and presented most recently by Alicia Johnson in July:  RECORDING: https://echo360.org/media/bd0064c8-327c-4b56-8279-9558cd307125/public  SLIDES: https://drive.google.com/file/d/1691RWaDzzRkjbdhbfjfxO7yKESRUjuAn/view
  • 5. Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214 Power is the probability of correctly rejecting the null hypothesis What is power? α is the probability of incorrectly rejecting the null hypothesis 1 - α 1 - β Critical Value
  • 6. Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214 Statistical test example: one-tailed T-test α = 0.05 1 - α 1 - β 0 1.645 Reject the null hypothesis if t > 1.645 d.f.: n1+n2-2 t
  • 7. Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214 1 - β Prediction example: bootstrapping ML model How do you determine if an machine learning (ML) model performs better than chance? You can create a null distribution by randomly permuting the outcome variable on your dataset a large number of times (e.g., 999) and run ML model on each dataset. 1 – (proportion of random R2 < real data model R2) = p-value ML model R2 H0: R2 = 0 HA: R2 > 0 Reject H0 if proportion of random R2 less than model R2 ≥95% α = 0.05
  • 8. Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214 PSS simulation example: In PSS simulations, rather than modeling the null distribution as you do in bootstrapping, you simulate the HA distribution (with a specified N, effect size, SD, etc) a large number of times and assess what proportion of statistical tests performed on simulated data are able to detect the effect of interest What is the probability of correctly rejecting the null hypothesis (power) with the specified effect size, N, and α? Power = proportion of models (performed on data simulated with HA distributions) with p-values <α HA models with p< α HA models with p≥ α
  • 9. Image adapted from: https://towardsdatascience.com/5-ways-to-increase-statistical-power-377c00dd0214 PSS simulation example: In PSS simulations, rather than modeling the null distribution as you do in bootstrapping, you simulate the HA distribution (with a specified N, effect size, SD, etc) a large number of times and assess what proportion of statistical tests performed on simulated data are able to detect the effect of interest What is the probability of correctly rejecting the null hypothesis (power) with the specified effect size, N, and α? Power = proportion of models (performed on data simulated with HA distributions) with p-values <α HA models with p< α HA models with p≥ α What if you don’t have good power?
  • 11. Also need to know: • What’s your data distribution and structure? • What statistical test/model are you planning to use?
  • 12. POWER & SAMPLE SIZE SIMULATIONS WHEN, WHAT & HOW
  • 13. WHEN SHOULD YOU USE A PSS SIMULATION?  When there isn’t an easier way. Before you start down the road of power simulations, check whether any R packages exist for the power simulation you want to perform!
  • 14. PSS R PACKAGES https://med.und.edu/research/daccota/_files/pdfs/berd c_resource_pdfs/sample_size_r_module.pdf
  • 15.  Monte Carlo Simulation (aka, Monte Carlo Method or a multiple probability simulation) is a mathematical technique invented during WWII by John von Neumann and Stanislaw Ulam that is used to estimate the possible outcomes of an uncertain event (e.g., modeling nuclear fission to develop atomic bombs).  Because the element of chance (similar to a game of roulette) is core to the modeling approach, it’s named after the well-known casino district in Monaco.  They are used in a wide range of fields and applications, including financial risk assessment and long-term forecasting, estimating the duration or cost of projects, analyzing weather patterns, traffic flow, and in a wide swath of applications in biomedical research. WHAT IS A MONTE CARLO SIMULATION?
  • 16.  Monte Carlo Simulation (aka, Monte Carlo Method or a multiple probability simulation) is a mathematical technique invented during WWII by John von Neumann and Stanislaw Ulam that is used to estimate the possible outcomes of an uncertain event (e.g., modeling nuclear fission to develop atomic bombs).  Because the element of chance (similar to a game of roulette) is core to the modeling approach, it’s named after the well-known casino district in Monaco.  They are used in a wide range of fields and applications, including financial risk assessment and long-term forecasting, estimating the duration or cost of projects, analyzing weather patterns, traffic flow, and in a wide swath of applications in biomedical research. WHAT IS A MONTE CARLO SIMULATION?
  • 17. WHAT IS A MONTE CARLO SIMULATION?  Monte Carlo Simulation (aka, Monte Carlo Method or a multiple probability simulation) is a mathematical technique invented during WWII by John von Neumann and Stanislaw Ulam that is used to estimate the possible outcomes of an uncertain event (e.g., modeling nuclear fission to develop atomic bombs).  Because the element of chance (similar to a game of roulette) is core to the modeling approach, it’s named after the well-known casino district in Monaco.  They are used in a wide range of fields and applications, including financial risk assessment and long-term forecasting, estimating the duration or cost of projects, analyzing weather patterns, traffic flow, and in a wide swath of applications in biomedical research.
  • 18. HOW DOES A MONTE CARLO FORECASTING SIMULATION WORK?  Three basic steps:  Specify probability distributions of the independent variables (distribution, range, correlations, etc)  Set up your hypothesized predictive model, including dependent (outcome) variable and the independent variable(s) (predictors & covariates)  Run simulations of your model repeatedly, using generated random values of the independent variables every time to created a predicted value of the outcome. Do this until enough results are gathered to make a probability distribution of your forecasted outcome.
  • 19. HOW DOES A MONTE CARLO PSS SIMULATION WORK?  Three basic steps:  Specify probability distributions and of the independent and dependent variables (distribution, range, correlations, etc) based on your hypothesized predictive model of the true relationship between variables  Run simulations repeatedly, generating random values of the independent and dependent variables every time, and test your model’s ability to detect their true relationship at the specified N /effect size/alpha. Do this repeatedly to assess what proportion of your simulated results can detect the true relationship between predictor and outcome (i.e., p-value < alpha). This is your power.  If you’re happy with your power from the previous step, skip this step. If you’re power is too low (e.g., <0.80), increase your N or effect size. If you’re power is higher than you need, you can lower the N or effect size to find the minimum detectable at the desired power.
  • 20. YES, BUT HOW DO YOU ACTUALLY DO THIS IN R?  The rest of this seminar will be taking place in the R Studio environment. Code and data used is available in Posit cloud by following this link: https://posit.cloud/spaces/409887/join?access_code=VJ50mLqZ55QM8kAGEAGZfd5ZPnOfCw0 8LvW8i7Qv  The next few slides will briefly walk you through the process of accessing seminar code, which can be done now or at a later date using the above link
  • 21. JOINING POSIT SPACE  Sign up for free Posit Cloud account: https://posit.cloud/plans/free  After you are logged in, click link to the shared workspace: https://posit.cloud/spaces/409887/join?a ccess_code=VJ50mLqZ55QM8kAGEAGZfd5 ZPnOfCw08LvW8i7Qv  When prompted, say “Yes” to Join Space
  • 23. OPEN PROJECT Click this to open a temporary copy Click + to make yourself a permanent copy
  • 24. OPEN PSS SIMULATIONS IN R.RMD FILE Open code