Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'd like to give a Javascript function an array and then extrapolate forwards by a number of periods -

eg

var numArray = [0,1,2,3,4,5]

var myFunction = function(array,period){}

So myFunction(numArray,7) would return '6' and myFunction(numArray,8) would return '7'

I think I can make this work for a linear least squares, but how would I make it work for a 2nd degree polynomial?

Thank you

MV
Posted

1 solution

This is example is in c#, but the code in the article should be fairly easy to translate.

An Algorithm for Weighted Linear Regression[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900