[R] Surface plot for polynomial regression

From: Johannes Ullrich <ullrichj_at_staff.uni-marburg.de>
Date: Fri 01 Apr 2005 - 01:50:16 EST


Dear R-experts,

my goal is to visualize the following polynomial regression as a 3D-surface:

Z = b0 + b1*X + b2*Y + b3*XY + b4*X^2 + b5*Y^2

I believe that a solution to this problem may be of interest to a wider range of scientists because the problem is a derivative of a more general problem, i.e.: how to describe the relationship between one dependent variable and the DIFFERENCE between two other variables. There are numerous problems associated with difference scores (e.g., reliability). One suggested alternative consists of using the components of the difference score separately in polynomial regression. So this is how I ended up with the above regression, which is essentially a reformulation of b1*(X-Y)^2.

After consulting the help pages and archives my best guess was that the function scatter3d could be rewritten in part to produce the desired output. In fact, the quadratic fit output of the scatter3d function comes closest to what I have in mind. However, I think the XY term is missing from the quadratic fit equation. When I use wireframe to visualize the raw data, there is a peak of the dependent variable when both X AND Y are high. Yet this peak does not appear in the quadratic fit of scatter3d.

Any pointers would be welcome. I should add that I am not a programmer and mainly work with high-level functions.

Thank you very much for R and for your help

Johannes

           Dipl.-Psych. Johannes Ullrich
            Philipps-Universitšt Marburg
                                 Germany

______________________________________________
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 Fri Apr 01 01:50:37 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:58 EST