Regression: If a variable contains all zero then code breaks
See original GitHub issuevar A=[[1,2,0],
[1,1,0],
[1,-2,0],
[1,3,0],
[1,-10,0],
[1,4,0],
[1,10,0],
[1,3,0],
[1,4,0]];
var b=[1,-2,3,4,-5,6,7,-8,9];
var model=jStat.models.ols(b,A);
Try to run this and then the code will break.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Force R to include 0 as a value in a regression of counts vs year
When we use all the values, including the zeros, the intercept is about -38 and the year coefficient is about 0.02.
Read more >When is it ok to impute missing values with a zero?
Subtituting missing values with zero can be justified but if used incorrectly, can result in misleading insights.
Read more >MIS 175 Section 4 - Second Midterm Examination
c. estimated regression equation. d. regression model. 2. The mathematical equation relating the independent variable to the expected value of the ...
Read more >Choosing the Correct Type of Regression Analysis
So I have one continuous dependent variable (engagement) and 3 categorical independent variables (all with 2 levels each: information (yes/no), entertainment ( ...
Read more >The log-0 problem: analysis strategies and options for ...
We have specific tools for working the discrete data. These distributions allow 0 values, so we can potentially avoid the issue all together ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve done some investigation and implementing this reliably will take some time. I was also thinking to add a
throwOnNaN()
option that will throw (like it currently does) when aNaN
would be returned. Mainly to help debugging.@samipjain What about returning
NaN
? I think that would indicate the input parameters aren’t valid.