index.js (1845B)
1 /** 2 * @license Apache-2.0 3 * 4 * Copyright (c) 2018 The Stdlib Authors. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 'use strict'; 20 21 /** 22 * Locally-weighted polynomial regression via the LOWESS algorithm. 23 * 24 * @module @stdlib/stats/lowess 25 * 26 * @example 27 * var lowess = require( '@stdlib/stats/lowess' ); 28 * 29 * var x = [ 30 * 4, 4, 7, 7, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 31 * 14, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 32 * 20, 20, 20, 20, 22, 23, 24, 24, 24, 24, 25 33 * ]; 34 * var y = [ 35 * 2, 10, 4, 22, 16, 10, 18, 26, 34, 17, 28, 14, 20, 24, 28, 26, 34, 34, 46, 36 * 26, 36, 60, 80, 20, 26, 54, 32, 40, 32, 40, 50, 42, 56, 76, 84, 36, 46, 68, 37 * 32, 48, 52, 56, 64, 66, 54, 70, 92, 93, 120, 85 38 * ]; 39 * 40 * var out = lowess( x, y ); 41 * /* returns 42 * { 43 * 'x': [ 44 * 4, 45 * 4, 46 * 7, 47 * 7, 48 * ..., 49 * 24, 50 * 24, 51 * 24, 52 * 25 53 * ], 54 * 'y': [ 55 * ~4.857, 56 * ~4.857, 57 * ~13.1037, 58 * ~13.1037, 59 * ..., 60 * ~79.102, 61 * ~79.102, 62 * ~79.102, 63 * ~84.825 64 * ] 65 * } 66 * *\/ 67 */ 68 69 // MODULES // 70 71 var lowess = require( './main.js' ); 72 73 74 // EXPORTS // 75 76 module.exports = lowess;