[R] Forcing a negative slope in linear regression?
John C Frain
frainj at gmail.com
Wed Jun 1 13:09:58 CEST 2011
In econometrics economic theory often predicts a particular sign for a
slope variable. One often gets wrong signs on variables but the
coefficients as estimated, in such cases are usually both
statistically and economically insignificant. In such cases one
generally re-estimates the equation with the variable omitted
(imposing a zero sign. Perhaps re-estimating with the variable
missing is the simplest solution. Of course, I agree that if the
variable is significant and of the wrong sign there is something wrong
with the theory or the data.
John
On 1 June 2011 03:40, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
>
> (1) You can easily force the slope to take on a *particular* value,
> positive or negative, by using offset(). However just to constrain
> the value of the slope to be less than or equal to 0 you'd have to
> do a constrained optimization of the sum of squares. Not hard to
> do, but probably (almost surely) unwise. If the data are telling you
> that the slope is positive, don't argue with them.
>
> Also if you constrain slope <= 0 and the data want the slope
> to be greater than 0, then the constrained optimum will probably
> be at slope == 0.
>
> If you want it to be *less* than 0, you'd have to constrain it with
> slope <= - epsilon for some (positive) epsilon. And then I'd guess
> you'd wind up with a slope of -epsilon. So you might as well fix
> the slope at -epsilon and use offset().
>
> But the whole idea makes no sense. So: The executive
> summary is ``Don't do it.''
>
> (2) Your example data don't make any sense either. You
> present the values of only one variable. For a regression you
> need to have a y-variable and at least one x-variable. It would
> appear that you're not thinking very clearly.
>
> cheers,
>
> Rolf Turner
>
> On 01/06/11 11:32, J S wrote:
>>
>> Dear forum members,
>>
>>
>>
>> How can I force a negative slope in a linear regression even though the
>> slope might be positive?
>>
>>
>>
>> I will need it for the purpose of determining the trend due reasons other
>> than biological because the biological (genetic) trend is not positive for
>> these data.
>>
>>
>>
>> Thanks. Julia
>>
>>
>>
>>
>> Example of the data:
>>
>>
>>
>> [1] 1.254 1.235 1.261 0.952 1.202 1.152 0.801 0.424 0.330 0.251 0.229
>> 0.246
>>
>> [13] 0.414 0.494 0.578 0.628 0.514 0.594 0.827 0.812 0.629 0.928 0.707
>> 0.976
>>
>> [25] 1.099 1.039 1.272 1.398 1.926 1.987 2.132 1.644 2.174 2.453 2.392
>> 3.002
>>
>> [37] 3.352 2.410 2.206 2.692 2.653 1.604 2.536 3.070 3.137 4.187 4.803
>> 4.575
>>
>> [49] 4.580 3.779 4.201 5.685 4.915 5.929 5.474 6.140 5.182 5.524 5.848
>> 5.830
>>
>> [61] 5.800 7.517 6.422
>>
>> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
--
John C Frain
Economics Department
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:frainj at tcd.ie
mailto:frainj at gmail.com
More information about the R-help
mailing list