This function fits a CES model with 2 or 3 factors of production.
In principle, the CES model can handle up to 4 factors of production,
but this is not supported by cesModel()
at this time.
cesModel(formula, data, response, x1 = NULL, x2 = NULL, x3 = NULL, x4 = NULL, time = NULL, nest = 1:3, prevModel = NULL, algorithms = c("PORT", "L-BFGS-B"), multErr = TRUE, rho = c(9, 2, 1, 0.43, 0.25, 0.1, -0.1, -0.5, -0.75, -0.9, -0.99), rho1 = c(9, 2, 1, 0.43, 0.25, 0.1, -0.1, -0.5, -0.75, -0.9, -0.99), digits = 6, save.data = TRUE, constrained = TRUE, fitBoundaries = TRUE, ...)
formula | a formula of the form |
---|---|
data | a data frame, in which to evaluate the formula. |
response | instead of specifying a formula, expressions for the components can be specified individually. |
x1 | instead of specifying a formula, expressions for the components can be specified individually as character strings. |
x2 | instead of specifying a formula, expressions for the components can be specified individually as character strings. |
x3 | instead of specifying a formula, expressions for the components can be specified individually as character strings. |
x4 | instead of specifying a formula, expressions for the components can be specified individually as character strings. Currently only 2 or 3 factors of production are supported. This is a placeholder for potential expansion of the package. |
time | instead of specifying a formula, expressions for the components can be specified individually as character strings. |
nest | a permutation (a,b,c,d) of the integers 1 through 4. For models with 3 factors, the nesting is (xa + xb) + xc. For 4 factors, the nesting is (xa + xb) + (xc + xd) |
prevModel | a model used to start a gradient search.
|
multErr | logical, tells whether errors are to be assessed in a multiplicative manner |
rho, rho1 | creates a grid upon which gradient searches in all other (free) parameters will be made.
(I.e., when |
digits | the number of sse digits that is to be considered significant when comparing one fit against another. |
save.data | a logical indicating whether data is to be saved with the model.
Be sure to set |
constrained | a logical indicating whether the parameters should be constrained in the fitting process.
Default is |
fitBoundaries | a logical indicating whether fits should be performed along boundaries.
Default is |
a cesEst model with additional information attached as attributes.
For now the components in f
(or the arguments response
,
x1
, x2
, x3
, x4
, and time
) must correspond to variables in data
and may
not be other kinds of expressions.
For now, this function works for only 2 or 3 factors of production.
Setting the value of x4
or using f
of the form y ~ a + b + c + d + time
will not work.
if (require("EconData") & require("dplyr")) { cesModel(iGDP ~ iK + iL + iQp + iYear, data = filter(Calvin, Country=="US"), nest = c(1,2,3)) cesModel(iGDP ~ iK + iL + iQp + iYear, data = filter(Calvin, Country=="US"), nest = c(2,3,1)) cesModel(iGDP ~ iK + iL + iQp + iYear, data = filter(Calvin, Country=="US"), nest = c(3,1,2)) cesModel(iGDP ~ iK + iL + iQp + iYear, data = filter(Calvin, Country=="ZM"), nest = c(3,1,2)) cesModel(response="iGDP", x1="iK", x2="iL", x3="iQp", time="iYear", data = filter(Calvin, Country=="ZM"), nest = c(3,1,2)) }#>#> Warning: there is no package called ‘EconData’