# problem with simple regression in R: one continuous response variable vs. two interacting categorical variables

I have a dataset with a single continuous response variable, z, dependent on two categorical variables: x and y. x and y are applied individually, and together, and I interested in both the individual effects and any interaction effects.

I am hitting collinearity in my predictor variables, but I can't see it -see below. Is my encoding wrong, or my data too incomplete?

A toy-version of my data in R:

test_df <- data.frame(
x = c(0,0,0,0, 1,1,1,1, 1,1,1,1),
y = c(1,1,1,1, 0,0,0,0, 1,1,1,1),
z = c(1.1,2.1,1.5,1.2,
1.5,1.2,2,1.1,
7,8,9,10)
)
test_df$x <- as.factor(test_df$x)
test_df$y <- as.factor(test_df$y)
summary(lm(z ~ x * y, test_df))
alias(lm(z ~ x * y, test_df))


My problem is that I'm trying to recover the big jump in z when both x and y are '1'. In this case the lm gives this result:

Coefficients: (1 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
(Intercept)  -0.5750     0.7128  -0.807  0.44067
x1            2.0250     0.5820   3.479  0.00695 **
y1            2.0500     0.5820   3.522  0.00649 **
x1:y1             NA         NA      NA       NA


What am I doing wrong here? Variables x and y don't seem manifestly dependent. I've been playing with different amounts of toy data and different encoding schemes, to no avail. Thanks.