How do you set up multiple variable regression with no intercept term? Can anyone help with the set up of a multiple variable regression function that does not have an intercept (no beta hat 0)? I've tried to figure it out based on class notes for one variable regression without an intercept and multiple variable regression with an intercept but my answers seem way way off.
This is the specific question:


Ditch the intercept term and fit as usual. Unlike in regression with an intercept, the model matrix (typically denoted by $X$) will not have a column of $1$s. However, if you make a matrix $X$ with each vector of variable values as a column, then the usual equation works: $\hat\beta=(X^TX)^{-1}X^Ty$.
At least in R software, the reported $R^2$ sneakily uses a different formula than usual. While this choice can be defended, it is worth knowing that it does this and that other software might, too. Their $R^2$ in this situation is:
$$
R^2=1-\dfrac{\sum\left(
y_i-\hat y_i
\right)^2}{
\sum y_i^2
}
$$
