Computer Science, asked by yukti268, 11 months ago

Why do you add a constant to the train set using the sm.Add_constant() command, when youre fitting a line using statsmodels?

Answers

Answered by abirami200014
11

Answer:

statsmodels however provides a convenience function calledadd_constant that adds a constantcolumn to input data set. Answer:By default, statsmodels fits a line passing through the origin, i.e. it doesn't fit an intercept. Hence, you need to use thecommand 'add_constant' so that it also fits an intercept.

Similar questions