cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
widget_5d4399e9cec8dc2e6806b92e__1_.png
polynomial regression where x = day, y = cost
widget_5d4399e9cec8dc2e6806b92e__2_.png
polynomial regression degrees 2-4

Method

The polynomial regression can be generated by the RDOUBLE formula below.
The function in the example below is for a polynomial regression of the third degree.
If you require a function of a different degree, simply edit the 3 in the poly function to whichever degree you need.

Formulation

To keep this approach generalized, I did not convert the values to a time series (ts). Instead, I used the rank function to convert each x-axis element to a vector of 1-n by using the RANK function.
rdouble(FALSE, "
x <- args[[2]];
y <- args[[1]];
model <- lm(y ~ poly(x, 3));
predict(model);
", [Total Cost], rank(max([Months in Date]), "ASC", "1223"))
Version history
Last update:
‎03-02-2023 08:27 AM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: