For intuition, consider that the $F$ test assesses whether all three variables B
, C
, and the interaction B:C
collectively "explain" the variance of the response, whereas the t-test for any single coefficient considers only that coefficient (after the effects of the other coefficients have been accounted for). The F-test has to account for the presence of B
and C
along with B:C
(and does so by having $3,$ rather than $1,$ numerator degrees of freedom). Therefore, when the true coefficients of B
and C
are relatively small, it ought to be possible for the situation you describe to hold. In fact, this might even be fairly common.
The intuition suggests a stupid but effective search for an example: create a small dataset with B
, C
, and B:C
variables; use a model in which the only nonzero coefficient is the interaction; add some Gaussian noise; and see what happens. Make a few trials with different variances for the errors, looking for a situation where the p-values aren't extreme: neither very tiny nor too close to $1.$ Then simply keep adding different noise terms to the model until you get an example.
On the third try I found this one with eight (balanced) observations.
Call:
lm(formula = A ~ B * C, data = X)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.7597 0.4766 1.594 0.1861
B -1.0211 0.6740 -1.515 0.2044
C -0.8084 0.6740 -1.199 0.2966
B:C 3.2233 0.9532 3.381 0.0277 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.674 on 4 degrees of freedom
Multiple R-squared: 0.7981, Adjusted R-squared: 0.6466
F-statistic: 5.27 on 3 and 4 DF, p-value: 0.07109
There's nothing strange about the data: you can run the code below and plot diagnostics of the model if you like (plot(fit)
); they look fine.
Here are the details of the search, performed with R
.
X <- expand.grid(B=0:1, C=0:1)
X <- rbind(X, X) # A small dataset of 8 observations
M <- model.matrix(~ B*C, X) # Useful for computing predicted values
beta <- c(0,0,0,1) # The model: only the `B:C` term is nonzero
sigma <- 1 # The SD of the noise terms
set.seed(17)
n.tries <- 100
for (i in 1:5) {
X$A <- M %*% beta + rnorm(nrow(X), 0, sigma)
s <- summary(fit <- lm(A ~ B*C, X))
p <- coefficients(s)["B:C", 4]
if (p < 0.05 &&
pf(s$fstatistic[1], s$fstatistic[2], s$fstatistic[3], lower.tail=FALSE) > 0.05) break
}
if (i < n.tries) print(s) else print("No example found.")
```