# [R] multivariate multi regression

Bastiaan Bergman Bastiaan.Bergman at wdc.com
Tue Dec 14 03:21:36 CET 2010

```That doesn't work, one would get two different answers depending on the
order of execution.

The physics is: Overlay error on a Silicon wafer. One wafer has many flash
fields, each flash field has multiple locations where the overlay error is
measured (as: dX,dY offset). If one contemplates that the error is caused by
a rotation of the flash field then we can say (dX,dY)=(-Y,X)*RotAngle. If in
addition we have a scaling error: (dX,dY)=(X*XScale,Y*YScale) than the total
model is:
dX~X*XScale-Y*RotAngle
dY~Y*YScale+X*RotAngle

Now I want to find the values for XScale, YScale and RotAngle
Length(dX)==length(dY)==length(X)==length(Y)==number of measured sites on a
wafer

Hope this clarifies...

-----Original Message-----
From: David Winsemius [mailto:dwinsemius at comcast.net]
Sent: Monday, December 13, 2010 6:06 PM
To: Bastiaan Bergman
Cc: r-help at r-project.org
Subject: Re: [R] multivariate multi regression

On Dec 13, 2010, at 8:46 PM, Bastiaan Bergman wrote:

> Hello,
>
>
> I want to model my data with the following model:
>
>
> Y1=X1*coef1+X2*coef2
> Y2=X1*coef2+X2*coef3
>
>
> Note: coef2 appears in both lines
>
> Xi, Yi is input versus output data respectively
>
> How can I do this in R?
>
> I got this far:
>
> lm(Y1~X1+X2,mydata)
>
> now how do I add the second line of the model including the cross
> dependency?

The usual way would be to extract coef2 from the object returned from
the first invocation of lm(...)  and use it to calculate an offset
term in a second model. It would not have any variance calculated
since you are forcing it to be what was returned in the first model.
Now, what is it that you are really trying to do with this procedure?

--
David.

David Winsemius, MD
West Hartford, CT

```