repl.txt (1745B)
1 2 {{alias}}( x, y[, options] ) 3 Locally-weighted polynomial regression via the LOWESS algorithm. 4 5 Parameters 6 ---------- 7 x: Array<number> 8 x-axis values (abscissa values). 9 10 y: Array<number> 11 Corresponding y-axis values (ordinate values). 12 13 options: Object (optional) 14 Function options. 15 16 options.f: number (optional) 17 Positive number specifying the smoothing span, i.e., the proportion of 18 points which influence smoothing at each value. Larger values 19 correspond to more smoothing. Default: `2/3`. 20 21 options.nsteps: number (optional) 22 Number of iterations in the robust fit (fewer iterations translates to 23 faster function execution). If set to zero, the nonrobust fit is 24 returned. Default: `3`. 25 26 options.delta: number (optional) 27 Nonnegative number which may be used to reduce the number of 28 computations. Default: 1/100th of the range of `x`. 29 30 options.sorted: boolean (optional) 31 Boolean indicating if the input array `x` is sorted. Default: `false`. 32 33 Returns 34 ------- 35 out: Object 36 Object with ordered x-values and fitted values. 37 38 Examples 39 -------- 40 > var x = new {{alias:@stdlib/array/float64}}( 100 ); 41 > var y = new {{alias:@stdlib/array/float64}}( x.length ); 42 > for ( var i = 0; i < x.length; i++ ) { 43 ... x[ i ] = i; 44 ... y[ i ] = ( 0.5*i ) + ( 10.0*{{alias:@stdlib/random/base/randn}}() ); 45 ... } 46 > var out = {{alias}}( x, y ); 47 > var yhat = out.y; 48 49 > var h = {{alias:@stdlib/plot/ctor}}( [ x, x ], [ y, yhat ] ); 50 > h.lineStyle = [ 'none', '-' ]; 51 > h.symbols = [ 'closed-circle', 'none' ]; 52 53 > h.view( 'window' ); 54 55 See Also 56 -------- 57