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 de 25

Recomendados

ProbErrorBoundROM_MC2015 por
ProbErrorBoundROM_MC2015ProbErrorBoundROM_MC2015
ProbErrorBoundROM_MC2015Mohammad Abdo
135 vistas9 diapositivas
Probabilistic Error Bounds for Reduced Order Modeling M&C2015 por
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 vistas9 diapositivas
RDO_01_2016_Journal_P_Web por
RDO_01_2016_Journal_P_WebRDO_01_2016_Journal_P_Web
RDO_01_2016_Journal_P_WebSahl Martin
708 vistas21 diapositivas
Md simulation and stochastic simulation por
Md simulation and stochastic simulationMd simulation and stochastic simulation
Md simulation and stochastic simulationAbdulAhad358
108 vistas23 diapositivas
Simulation notes por
Simulation notesSimulation notes
Simulation notesmelkamu desalew
288 vistas24 diapositivas
Quantifying petrophysical Uncertainties Spe 93125-ms por
Quantifying petrophysical Uncertainties Spe 93125-msQuantifying petrophysical Uncertainties Spe 93125-ms
Quantifying petrophysical Uncertainties Spe 93125-msAli .Y.J
620 vistas6 diapositivas

Más contenido relacionado

Similar a OCTRI PSS Simulations in R Seminar.pdf

MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN... por
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 vistas64 diapositivas
Kinetic bands versus Bollinger Bands por
Kinetic bands versus Bollinger  BandsKinetic bands versus Bollinger  Bands
Kinetic bands versus Bollinger BandsAlexandru Daia
30 vistas7 diapositivas
Gene's law por
Gene's lawGene's law
Gene's lawHoopeer Hoopeer
24 vistas10 diapositivas
Six Sigma Methods and Formulas for Successful Quality Management por
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 vistas4 diapositivas
ABDO_MLROM_PHYSOR2016 por
ABDO_MLROM_PHYSOR2016ABDO_MLROM_PHYSOR2016
ABDO_MLROM_PHYSOR2016Mohammad Abdo
120 vistas7 diapositivas
Thesis Statement On Graphene por
Thesis Statement On GrapheneThesis Statement On Graphene
Thesis Statement On GrapheneCynthia Smith
2 vistas42 diapositivas

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

MATLAB IMPLEMENTATION OF SELF-ORGANIZING MAPS FOR CLUSTERING OF REMOTE SENSIN... por 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 vistas
Kinetic bands versus Bollinger Bands por Alexandru Daia
Kinetic bands versus Bollinger  BandsKinetic bands versus Bollinger  Bands
Kinetic bands versus Bollinger Bands
Alexandru Daia30 vistas
Six Sigma Methods and Formulas for Successful Quality Management por 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 vistas
Machine Status Prediction for Dynamic and Heterogenous Cloud Environment por 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 vistas
Aj Copulas V4 por jainan33
Aj Copulas V4Aj Copulas V4
Aj Copulas V4
jainan331.4K vistas
Max Kuhn's talk on R machine learning por 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 vistas
Data Trend Analysis by Assigning Polynomial Function For Given Data Set por 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 vistas
Machine Learning Guide maXbox Starter62 por Max Kleiner
Machine Learning Guide maXbox Starter62Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62
Max Kleiner65 vistas
2. System Simulation modeling unit i por Amita Gautam
2. System Simulation modeling unit i2. System Simulation modeling unit i
2. System Simulation modeling unit i
Amita Gautam78 vistas
Random Forest Ensemble of Support Vector Regression for Solar Power Forecasting por 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 vistas
Monte carlo simulation por k1kumar
Monte carlo simulationMonte carlo simulation
Monte carlo simulation
k1kumar573 vistas
Performance characterization in computer vision por potaters
Performance characterization in computer visionPerformance characterization in computer vision
Performance characterization in computer vision
potaters498 vistas
Monte carlo simulation in food application por Priya darshini
Monte carlo simulation in food applicationMonte carlo simulation in food application
Monte carlo simulation in food application
Priya darshini653 vistas

Último

How Leaders See Data? (Level 1) por
How Leaders See Data? (Level 1)How Leaders See Data? (Level 1)
How Leaders See Data? (Level 1)Narendra Narendra
13 vistas76 diapositivas
3196 The Case of The East River por
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East RiverErickANDRADE90
11 vistas4 diapositivas
Cross-network in Google Analytics 4.pdf por
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdfGA4 Tutorials
6 vistas7 diapositivas
MOSORE_BRESCIA por
MOSORE_BRESCIAMOSORE_BRESCIA
MOSORE_BRESCIAFederico Karagulian
5 vistas8 diapositivas
RuleBookForTheFairDataEconomy.pptx por
RuleBookForTheFairDataEconomy.pptxRuleBookForTheFairDataEconomy.pptx
RuleBookForTheFairDataEconomy.pptxnoraelstela1
67 vistas16 diapositivas
Survey on Factuality in LLM's.pptx por
Survey on Factuality in LLM's.pptxSurvey on Factuality in LLM's.pptx
Survey on Factuality in LLM's.pptxNeethaSherra1
5 vistas9 diapositivas

Último(20)

3196 The Case of The East River por ErickANDRADE90
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East River
ErickANDRADE9011 vistas
Cross-network in Google Analytics 4.pdf por GA4 Tutorials
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdf
GA4 Tutorials6 vistas
RuleBookForTheFairDataEconomy.pptx por noraelstela1
RuleBookForTheFairDataEconomy.pptxRuleBookForTheFairDataEconomy.pptx
RuleBookForTheFairDataEconomy.pptx
noraelstela167 vistas
Survey on Factuality in LLM's.pptx por NeethaSherra1
Survey on Factuality in LLM's.pptxSurvey on Factuality in LLM's.pptx
Survey on Factuality in LLM's.pptx
NeethaSherra15 vistas
Understanding Hallucinations in LLMs - 2023 09 29.pptx por Greg Makowski
Understanding Hallucinations in LLMs - 2023 09 29.pptxUnderstanding Hallucinations in LLMs - 2023 09 29.pptx
Understanding Hallucinations in LLMs - 2023 09 29.pptx
Greg Makowski13 vistas
Advanced_Recommendation_Systems_Presentation.pptx por neeharikasingh29
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptx
neeharikasingh295 vistas
Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023 por StatsCommunications
Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023
Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023
Chapter 3b- Process Communication (1) (1)(1) (1).pptx por 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
ayeshabaig20045 vistas
Introduction to Microsoft Fabric.pdf por ishaniuudeshika
Introduction to Microsoft Fabric.pdfIntroduction to Microsoft Fabric.pdf
Introduction to Microsoft Fabric.pdf
ishaniuudeshika24 vistas
Short Story Assignment by Kelly Nguyen por kellynguyen01
Short Story Assignment by Kelly NguyenShort Story Assignment by Kelly Nguyen
Short Story Assignment by Kelly Nguyen
kellynguyen0118 vistas
Supercharging your Data with Azure AI Search and Azure OpenAI por Peter Gallagher
Supercharging your Data with Azure AI Search and Azure OpenAISupercharging your Data with Azure AI Search and Azure OpenAI
Supercharging your Data with Azure AI Search and Azure OpenAI
Peter Gallagher37 vistas
Building Real-Time Travel Alerts por Timothy Spann
Building Real-Time Travel AlertsBuilding Real-Time Travel Alerts
Building Real-Time Travel Alerts
Timothy Spann109 vistas
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdf por vikas12611618
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdfVikas 500 BIG DATA TECHNOLOGIES LAB.pdf
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdf
vikas126116188 vistas

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