[R] comparing two "half-normal production" stochastic frontier functions
Rainer M Krug
Rainer at krugs.de
Fri Oct 3 14:51:36 CEST 2014
Hi
I am using the function frontier::sfa (from the package frontier) to
estimate several "half-normal production" stochastic frontier functions.
Now I want to compare the coefficients of the linear frontier function
and see if they are different.
According to my stackexchange (CrossValidated) question [1] I can
compare these as I can compare a normal linear regression.
In R, I would uswe the function anova to do this model comparison -
correct?
Now this function does not accept objects of the type 'frontier' - so
how can I do this comparison in R?
To re-iterate, I want to know if the coefficients of the frontier line
(slope and intercept) are significantly different.
Below please find a reproducible example based on data provided in the
package, of what I did, and below the transcript.
Thanks,
Rainer
--8<---------------cut here---------------start------------->8---
library(frontier)
data(front41Data)
dat1 <- front41Data[1:30,]
dat2 <- front41Data[30:60,]
x1 <- sfa(log(output) ~ log(capital), data=dat1)
x2 <- sfa(log(output) ~ log(capital), data=dat2)
x1
x2
anova(x1, x2
--8<---------------cut here---------------end--------------->8---
,----
| > library(frontier)
| > data(front41Data)
| > dat1 <- front41Data[1:30,]
| > dat2 <- front41Data[30:60,]
| > x1 <- sfa(log(output) ~ log(capital), data=dat1)
| > x2 <- sfa(log(output) ~ log(capital), data=dat2)
| Warning message:
| In sfa(log(output) ~ log(capital), data = dat2) : the parameter
| 'gamma' is close to the boundary of the parameter space [0,1]: this
| can cause convergence problems and can negatively affect the validity
| and reliability of statistical tests and might be caused by model
| misspecification
| > x1
|
| Call:
| sfa(formula = log(output) ~ log(capital), data = dat1)
|
| Maximum likelihood estimates
| (Intercept) log(capital) sigmaSq gamma
| 2.8646 0.2642 0.4364 0.8243
| > x2
|
| Call:
| sfa(formula = log(output) ~ log(capital), data = dat2)
|
| Maximum likelihood estimates
| (Intercept) log(capital) sigmaSq gamma
| 2.7035 0.4550 0.9736 0.9972
| >
| > anova(x1, x2)
| Error in UseMethod("anova") :
| no applicable method for 'anova' applied to an object of class "frontier"
`----
Footnotes:
[1] http://stats.stackexchange.com/questions/117319/comparing-coefficients-of-linear-stochastic-frontier-production-and-cost-funct
--
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20141003/f9e25f8c/attachment.bin>
More information about the R-help
mailing list