DT
01 September 2016
PoliFit application will fit the best polynomial function of degree n:
\( f(x)= a_0 + a_1x + a_2x^2 + ... + a_nx^n \)
The results are presented in five different formats:
Get the App here
Note: This application was not optimized for mobile devices.
You can only fit a polynomial function with degree n by using at least (n + 2) data points.
For example, you will need to input at least three points to use a linear model, or five points for
a cubic model.
#install.packages("polynom")
library(polynom)
data <- as.data.frame(cbind(c(0,1,3,5,7),c(0,3,5,7,9)))
colnames(data)<-c("xval","yval")
#polynomial degree n=3
x <-poly(data$xval,3, raw = TRUE)
model <- lm(data$yval ~ x)
summary(model)
Call:
lm(formula = data$yval ~ x)
Residuals:
1 2 3 4 5
-0.16141 0.35309 -0.35309 0.21185 -0.05044
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.16141 0.54477 0.296 0.817
x1 2.99412 0.89522 3.345 0.185
x2 -0.55233 0.32172 -1.717 0.336
x3 0.04372 0.02985 1.464 0.381
Residual standard error: 0.5682 on 1 degrees of freedom
Multiple R-squared: 0.9934, Adjusted R-squared: 0.9735
F-statistic: 50.06 on 3 and 1 DF, p-value: 0.1034