Formulation of a nearly linear model I try to fit a model of the following form
$$
 Y = (\beta X - Z)^+ + \epsilon,
$$
where $Y,Z \ge 0$ and $X,Y,Z \in \mathbb{R}$ and $(x)^+ = \max(x,0)$. 
Note that $Y,X$ and $Z$ come from a sample, especially $Z$ is not a constant.
I did this in R in the following way:

positivePart<- function(x){
  x[x<0]<-0
  return(x)
}
my.optim = nls(y~ positivePart(beta*x-z) , start = list(beta=5))

I am getting good results, this is not the problem.

My question: is there a name, a class for this kind of model? If so, which R function is the natural candidate to solve this problem, ie. to formulate the model in R? Thank you!
 A: This only addresses one small issue; it doesn't consist of a complete answer.
With a nonlinear least squares model, if we were to write $Y = f(X,Z)$, then unless the model actually passed through each point, our model is plainly nonsense. We don't mean what we write.
What we actually mean is something like $\operatorname{E}(Y) = f(X,Z)$, or (even better) $Y = f(X,Z) + \epsilon$. 
When we come to do things with our model, failing to say what we mean leads to problems, as we lose track of what we mean - for example, consider the difference between:
$Y = \exp(\alpha + \beta x + \epsilon$) and $Y = \exp(\alpha + \beta x) + \epsilon$.
Without being explicit about what our model is actually saying, those two models would look the same - yet they should be estimated quite differently, and they have very different prediction intervals, for example.
(Similar issues apply to other models than nls ones, of course.)
A: What I found in the meanwhile: this kind of problem is called a Tobit model:
http://en.wikipedia.org/wiki/Tobit_model
package AER in R can handel them.
http://cran.r-project.org/web/packages/AER/index.html
