I do not want main effect because it is collinear with a finer factor fixed effect, so it is annoying to have these
lm(y ~ x * z)
From your question,
x is numeric. Assuming you have
z as a factor already, the specification you want is:
y ~ x + x:z
x is numeric, it is equivalent to do
y ~ x:z
The only difference here is parametrization (see examples below).
x is a factor, too, these two specifications are different which you can read Why do I get NA coefficients and how does
lm drop reference level for interaction.
Consider a small example:
set.seed(0) y <- rnorm(10) x <- rnorm(10) z <- gl(2, 5, labels = letters[1:2]) fit1 <- lm(y ~ x + x:z) #Coefficients: #(Intercept) x x:zb # 0.1989 -0.1627 -0.5456 fit2 <- lm(y ~ x:z) #Coefficients: #(Intercept) x:za x:zb # 0.1989 -0.1627 -0.7082
You can check the equivalence
all.equal(fit1$fitted, fit2$fitted) #  TRUE