0

I need to do a stochastic frontier of a translogarithmic regression. So I used the translogEst function with the data (name "Data") beneath. At the bottom of the code you can see the sfa() I did.

X; BankName; Year; Labor; PhysicalCapital; Loans; Deposits; TotalCosts; TCPK; PLPK
1; "HSBC"  ; 2002; 0.123;            2.19;  1200;     3200;      10.9;   4.9; 0.00089   

estTranslog <- translogEst("TCPK", c("Loans","Deposits", "PLPK", "Loans", "Deposits"), data = Data, shifterNames = NULL, dataLogged = FALSE)

sfaData <- sfa( estTranslog$est
    , data = Data, ineffDecrease = TRUE, truncNorm = TRUE, timeEffect = FALSE, startVal = NULL
    , tol = 0.00001, maxit = 1000, muBound = 2, bignum = 1.0E+16, searchStep = 0.00001, searchTol = 0.001
    , searchScale = NA, gridSize = 0.1, gridDouble = TRUE, restartMax = 10, restartFactor = 0.999, printIter = 0)

  **Value of estTranslog$est**
  Call:
  lm(formula = as.formula(estFormula), data = estData)

  Coefficients:
  (Intercept)          a_1          a_2          a_3          a_4          a_5               b_1_1        b_1_2  
 2.683958     0.161657    -0.020009     0.499711           NA           NA      -0.024701     0.022882  
  b_1_3        b_1_4        b_1_5        b_2_2        b_2_3        b_2_4          b_2_5        b_3_3  
0.001178           NA           NA     0.064574    -0.019852           NA                        NA    -0.075377 

When I run the translogEst function, no problem occurs. But when I run the sfa() the following error appears:

Error in eval(expr, envir, enclos) : object 'y' not found.

This while estTranslog$est returns a lm function and the y variable of this regression can be found in the Data.

How can I fix this error?

Jozeff
  • 11
  • 1
  • Can you add what is the value of `estTranslog$est` ? – zx8754 Mar 17 '16 at 09:10
  • Welcome to Stack Overflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – zx8754 Mar 17 '16 at 09:11
  • estTranslog$est must be class of `formula`, not class of `lm`? – zx8754 Mar 17 '16 at 09:22
  • so should I apply the as.formula() function? – Jozeff Mar 17 '16 at 09:27
  • I am having a guess here, if you cannot provide dummy data and the code that reproduces the error, not much we can do. – zx8754 Mar 17 '16 at 09:29

0 Answers0