“In the second method, X must be a matrix holding values of the independent variable(s) in columns (including if appropriate the intercept), and y must be a vector holding values of the dependent variable.”
I want to use the second method to get same results of the first method of GLM.lm, but how to let X hold a column for the intercept? I haven’t found an example for it.