Search code examples
rcrannon-linear-regressionsystemfitseemingly-unrelated-regression

Non Linear Seemingly Unrelated Regressions (SUR) in R imposing restrictions


I'm trying to estimate a non-linear Seemingly Unrelated Regressions (SUR) model with 5 equations in R, and I was working over the package systemfit. Everything goes well until it needs to set some restrictions on my equations. using the package systemfit, the function nlsystemfit() it works for non-linear equations. But the option/parameter restrict.matrix it's not allowed for nlsystemfit() (it works for linear equations in the function systemfit()).

A simplified example is (I think show the data is irrelevant here):

EQ_1 <- Y1 ~ (c1 - x)*Q + c11*G11 + c12*G12 + c13*G13
EQ_2 <- Y2 ~ (c2 - x)*Q + c21*G11 + c22*G12 + c23*G13
EQ_3 <- Y3 ~ (c3 - x)*Q + c31*G11 + c32*G12 + c33*G13


start.values <- c(c1 = 0,c2= 0,c3 = 0,
                  c11 = 0,c12 = 0,c13 = 0,
                  c21 = 0,c22 = 0,c23 = 0,
                  c31 = 0,c32 = 0,c33 = 0)

model <- list(EQ_1 ,EQ_2 ,EQ_3)

model.sur <- nlsystemfit(method = "SUR",
                         eqns = model,
                         startvals = start.values,
                         data = as.data.frame(dat))

The estimation works perfectly so far. But now, I need to set the following constraints:

Rest_1 <- c11 + c12 + c13 = 0
Rest_2 <- c21 + c22 + c23 = 0
Rest_3 <- c31 + c32 + c33 = 0

Rest_4 <- c1 + c2 + c3 = -1

Obviously, the model here is linear with 3 equations, but it's because I'm trying to simplify the idea. But the current model has 5 nonlinear equations and more parameters.

Anyone can guide me, please, about how to perform a Non-Linear SUR estimation with restrictions in R?

Thanks a lot in advance.


Solution

  • After several hours of research and bothering some people, I realized the answer to my question is quite obvious (for more experienced people, not me). So I answer my question to help others in the same position as me.

    It is not required to supply an option/parameter into systemfit package to set constraints separately. Why? Because the flexibility allowed in the equation definitions (because it is a non-linear system), we can impose the constrains in the same system. For example, if I need to set

    c1 + c2 + c3 = -1
    

    I will substitute c3 by - 1 - c1 - c2. This will lead us to compute, in general, one equation less in the whole system. Then, after getting the estimated coefficients, we only need to recover the values using the same formula; In my example (using estimated c1 and c2):

    c3 = - 1 - c1 - c2
    

    I hope this can help someone.