science.js’s loess() output is identical to input
        Posted  
        
            by 
                user3710111
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user3710111
        
        
        
        Published on 2014-06-05T09:22:41Z
        Indexed on 
            2014/06/05
            9:25 UTC
        
        
        Read the original article
        Hit count: 538
        
Rendered project available here. The line is supposed to be a trend line (as rendered with LOESS), but it merely follows each data point instead.
I am no stats wonk, so maybe it makes sense that a LOESS function’s output would match the input as seen in the above example, but it strikes me as being wrong.
Here is the relevant bit of code:
var loess = science.stats.loess().bandwidth(.2);
var xVal = data.map(function(d) { return d.date; });
var yVal = data.map(function(d) { return d.A;    });
var loessData = loess([xVal], [yVal])[0];
console.log(yVal);
console.log(loessData);
© Stack Overflow or respective owner