Hi all,

Using R, I'm running a linear regression for part of a function I'm writing to calculate survival rates from age distributions. My question for the purpose of this thread is following. Given the following sample data set:

...how can one constrain the least-squares regression to be anchored at a given point on the y axis (e.g. 170? What I am NOT looking for is a simple shift in the intercept. That is, a solution would give different beta coefficients for a regular regression and the regression model constrained to run through (0,170). In this example, only the intercept is constrained while slope can vary. I'm mentally fried right now, but I imagine there's a very simple solution to this using lme() in package "nlme."

Attached is an image illustrating the slopes of constrained and unconstrained slopes (please forgive spelling error in legend):

View attachment 1459

Any ideas about this, right off the tops of those heads of yours?

Using R, I'm running a linear regression for part of a function I'm writing to calculate survival rates from age distributions. My question for the purpose of this thread is following. Given the following sample data set:

Code:

```
set.seed(100)
fake.data <- data.frame(x=seq(1:20), y=rnorm(20, 10,2)*rev(seq(1:20)))
```

Attached is an image illustrating the slopes of constrained and unconstrained slopes (please forgive spelling error in legend):

View attachment 1459

Any ideas about this, right off the tops of those heads of yours?

Last edited: