[R] 2D contour predictions

From: Michael Hopkins <michael.hopkins_at_hopkins-research.com>
Date: Sat 16 Jul 2005 - 03:42:56 EST

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'
                   

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 16 03:46:54 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:45 EST