[R] 2D contour predictions
Michael Hopkins
michael.hopkins at hopkins-research.com
Fri Jul 15 19:42:56 CEST 2005
Hi All
I have been fitting regression models and would now like to produce some
contour & image plots from the predictors.
Is there an easy way to do this? My current (newbie) experience with R
would suggest there is but that it's not always easy to find it!
f3 <- lm( fc ~ poly( speed, 2 ) + poly( torque, 2 ) + poly( sonl, 2 ) +
poly( p_rail, 2 ) + poly( pil_sep, 2 ) + poly( maf, 2 ) + (speed + torque +
sonl + p_rail + pil_sep + maf)^2 )
hat <- predict( f3 )
contour( sonl, maf, hat )
Error in contour.default(sonl, maf, hat) :
increasing 'x' and 'y' values expected
image(sonl, maf, hat)
Error in image.default(sonl, maf, hat) : increasing 'x' and 'y' values
expected
I have tried naïve sorting but no luck with that.
I suspect I may need to produce a data grid of some kind but I'm not clear
how I would use R to specify such a 2D slice in the 6D design space.
TIA
Michael
P.S. Whilst I'm asking the list - is there an easier way of expressing a
full 2nd order model than the one I used above? I'm sure there is but
finding it etc etc...
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ _/ _/_/_/ Hopkins Research Ltd
_/ _/ _/ _/
_/_/_/_/ _/_/_/ http://www.hopkins-research.com/
_/ _/ _/ _/
_/ _/ _/ _/ 'touch the future'
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
More information about the R-help
mailing list