search for: lsqfit

Displaying 1 result from an estimated 1 matches for "lsqfit".

Did you mean: lsfit
2007 Aug 15
1
Polynomial fitting
...n use function polyval like the following: y0 = polyval( polyfit( x, y, degree ), x0 ) y0 are the prediction values at points x0 using the given polynomial. In R, we know there is lm for 1-degree polynomial: lm( y ~ x ) == polyfit( x, y, 1 ) and for prediction I can just create a function like: lsqfit <- function( model, xx ) return( xx * coefficients(model)[2] + coefficients(model)[1] ); and then: y0 <- lsqfit(x0) (I've tried with predict.lm( model, newdata=x0 ) but obtain a bad result) For a degree greater than 1, say m, what can I use.?? I've tried with lm( y ~ poly(x, degr...