npoly(x, ...)# S3 method for default
npoly(x, degree, ...)
# S3 method for Opn
npoly(x, degree, baseline1 = c(-0.5, 0), baseline2 = c(0.5,
0), nb.pts = 120, ...)
coeff
the coefficients (includint the intercept)
ortho
whether orthogonal or natural polynomials were fitted
degree
degree of the fit (could be retrieved through coeff
though)
baseline1
the first baseline point (so far the first point)
baseline2
the second baseline point (so far the last point)
r2
the r2 from the fit
mod
the raw lm model
opoly_i
,
opoly
data(olea)
o <- olea[1]
op <- opoly(o, degree=4)
op
# shape reconstruction
opi <- opoly_i(op)
lines(opi, col='red')
# R2 for degree 1 to 10
r <- numeric()
for (i in 1:10) { r[i] <- npoly(o, degree=i)$r2 }
plot(2:10, r[2:10], type='b', pch=20, col='red', main='R2 / degree')
Run the code above in your browser using DataLab