[R] least summed square distance + fit

Bill.Venables@cmis.csiro.au Bill.Venables at cmis.csiro.au
Tue May 14 13:37:01 CEST 2002


This sounds like procrustes transformations.

There is a function procrustes() in the vegan package to do it.

library(vegan)
?procrustes

[Irrelevant side issue: Procrustes was a Greek pirate who used to torture
his victims by tying them to an iron bed and neatly lopping off any parts of
their body that protruded.  Not a bad analogy!]

Bill Venables.

-----Original Message-----
From: Jonathan Baron [mailto:baron at cattell.psych.upenn.edu]
Sent: Tuesday, May 14, 2002 9:07 PM
To: Jan Malte Wiener
Cc: R
Subject: Re: [R] least summed square distance + fit


Take a look at optim() in the base package.  I've used it for
things like this, and it works beautifully.  Perhaps there is
something more specific, but I don't know it.  Jon

On 05/14/02 12:32, Jan Malte Wiener wrote:
>hi,
>I have a matrix (representing original data) that looks e.g. like this 
>(consider it beeing x,y,z coords):
>441     447	0
>265     407	0
>374     223	0
>288     574	0
>669     309	0
>591     195	0
>595     475	0
>424     351	0
>
>I get a second matrix (subject data) that is similiar to the above 
>matrix but it is scaled, translated and rotated (and of course a little 
>inprecise).
>Also I have an errorfunction that sums up  the squared distances of 
>corresponding points of orig matrix and subject matrix.
>
>And here comes my problem:
>I now need an fitting function that scales, rotates and translates my 
>subject matrix so that the error (computed by the errorfunction) is 
>minimized.
>Since I am new to R and actually new to that problem, I would be glad if 
>someone could tell me if there is a precompiled fitting procedure that 
>fits my requirements.
>
>greetinx jan
>
>
>
>-- 
>Jan Malte Wiener
>Max-Planck-Institute for Biological Cybernetics
>Spemannstr. 38, 72076 Tuebingen, Germany
>Tel.: +49 7071 601 631
>Email: jan.wiener at tuebingen.mpg.de
>
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
.-.-
>r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
>Send "info", "help", or "[un]subscribe"
>(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
_._

-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list