Re: [R] Multiple linear regression with constraint (imposition)

2009-10-31 Thread CE.KA

Thank you David


David Winsemius wrote:
> 
> 
> On Oct 30, 2009, at 7:47 PM, CE.KA wrote:
> 
>>
>> Sorry there was a mistake:
> 
> I could not see what was different?
> 
>>
>> Hi R users
>>
>> I want to do a multiple linear regression with R
>>
>> With a normal model (Y=Cste+A1*X1+A2*X2) the program would be
>> lm(Y~X1+X2)
>>
>> My model is Y=Cste+A1*X1+A2*X2 with the constraint A1=-A2
>> What is the program for such a model?
>>
> 
> Try calculating X3= X2-X1 and estimate the shared parameter with:
> 
> lm(y ~ X3)
> 
> or instead;
> 
> lm(Y ~ I(X2 - X1) )
> 
> -- 
> 
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
> 
> __
> 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.
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Multiple-linear-regression-with-constraint-%28imposition%29-tp26138081p26141453.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Multiple linear regression with constraint (imposition)

2009-10-31 Thread CE.KA

Thank you Ravi


Ravi Varadhan wrote:
> 
> 
> Simply do this:
> 
> lm(y ~ I(X1 - X2))
> 
> 
> Ravi.
> 
> 
> Ravi Varadhan, Ph.D.
> Assistant Professor,
> Division of Geriatric Medicine and Gerontology
> School of Medicine
> Johns Hopkins University
> 
> Ph. (410) 502-2619
> email: rvarad...@jhmi.edu
> 
> 
> - Original Message -
> From: "CE.KA" 
> Date: Friday, October 30, 2009 7:48 pm
> Subject: Re: [R] Multiple linear regression with constraint (imposition)
> To: r-help@r-project.org
> 
> 
>> Sorry there was a mistake:
>> 
>> Hi R users
>> 
>> I want to do a multiple linear regression with R
>> 
>> With a normal model (Y=Cste+A1*X1+A2*X2) the program would be
>> lm(Y~X1+X2)
>> 
>> My model is Y=Cste+A1*X1+A2*X2 with the constraint A1=-A2
>> What is the program for such a model?
>> 
>> Best regards
>> 
>> 
>> -- 
>> View this message in context: 
>> Sent from the R help mailing list archive at Nabble.com.
>> 
>> __
>> R-help@r-project.org mailing list
>> 
>> PLEASE do read the posting guide 
>> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> 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.
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Multiple-linear-regression-with-constraint-%28imposition%29-tp26138081p26141448.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Multiple linear regression with constraint (imposition)

2009-10-30 Thread Ravi Varadhan

Simply do this:

lm(y ~ I(X1 - X2))


Ravi.


Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvarad...@jhmi.edu


- Original Message -
From: "CE.KA" 
Date: Friday, October 30, 2009 7:48 pm
Subject: Re: [R] Multiple linear regression with constraint (imposition)
To: r-help@r-project.org


> Sorry there was a mistake:
> 
> Hi R users
> 
> I want to do a multiple linear regression with R
> 
> With a normal model (Y=Cste+A1*X1+A2*X2) the program would be
> lm(Y~X1+X2)
> 
> My model is Y=Cste+A1*X1+A2*X2 with the constraint A1=-A2
> What is the program for such a model?
> 
> Best regards
> 
> 
> -- 
> View this message in context: 
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> 
> PLEASE do read the posting guide 
> and provide commented, minimal, self-contained, reproducible code.

__
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] Multiple linear regression with constraint (imposition)

2009-10-30 Thread David Winsemius


On Oct 30, 2009, at 7:47 PM, CE.KA wrote:



Sorry there was a mistake:


I could not see what was different?



Hi R users

I want to do a multiple linear regression with R

With a normal model (Y=Cste+A1*X1+A2*X2) the program would be
lm(Y~X1+X2)

My model is Y=Cste+A1*X1+A2*X2 with the constraint A1=-A2
What is the program for such a model?



Try calculating X3= X2-X1 and estimate the shared parameter with:

lm(y ~ X3)

or instead;

lm(Y ~ I(X2 - X1) )

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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] Multiple linear regression with constraint (imposition)

2009-10-30 Thread CE.KA

Sorry there was a mistake:

Hi R users

I want to do a multiple linear regression with R

With a normal model (Y=Cste+A1*X1+A2*X2) the program would be
lm(Y~X1+X2)

My model is Y=Cste+A1*X1+A2*X2 with the constraint A1=-A2
What is the program for such a model?

Best regards


-- 
View this message in context: 
http://old.nabble.com/Multiple-linear-regression-with-constraint-%28imposition%29-tp26138081p26138446.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Multiple linear regression with constraint (imposition)

2009-10-30 Thread CE.KA


Hi R users

I want to do a multiple linear regression with R

With a normal model (Y=Cste+A1*X1+A2*X2) the program would be
lm(Y ~X2+X2)

My model is Y=Cste+A1*X1+A2*X2 with the constraint A1=-A2
What is the program for such a model?

Best regards

-- 
View this message in context: 
http://old.nabble.com/Multiple-linear-regression-with-constraint-%28imposition%29-tp26138081p26138081.html
Sent from the R help mailing list archive at Nabble.com.

__
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.