How should I define a model formula in "R", when one (or more) exact linear restrictions binding the coefficients is available.
Equation: y = b1*x1 + b2*x1
where y = b1*x1 for t < t1 and y = b2*x1 for t > t1
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.Sign up to join this community
Avoiding difficult formulas may be the simplest: just create two new vectors:
x2 <- ifelse(t<t1, x1, 0) x3 <- ifelse(t<t1, 0, x1)
Now you can simply fit
y ~ x2 + x3 -1 (I'm using R formula notation here).
Different solutions are possible (this comes down to a different dummy coding scheme). The best may depend on the correctness of the matching assumptions, and of course on your goals for the research.