[R] Surface generated as product of two curves

Bert Gunter gunter.berton at gene.com
Fri Aug 20 19:37:10 CEST 2010


Essentially, you just want to fit a "smooth" surface over your grid of
x,y values. Lots of ways to do this, but check out ?loess for a simple
base R approach. The mgcv package does tensor product splines. Also
search on "thin plate splines", "2d spatial" and the like for other
approaches. There are probably a dozen R packages that offer various
approaches.

As for the plotting, that will be tricky. The rgl package may be of
use here I believe, but I have never used it. I prefer contour plots
to perspective plots for a variety of reasons that I won't bother you
about here (not as pretty but much more informative imho).

--
Bert Gunter
Genentech Nonclinical Statistics

On Fri, Aug 20, 2010 at 8:23 AM, mauede at alice.it <mauede at alice.it> wrote:
>  I have the following data table:
>
>     [,1] [,2] [,3] [,4] [,5]
> [1,] 2575 1927 1754  581  354
> [2,] 1156  810  730  541  237
> [3,]  417  297  199  125  110
> [4,]  281  132  132   47   58
> [5,]  152   84   87   54   19
>
> Each column represents a time interval expressed in nano-seconds
> Each row represents an energy interval expressed m=n MeV
> Each table value represents the average gamma rays intensity measured during the time interval identified by the column and
> the energy range identified by the row.
> The Energy marginal has been fitted through a Gamma curve with parameters (alpha = 1.85342, beta = 348.18)
> The Time  marginal has been fitted through a Weibull curve with parameters (alpha = 0.334489, beta = 9.14066)
>
> The scaling factor = 1403.88.
>
> My goal is:
> 1. to generate and plot the 2D surface which is generated by the product of the two curves (like Bezier surfaces)
> 2. to generate a 3D stairsplot of the above table
> 3. *ideally* to draw the generated product surface *and* the 3D stairplot in the same plot
>
> I had a look at graphic functions (persp, plot3D, sctterplot3d) but I feel intimidated. I have to sample somehow the two curves
> to generate the product surface ... maybe using tensors ?
> Please, help.
> Thank you.
> Maura
>                Alice                           body {margin:0;padding:0;}                              #footer { height:13px; font-size:11px; font-family:Arial, FreeSans, sans-serif; color:#ADADAD; margin:0; padding:7px 12px; text-align:right; border-top:1px solid #dcdcdc; }            #footer a { text-decoration:none; color:#ADADAD; }              #footer a:hover { color:#848484; }                              Inviato dalla nuova Alice mail
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list