[R] least summed square distance + fit

Jonathan Baron baron at cattell.psych.upenn.edu
Tue May 14 13:07:20 CEST 2002

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:
>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 
>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 
>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

More information about the R-help mailing list