Title: | Estimation of Production Functions |
---|---|
Description: | Estimation of production functions by the Olley-Pakes, Levinsohn-Petrin and Wooldridge methodologies. The package aims to reproduce the results obtained with the Stata's user written opreg <http://www.stata-journal.com/article.html?article=st0145> and levpet <http://www.stata-journal.com/article.html?article=st0060> commands. The first was originally proposed by Olley, G.S. and Pakes, A. (1996) <doi:10.2307/2171831>. The second by Levinsohn, J. and Petrin, A. (2003) <doi:10.1111/1467-937X.00246>. And the third by Wooldridge (2009) <doi:10.1016/j.econlet.2009.04.026>. |
Authors: | Rodrigo R Remédio [aut, cre] |
Maintainer: | Rodrigo R Remédio <[email protected]> |
License: | GPL-3 |
Version: | 1.2 |
Built: | 2025-03-06 02:46:38 UTC |
Source: | https://github.com/cran/estprod |
From combinatorial math, this function aims calculates combinations with repetitions.
combination_with_repetition(n, r)
combination_with_repetition(n, r)
n |
The number of elements (variables). |
r |
The size of the groups (degreess of the polynomial interaction). |
10000 randomly generated variables in panel data format.
estprod_data
estprod_data
A data frame with 10000 rows and 10 variables:
Identifies the 1000 randomly generated individuals.
The year associated to each individual observation.
Put individuals in 25 groups.
Put individuals in 50 groups.
Randomly generated variable.
Randomly generated variable.
Randomly generated variable.
Randomly generated variable.
Randomly generated variable.
The last year an id appears.
This function aims the estimation of production functions using Levinsohn-Petrin (2000).
levinsohn_petrin( data, formula = y ~ free | capital | proxy | controls, exit = NULL, gross = FALSE, id = "id", time = "year", bootstrap = TRUE, reps = 2, degree = c(3, 3), verify = TRUE, maxiter = 100, ... )
levinsohn_petrin( data, formula = y ~ free | capital | proxy | controls, exit = NULL, gross = FALSE, id = "id", time = "year", bootstrap = TRUE, reps = 2, degree = c(3, 3), verify = TRUE, maxiter = 100, ... )
data |
A data.frame or tibble containing the variables of the model. |
formula |
An object of the class |
exit |
An optional formula with the name of the variabe indicator of firm's last period. ~exit, for example. |
gross |
If TRUE dependent variable is gross output. |
id |
A character with the name of the indicator variable. |
time |
A character with the name of the time variable. |
bootstrap |
An optional logical. If TRUE calculate bootstrap standard errors. |
reps |
The number of bootstrap replications. |
degree |
A vector with the number of polynomial interactions in each stage of the routine. |
verify |
Verify if inputs are sorted. |
maxiter |
Parameter of |
... |
Additional arguments. |
Multipart formula must be specified in the following order: y ~ free | capital | proxy | controls
. Additional controls are optional.
It is possible to use more than one variable, although the use of more than one capital may not be theoretically identified.
The function returns an object of the estprod or boot classes (if bootstrap
is TRUE).
data(estprod_data) levinsohn_petrin(data = estprod_data, var1 ~ var2 | var3 | var4, exit = ~exit, id = "id", time = "year", bootstrap = TRUE)
data(estprod_data) levinsohn_petrin(data = estprod_data, var1 ~ var2 | var3 | var4, exit = ~exit, id = "id", time = "year", bootstrap = TRUE)
This function aims the estimation of production functions using Olley-Pakes (1996).
olley_pakes( data, formula = y ~ free | capital | proxy | controls, exit = NULL, id = "id", time = "year", bootstrap = TRUE, reps = 2, degree = c(3, 2), verify = TRUE, maxiter = 100, ... )
olley_pakes( data, formula = y ~ free | capital | proxy | controls, exit = NULL, id = "id", time = "year", bootstrap = TRUE, reps = 2, degree = c(3, 2), verify = TRUE, maxiter = 100, ... )
data |
A data.frame or tibble containing the variables of the model. |
formula |
An object of the class |
exit |
An optional formula with the name of the variabe indicator of firm's last period. |
id |
A character with the name of the indicator variable. |
time |
A character with the name of the time variable. |
bootstrap |
An optional logical. If TRUE calculate bootstrap standard errors. |
reps |
The number of bootstrap replications. |
degree |
A vector with the number of the polynomial interactions in each stage of the routine. |
verify |
Verify if inputs are sorted. |
maxiter |
Parameter of |
... |
Additional arguments. |
Multipart formula must be specified in the following order: y ~ free | capital | proxy | controls
. Additional controls are optional.
It is possible to use more than one variable, although the use of more than one capital may not be theoretically identified.
The function returns an object of the estprod or boot classes (if bootstrap
is TRUE).
data(estprod_data) olley_pakes(data = estprod_data, var1 ~ var2 | var3 | var4, exit = ~exit, id = "id", time = "year", bootstrap = TRUE)
data(estprod_data) olley_pakes(data = estprod_data, var1 ~ var2 | var3 | var4, exit = ~exit, id = "id", time = "year", bootstrap = TRUE)
This function aims create the lags of a specified variable from panel data.
panel_lag(x, id, time, lag = 1, verify = TRUE)
panel_lag(x, id, time, lag = 1, verify = TRUE)
x |
A vector, data.frame, tibble or matrix. |
id |
A character with the name of the indicator variable. |
time |
A character with the name of the time variable. |
lag |
Number of lags. |
verify |
Check if panel is sorted by id and time variables. |
Based on Paul Schrimpf's lag function.
poly
elements.This function aims calculate the number of terms of a polynomial interactions.
poly_elements(n, d)
poly_elements(n, d)
n |
The number of variables. |
d |
Degreess of polynomial interaction. |
This function aims the estimation of Cobb-Douglas production functions using Wooldridge (2009) method.
wooldridge( data, formula = y ~ free | capital | proxy | controls, gross = FALSE, id = "id", time = "year", bootstrap = FALSE, reps = 2, degree = c(3, 2), verify = TRUE, ... )
wooldridge( data, formula = y ~ free | capital | proxy | controls, gross = FALSE, id = "id", time = "year", bootstrap = FALSE, reps = 2, degree = c(3, 2), verify = TRUE, ... )
data |
A data.frame or tibble containing the variables of the model. |
formula |
An object of the class |
gross |
If TRUE dependent variable is gross output. |
id |
A character with the name of the indicator variable. |
time |
A character with the name of the time variable. |
bootstrap |
An optional logical. If TRUE calculate bootstrap standard errors. |
reps |
The number of bootstrap replications. |
degree |
A vector with the number of the polynomial interactions in each stage of the routine. |
verify |
Verify if inputs are sorted. |
... |
Additional arguments. |
Multipart formula must be specified in the following order: y ~ free | capital | proxy | controls
. Additional controls are optional.
It is possible to use more than one variable, although the use of more than one capital may not be theoretically identified.
The function returns an object of the estprod or boot classes (if bootstrap
is TRUE).
data(estprod_data) wooldridge(data = estprod_data, var1 ~ var2 | var3 | var4, id = "id", time = "year", bootstrap = TRUE)
data(estprod_data) wooldridge(data = estprod_data, var1 ~ var2 | var3 | var4, id = "id", time = "year", bootstrap = TRUE)