question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression: If a variable contains all zero then code breaks

See original GitHub issue
var 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:open
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
trevnorriscommented, Nov 4, 2019

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 a NaN would be returned. Mainly to help debugging.

1reaction
trevnorriscommented, Oct 10, 2019

@samipjain What about returning NaN? I think that would indicate the input parameters aren’t valid.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found