2026-06-12
In the classical approach we ask:
How likely are we to see data like this if the hypothesis is true?
How unlikely is “not very likely”?
Dans l’approche classique, on se demande :
Quelle est la probabilité d’observer de telles données si l’hypothèse est vraie ?
Qu’est-ce que « peu probable » ?
Before testing, decide what evidence would convince you the hypothesis is unreliable.
Othello believes Desdemona is innocent. Iago offers evidence:
Othello: the chance of all this if she were innocent is surely below 5%.
Avant de tester, fixez quelles preuves vous feraient douter de l’hypothèse.
Othello croit Desdemona innocente. Iago avance :
Othello : la probabilité de tout cela si elle était innocente est sûrement inférieure à 5 %.
Power is the probability of rejecting a hypothesis.
It presupposes:
La puissance est la probabilité de rejeter une hypothèse.
Elle présuppose :
Hypothesis: a six never comes up on this die.
Test:
What is the power of this test?
Hypothèse : un six ne sort jamais sur ce dé.
Test :
Quelle est la puissance de ce test ?
Same hypothesis — but roll twice.
Reject if a six appears either time.
What is the power of this test?
Même hypothèse — mais lancer deux fois.
Rejeter si un six apparaît l’une ou l’autre fois.
Quelle est la puissance de ce test ?
Power can seem harder because rejection involves a calculated probability — a probability of a probability.
Hypothesis: the die is fair.
What should \(x\) and \(y\) be?
La puissance peut sembler plus difficile car le rejet implique une probabilité calculée — une probabilité de probabilité.
Hypothèse : le dé est équitable.
Que valent \(x\) et \(y\) ?
Set a rejection rule based on events unlikely under the hypothesis.
Expected number of sixes if the die is fair is 166. What would be ‘unusually many’ 6s? What would be ‘unusually few’ 6s?
Fixer une règle de rejet à partir d’événements improbables sous l’hypothèse.
Nombre attendu de six si le dé est équitable :
143 or fewer is very few; 190 or more is very many:
143 ou moins, c’est très peu ; 190 ou plus, c’est très nombreux :
What is the power?
Now stipulate how the world really works — not the null you plan to reject.
Suppose sixes actually appear 20% of the time.
What is the probability of seeing at least 190 sixes?
Quelle est la puissance ?
Maintenant, décrire comment le monde fonctionne vraiment — pas l’hypothèse nulle que l’on compte rejeter.
Supposons que les six sortent 20 % du temps.
Quelle est la probabilité d’observer au moins 190 six ?
If sixes appear 20% of the time, you will likely see ≥ 190 sixes and reject “fair die.”
Si les six sortent 20 % du temps, vous verrez probablement ≥ 190 six et rejeterez « dé équitable ».
If the sampling distribution is centered on \(b\) with standard error 1, what is the probability of a significant estimate?
Add them: probability above 1.96 or below \(-1.96\).
Si la distribution d’échantillonnage est centrée sur \(b\) avec erreur-type 1, quelle est la probabilité d’une estimation significative ?
Sommez : probabilité au-dessus de 1,96 ou en dessous de \(-1.96\).
This is what pwrss::power.z.test does — with nice graphs.
If the true effect were 1.96, what would power be?
C’est ce que fait pwrss::power.z.test — avec de jolis graphiques.
Si l’effet vrai valait 1,96, quelle serait la puissance ?
Substantively: if an estimate is just significant on average, power is 50%.
Substantiellement : si une estimation est à peine significative en moyenne, la puissance est de 50 %.
Standard error depends on \(N\) and outcome variance \(\sigma\).
With \(N\) subjects in two equal groups:
\[Var(\tau)=\frac{\sigma^2}{N/2} + \frac{\sigma^2}{N/2} = 4\frac{\sigma^2}{N}\]
\[\sigma_\tau=\frac{2\sigma}{\sqrt{N}}\]
(Tests use an estimated standard error.)
L’erreur-type dépend de \(N\) et de la variance \(\sigma\).
Avec \(N\) sujets en deux groupes égaux :
\[Var(\tau)=\frac{\sigma^2}{N/2} + \frac{\sigma^2}{N/2} = 4\frac{\sigma^2}{N}\]
\[\sigma_\tau=\frac{2\sigma}{\sqrt{N}}\]
(Les tests utilisent une erreur-type estimée.)
Same idea with pwrss:
Même idée avec pwrss :
Mostly: figure out the standard error.
Cluster shock \(\epsilon_k\), individual shock \(\nu_i\) with variances \(\sigma^2_k\), \(\sigma^2_i\):
En pratique : calculer l’erreur-type.
Choc de grappe \(\epsilon_k\), choc individuel \(\nu_i\) avec variances \(\sigma^2_k\), \(\sigma^2_i\) :
\[\sqrt{\frac{4\sigma^2_k}{K} + \frac{4\sigma^2_i}{nK}}\]
With \(\rho = \frac{\sigma^2_k}{\sigma^2_k + \sigma^2_i}\):
\[\sqrt{((n - 1)\rho + 1)\frac{4\sigma^2}{nK}}\]
Avec \(\rho = \frac{\sigma^2_k}{\sigma^2_k + \sigma^2_i}\) :
\[\sqrt{((n - 1)\rho + 1)\frac{4\sigma^2}{nK}}\]
Plug in and proceed as before.
Insérez dans le calcul et procédez comme avant.
# Simple
N <- 100
complete_design <-
declare_model(
N = N,
State = sample(1:4, N, replace = TRUE),
U = rnorm(N)/4,
Y0 = State + U,
Y1 = State + U + .2
) +
declare_inquiry(ate = mean(Y1 - Y0)) +
declare_assignment(
Z = complete_ra(N),
Y = Z*Y1 + (1-Z)*Y0
) +
declare_estimator(Y ~ Z, label = "complete")# Simple
N <- 100
clustered_design <-
declare_model(
N = N,
State = sample(1:4, N, replace = TRUE),
U = rnorm(N)/4,
Y0 = State + U,
Y1 = State + U + .2
) +
declare_inquiry(ate = mean(Y1 - Y0)) +
declare_assignment(
Z = cluster_ra(clusters = State),
Y = Z*Y1 + (1-Z)*Y0
) +
declare_estimator(Y ~ Z, clusters = State, label = "clustered")# Simple
N <- 100
blocked_design <-
declare_model(
N = N,
State = sample(1:4, N, replace = TRUE),
U = rnorm(N)/4,
Y0 = State + U,
Y1 = State + U + .2
) +
declare_inquiry(ate = mean(Y1 - Y0)) +
declare_assignment(
Z = block_ra(blocks = State),
Y = Z*Y1 + (1-Z)*Y0
) +
declare_estimator(Y ~ Z + State, label = "blocked")Design diagnosis is arbitrarily flexible.
Le diagnostic de conception est arbitrairement flexible.
| Design | Mean Estimate | Bias | SD Estimate | RMSE | Power | Coverage |
|---|---|---|---|---|---|---|
| complete_design | 0.19 | -0.01 | 0.23 | 0.23 | 0.13 | 0.94 |
| (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | |
| clustered_design | 0.19 | -0.01 | 1.35 | 1.34 | 0.00 | 1.00 |
| (0.06) | (0.06) | (0.02) | (0.02) | (0.00) | (0.00) | |
| blocked_design | 0.20 | 0.00 | 0.05 | 0.05 | 0.99 | 0.95 |
| (0.00) | (0.00) | (0.00) | (0.00) | (0.01) | (0.01) |
diagnosis <-
list(redesign(complete_design, N = 100),
redesign(complete_design, N = 200),
redesign(complete_design, N = 600),
redesign(clustered_design, N = 100),
redesign(clustered_design, N = 200),
redesign(clustered_design, N = 600),
redesign(blocked_design, N = 100),
redesign(blocked_design, N = 200),
redesign(blocked_design, N = 600)) |>
diagnose_design(sims = 500)