[R] multivariate multi regression

Joe P King jp at joepking.com
Tue Dec 14 03:11:17 CET 2010

I am not even sure what model you are trying to run, you are talking about
regression slopes for x1 being coef1, and coef2 being the slope for x2,
where are you getting coef3 from, is it in your data?

Joe King
jp at joepking.com
"Never throughout history has a man who lived a life of ease left a name
worth remembering." --Theodore Roosevelt

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of David Winsemius
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 Winsemius, MD
West Hartford, CT

R-help at r-project.org mailing list
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