Re: [R] Coefficient of Determination for nonlinear function

2011-03-05 Thread Uwe Wolfram
Dear Bert, dear Andy,

thanks for your answers! I am quite aware that I do not fit a linear
model, so r^2 in Pearson's sens is indeed meaningless. Instead, I am
fitting an equation - or rather using an optimisation - were the
experimentally derived point cloud (x1, x2, x3) should deliver something
like 1 = f(x1, x2, x3). What I am trying to estimate is the quality of
the fit. One thing I computed so far is the standard error of the
equation (SEE) which is fine. My former question pointed in the
direction of how I could compute a coefficient of determination to
estimate a goodness of fit. Calling it r^2 may mislead but there must be
something similar in nonlinear regressions.

Thanks for your efforts,

Uwe


Am Freitag, den 04.03.2011, 11:44 -0500 schrieb Liaw, Andy:
 As far as I can tell, Uwe is not even fitting a model, but instead just
 solving a nonlinear equation, so I don't know why he wants a R^2.  I
 don't see a statistical model here, so I don't know why one would want a
 statistical measure.
 
 Andy 
 
  -Original Message-
  From: r-help-boun...@r-project.org 
  [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter
  Sent: Friday, March 04, 2011 11:21 AM
  To: uwe.wolf...@uni-ulm.de; r-help@r-project.org
  Subject: Re: [R] Coefficient of Determination for nonlinear function
  
  The coefficient of determination, R^2, is a measure of how well your
  model fits versus a NULL model, which is that the data are constant.
  In nonlinear models, as opposed to linear models, such a null model
  rarely makes sense. Therefore the coefficient of determination is
  generally not meaningful in nonlinear modeling.
  
  Yet another way in which linear and nonlinear models 
  fundamentally differ.
  
  -- Bert
  
  On Fri, Mar 4, 2011 at 5:40 AM, Uwe Wolfram 
  uwe.wolf...@uni-ulm.de wrote:
   Dear Subscribers,
  
   I did fit an equation of the form 1 = f(x1,x2,x3) using a 
  minimization
   scheme. Now I want to compute the coefficient of 
  determination. Normally
   I would compute it as
  
   r_square = 1- sserr/sstot with sserr = sum_i (y_i - f_i) and sstot =
   sum_i (y_i - mean(y))
  
   sserr is clear to me but how can I compute sstot when there 
  is no such
   thing than differing y_i. These are all one. Thus 
  mean(y)=1. Therefore,
   sstot is 0.
  
   Thank you very much for your efforts,
  
   Uwe
   --
   Uwe Wolfram
   Dipl.-Ing. (Ph.D Student)
   __
   Institute of Orthopaedic Research and Biomechanics
   Director and Chair: Prof. Dr. Anita Ignatius
   Center of Musculoskeletal Research Ulm
   University Hospital Ulm
   Helmholtzstr. 14
   89081 Ulm, Germany
   Phone: +49 731 500-55301
   Fax: +49 731 500-55302
   http://www.biomechanics.de
  
   __
   R-help@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.
  
  
  
  
  -- 
  Bert Gunter
  Genentech Nonclinical Biostatistics
  467-7374
  http://devo.gene.com/groups/devo/depts/ncb/home.shtml
  
  __
  R-help@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.
  
 Notice:  This e-mail message, together with any attach...{{dropped:26}}

__
R-help@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.


[R] Coefficient of Determination for nonlinear function

2011-03-04 Thread Uwe Wolfram
Dear Subscribers,

I did fit an equation of the form 1 = f(x1,x2,x3) using a minimization
scheme. Now I want to compute the coefficient of determination. Normally
I would compute it as

r_square = 1- sserr/sstot with sserr = sum_i (y_i - f_i) and sstot =
sum_i (y_i - mean(y))

sserr is clear to me but how can I compute sstot when there is no such
thing than differing y_i. These are all one. Thus mean(y)=1. Therefore,
sstot is 0. 

Thank you very much for your efforts,

Uwe

-- 
Uwe Wolfram
Dipl.-Ing. (Ph.D Student)
__
Institute of Orthopaedic Research and Biomechanics
Director and Chair: Prof. Dr. Anita Ignatius
Center of Musculoskeletal Research Ulm
University Hospital Ulm
Helmholtzstr. 14
89081 Ulm, Germany
Phone: +49 731 500-55301
Fax: +49 731 500-55302
http://www.biomechanics.de

__
R-help@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.


[R] Coefficient of Determination for nonlinear function

2011-03-04 Thread Uwe Wolfram
Dear Subscribers,

I did fit an equation of the form 1 = f(x1,x2,x3) using a minimization
scheme. Now I want to compute the coefficient of determination. Normally
I would compute it as

r_square = 1- sserr/sstot with sserr = sum_i (y_i - f_i) and sstot =
sum_i (y_i - mean(y))

sserr is clear to me but how can I compute sstot when there is no such
thing than differing y_i. These are all one. Thus mean(y)=1. Therefore,
sstot is 0. 

Thank you very much for your efforts,

Uwe
-- 
Uwe Wolfram
Dipl.-Ing. (Ph.D Student)
__
Institute of Orthopaedic Research and Biomechanics
Director and Chair: Prof. Dr. Anita Ignatius
Center of Musculoskeletal Research Ulm
University Hospital Ulm
Helmholtzstr. 14
89081 Ulm, Germany
Phone: +49 731 500-55301
Fax: +49 731 500-55302
http://www.biomechanics.de

__
R-help@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.


Re: [R] How to plot Ellipsoid like function

2010-12-14 Thread Uwe Wolfram
Dear R-Users,

I am trying to plot an ellipsoid like function that represents some
physical threshold in its eigenvalue space. I am facing a few problems
generating a figure I need for my thesis. A small example looks as
follwos where the two contour3d plots do NOT overlay as desired so you
may try plotting the surfaces one by one to see what I mean.


# begin example

require(rgl)
require(misc3d)
require(MASS);

f - function(x, y, z){
chi0=-0.6603368
eps0=0.006590395
xi0=0.01117194
(x^2 + y^2 + z^2 - chi0*(x*y + x*z + y*z))/eps0^2 + (x + y + z)/xi0
}
ff - function(x, y, z)x + y + z

open3d()
clear3d(all)
bg3d(color=#88)
light3d()

x - seq(-.02,.02,len=20)

# plot ellipsoid
contour3d(f,1,x,x,x,color=#FF,alpha=0.5)

# plot plane
contour3d(ff,1,x,x,x,color=#FF,alpha=0.5)

# plot data points
spheres3d(c(-0.009379952, 0.007899338), c(-0.00879318, 0.00700924),
c(-0.009009740, 0.007656409),radius=0.0005,color=#FF)

# plot hydrostatic pressure line 
lines3d(c(-0.012, 0.012), c(-0.012, 0.012), c(-0.012, 0.012),
col=#A8A8A8, lwd=4)

# end example


I have three questions regarding this problem and I hope you could help
me.

 1. How can I overlay the plan plotted using contours3d(ff, ...) and
the ellipsoid plotted with contours3d(f, ...)
 2. Instead of using spheres3d(...) I would love to use plot3d to
obtain proper x, y and z coordinate axes. Is there a possibility
to overly the contour3d() and line3d() commands with pot3d?
Otherwise is there a possibility to plot proper coordinate axes
with tics and such as usual R plots?
 3. How can I save the scene to an image? pdf(...) ... dev.off()
seems not to work on my machine. I am using Ubuntu on a 32 Bit
Laptop.

Thanks a  million for your help!

Uwe


Am Montag, den 13.12.2010, 10:20 -0500 schrieb Duncan Murdoch:
 On 13/12/2010 10:13 AM, Uwe Wolfram wrote:
  
 
  I am currently trying to fit a tensorial function in its principal
  coorinate system. The function is given by:
 
  1~(x1^2 + x2^2 + x3^2 - chi0*(x1*x2 + x1*x3 + x2*x3))/eps0^2 + (x1 + x2
  + x3)/xi0
 
  Where eps0 = 0.0066, chi0 = -0.66 and xi0 = 0.011 are obtained from
  experimental data using nls().I am able to plot the experimental points
  that delivered the parameters of the function. For my thesis, however, I
  need to overlay the fitted surface. So far I am using the following code
  which wonderfully plots the experimental points in 3D:
 
  ===
  # from demo(bivar)
  require(rgl)
  require(misc3d)
  require(MASS);
 
  # New window
  open3d()
  # clear scene:
  clear3d(all)
  # setup env. That is, background, light and so on:
  bg3d(color=#88)
  light3d()
  # spheres at points in principal strain space
  #spheres3d(e1,e2,e3,radius=0.00025,color=#FF)
  # draws points alternatively
  plot3d(e1,e2,e3, col=#FF)
  ===
 
  According to the examples on http://rgl.neoscientists.org/gallery.shtml
  I tried to overlay the point plot using surface3d. However, these were
  only functions of type y ~f(x1, x2). I think that the surface could be
  plotted if I could provide the gridpoints correctly. Using
  xyz.coords(1~(x1^2 + x2^2 + x3^2 - chi0*(x1*x2 + x1*x3 + x2*x3))/eps0^2
  + (x1 + x2 + x3)/xi0, y = NULL, z = NULL) did unfortunately not solve
  the problem.
 
  Is there any function that can generate the surface for the given
  function such as ContourPlot3D in Mathematica.
 
 See ?misc3d::contour3d


__
R-help@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.


[R] How to plot Ellipsoid like function

2010-12-13 Thread Uwe Wolfram
Dear R-Users,

I am currently trying to fit a tensorial function in its principal
coorinate system. The function is given by:

1~(x1^2 + x2^2 + x3^2 - chi0*(x1*x2 + x1*x3 + x2*x3))/eps0^2 + (x1 + x2
+ x3)/xi0

Where eps0 = 0.0066, chi0 = -0.66 and xi0 = 0.011 are obtained from
experimental data using nls().I am able to plot the experimental points
that delivered the parameters of the function. For my thesis, however, I
need to overlay the fitted surface. So far I am using the following code
which wonderfully plots the experimental points in 3D:

===
# from demo(bivar)
require(rgl)
require(misc3d)
require(MASS);

# New window
open3d()
# clear scene:
clear3d(all)
# setup env. That is, background, light and so on:
bg3d(color=#88)
light3d()
# spheres at points in principal strain space
#spheres3d(e1,e2,e3,radius=0.00025,color=#FF)
# draws points alternatively
plot3d(e1,e2,e3, col=#FF)
===

According to the examples on http://rgl.neoscientists.org/gallery.shtml
I tried to overlay the point plot using surface3d. However, these were
only functions of type y ~f(x1, x2). I think that the surface could be
plotted if I could provide the gridpoints correctly. Using
xyz.coords(1~(x1^2 + x2^2 + x3^2 - chi0*(x1*x2 + x1*x3 + x2*x3))/eps0^2
+ (x1 + x2 + x3)/xi0, y = NULL, z = NULL) did unfortunately not solve
the problem.

Is there any function that can generate the surface for the given
function such as ContourPlot3D in Mathematica.

Thanks a million!

Uwe
-- 
Uwe Wolfram
Dipl.-Ing. (Ph.D Student)
__
Institute of Orthopaedic Research and Biomechanics
Director and Chair: Prof. Dr. Anita Ignatius
Center of Musculoskeletal Research Ulm
University Hospital Ulm
Helmholtzstr. 14
89081 Ulm, Germany
Phone: +49 731 500-55301
Fax: +49 731 500-55302
http://www.biomechanics.de

__
R-help@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.


[R] Plotting 3d surfaces

2010-12-09 Thread Uwe Wolfram
Dear Subscribers,

I am using R for quite a while nowadays on Ubuntu 10.04 LTS. I a using R
for doing my statistics. Furthermore I am using it as a tool to generate
the graphics for my publications.

I am currently working on a project which involves nls-fits of three
dimensional surfaces such as ellipsoids or even more complex. I have
been searching R help and the manuals for a possibility to plot these
surfaces. Is there any package in R that allows plotting something like
this:

http://uwwo.in-chemnitz.de/R-Problem/tsai-wu-principal-strain.pdf

This plot was generated using Mathematicas ContourPlot3D function. I
would love to be able to plot this in R. However, I could not find
something which could this. 

Thanks a million for the help!

Uwe
-- 
Uwe Wolfram
Dipl.-Ing. (Ph.D Student)
__
Institute of Orthopaedic Research and Biomechanics
Director and Chair: Prof. Dr. Anita Ignatius
Center of Musculoskeletal Research Ulm
University Hospital Ulm
Helmholtzstr. 14
89081 Ulm, Germany
Phone: +49 731 500-55301
Fax: +49 731 500-55302
http://www.biomechanics.de

__
R-help@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.