# Forcing a negative slope in linear regression?

5 messages
Open this post in threaded view
|
Report Content as Inappropriate

## Forcing a negative slope in linear regression?

 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]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Forcing a negative slope in linear regression?

 If you force the slope, it is no longer a regression, so no. It is best to add those other dependent variables to the regression and evaluate whether their presence causes the fit to improve and yield signs of coefficients that match what you expect. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<[hidden email]> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. J S <[hidden email]> 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]] _____________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.         [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Forcing a negative slope in linear regression?

Open this post in threaded view
|
Report Content as Inappropriate

## Re: Forcing a negative slope in linear regression?

 In reply to this post by J S-20 (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]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.