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


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.


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));
", [Total Cost], rank(max([Months in Date]), "ASC", "1223"))
Version history
Last update:
‎03-02-2023 08:27 AM
Updated by:
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: