1

This is related to linear regression analysis. When I add a column of ones for the intercept term in the design matrix, why do I have to assign a column of 1.0 instead of 1? (The ordinary least square solution using a column of 1.0 is different from using a column of 1)

zechi
  • 13
  • 2
  • 1
    Welcome to Stack Overflow. Please read the [help pages](https://stackoverflow.com/help), take the [SO tour](https://stackoverflow.com/tour), read about [how to ask good questions](https://stackoverflow.com/help/how-to-ask), as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). Lastly learn how to create a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) – gehbiszumeis Aug 15 '19 at 08:23
  • @gehbiszumeis the Original Poster is not asking about a specific coding problem or error, and there is no code to be posted for this question. Please read the question again. – James Phillips Aug 15 '19 at 09:15
  • @JamesPhillips. The question has multiple issues with respect to the how-to-ask-good-questions page, which I was pointing out. And of course an MCVE would be possible also in context of this question (I was never asking for a code to be posted). No need to read the question again. – gehbiszumeis Aug 15 '19 at 09:22
  • @gehbiszumeis you may consider me to have been corrected. – James Phillips Aug 15 '19 at 09:28

1 Answers1

1

Probably type consistency: There are multiple numeric types, and all values in your matrix should have the same type. So, assuming that the rest of your matrix is not integers, your ones also can't be integers.

Edit: ref. kind of similar issue discussed here: Store different datatypes in one NumPy array?

AmundF
  • 41
  • 3