This function sets up names of parameters for a CES model fit in various formats. In particular, it handles nesting and returns nest strings.

cesParseFormula(f, nest)

Arguments

f

the CES fitting formula.

nest

the nesting for the factors of production.

Value

a list of information extracted from the f and nest, including numFactors (the number of factors of production), xNames (a list containing the variable names of the factors of production, a, b, c, and d), tName (the variable name for time), yName (the variable name for response), nestStr (a string representing the nest, in the form of k+l+e), nestStrParen (a string representing the nest, in the form of (k + l) + (e)), and cesNames (a list of variable names in the order they appear in f, response, xNames, tName).

Note

f is assumed to be in the form response ~ a + b + c + d + time where a, b, c, and d are factors of production, response is the response variable (typically economic output), and time is the time variable.

nest is assumed to be integers in the form of c(1,2,3,4). Nest indicates the left-to-right order of parameters in the CES function. If the length of nest is less than the number of factors in the formula, some factors will omited. If the length of nest is greater than the nubmer of factors in formula, it is truncated to match.