On first level, I think all you are ignoring shrinkage toward the population values; "the per-subject slopes and intercepts from the mixed-effects model are closer to the population estimates than are the within-subject least squares estimates." [ref. 1]. The following link probably will also be of help (What are the proper descriptives to look at for my mixed-models?), see Mike Lawrence's answer).
Furthermore, I think you are marginally unlucky in your toy example because you have a perfectly balanced design that cause you to have the exact same estimate in the case of no missing values.
Try the following code which has the same process with no missing value now:
cat <- as.factor(sample(1:5, n*k, replace=T) ) #This should be a bit unbalanced.
cat_i <- 1:k # intercept per kategorie
x <- rep(1:n, k)
sigma <- 0.2
alpha <- 0.001
y <- cat_i[cat] + alpha * x + rnorm(n*k, 0, sigma)
m1 <- lm(y ~ x)
m3 <- lme(y ~ x, random = ~ 1|cat, na.action = na.omit)
round(digits= 7,fixef(m3)) == round(digits=7, coef(m1)) #Not this time lad.
#(Intercept) x
# FALSE FALSE
Where now, because your design is not perfectly balanced you don't have the same coefficient estimates.
Actually if you play along with your missing value pattern in a silly way ( so for instance: y[ c(1:10, 100 + 1:10, 200 + 1:10, 300 + 1:10, 400 +1:10)] <- NA
) so your design is still perfectly balanced you'll get the same coefficients again.
require(nlme)
set.seed(128)
n <- 100
k <- 5
cat <- as.factor(rep(1:k, each = n))
cat_i <- 1:k # intercept per kategorie
x <- rep(1:n, k)
sigma <- 0.2
alpha <- 0.001
y <- cat_i[cat] + alpha * x + rnorm(n*k, 0, sigma)
plot(x, y)
# simulate missing data in a perfectly balanced way
y[ c(1:10, 100 + 1:10, 200 + 1:10, 300 + 1:10, 400 +1:10)] <- NA
m1 <- lm(y ~ x)
m3 <- lme(y ~ x, random = ~ 1|cat, na.action = na.omit)
round(digits=7,fixef(m3)) == round(digits=7, coef(m1)) #Look what happend now...
#(Intercept) x
# TRUE TRUE
You are marginally misguided by the perfect design of your original experiment. When you inserted the NA's in a non-balanced away you changed the pattern of how much "strength" could the individual subjects borrow from each other.
In short the differences you see are due to shrinkage effects and more specifically because you distorted your original perfectly-balanced design with non-perfectly-balanced missing values.
Ref 1: Douglas Bates lme4:Mixed-effects modeling with R, pages 71-72
m3
it is 0.0011713" instead ofm2
. $\endgroup$m2
it is valid also (which is subject of another question). $\endgroup$