Skip to content

Instantly share code, notes, and snippets.

View dizyd's full-sized avatar

David Izydorczyk dizyd

View GitHub Profile
@dizyd
dizyd / post_hoc_power_AA.R
Last active August 24, 2020 14:17
Post-Hoc-Power Simulation
# The code is based on:
# Arend, M. G., & Schäfer, T. (2019). Statistical power in two-level models: A tutorial based on Monte Carlo simulation.
# Psychological Methods, 24(1), 1–19. https://doi.org/10.1037/met0000195
alpha = 0.05 # significance level
nL1 = 3 # average number of observations per person (actual = 3.8)
nL2 = 100 # number of persons
effect = 0.1 # small, 0.3 medium, 0.5 large effect
ICC = 0.1
@dizyd
dizyd / LRHyp
Created September 3, 2017 10:35
Calculate the likelihood ratio between Hypotheses
# Calculate the likelihood ratio between Hypotheses----
options(scipen=9999)
n <- 3 # number of experiments
x <- 0:3 # number of successes
## probability of finding a significant result
H0 <- 0.05 # = alpha
@dizyd
dizyd / simulationAndAnalysisSEM.R
Last active August 16, 2017 19:41
Simulation and Planned Analysis
## Junior Researcher Programme 2017
## Project: From Identity Leadership to Work Commitment
## Simulation of data and associated syntax for planned analysis
# Packages ----------------------------------------------------------------
# Check if packages are installed, if not install and load them