And the matrix of $X$ is
How do I input this matrix into R?
Assuming that x = 1,2, ... , N, N=10 and y = 2x + ε, ε ~ N(0,1) then you would write something like this:
N = 10;
set.seed(123)
x = 1:N
e = rnorm(N)
y = 2*x + e;
mod <- lm( y ~x);
Xmatrix = matrix( c(rep(1,N), x), ncol=2)
Please see the following link on Matrices and matrix computations in R for more details on tihs matter.
You can either input this matrix into R and do Y~X, or omit the intercept and do Y~${X}_i$-1, where $X_i$ is only a vector.