Parametric Klein & Vella estimation
Usage
klein_vella_parametric(
data,
y1_var = "Y1",
y2_var = "Y2",
x_vars = NULL,
variance_type = "exponential",
optimization_method = "BFGS",
verbose = TRUE
)
Arguments
- data
Data frame containing Y1, Y2, and X variables
- y1_var
Name of first endogenous variable (default: "Y1")
- y2_var
Name of second endogenous variable (default: "Y2")
- x_vars
Names of exogenous variables (default: auto-detect)
- variance_type
Type of variance function ("exponential", "power", "linear")
- optimization_method
Optimization method for nonlinear least squares
- verbose
Whether to print progress information
Details
Implements the parametric version of Klein & Vella (2010) using the control function approach with parametric variance specifications.
The model is: Y1 = X'beta1 + gamma1Y2 + rho(S1(X)/S2(X))*epsilon2 + eta1
where S1(X) and S2(X) are conditional standard deviations.
Examples
# Generate data
config <- create_klein_vella_config(
n = 1000,
beta1 = c(0.5, 1.5),
beta2 = c(1.0, -1.0),
gamma1 = -0.8,
rho = 0.6,
delta1 = c(0.1, 0.3),
delta2 = c(0.2, -0.2)
)
#> Klein & Vella configuration created:
#> Sample size: 1000
#> Number of X variables: 1
#> True gamma1: -0.800
#> Error correlation: 0.600
data <- generate_klein_vella_data(config)
# Estimate
results <- klein_vella_parametric(data)
#>
#> === Klein & Vella Parametric Estimation ===
#> Sample size: 1000
#> Number of X variables: 1
#> Variance type: exponential
#>
#> Optimizing...
#> Warning: Could not compute standard errors: Lapack routine dgesv: system is exactly singular: U[5,5] = 0
#>
#> Estimation complete.
#> gamma1 estimate: -0.2401 (SE: NA)
#> rho estimate: 0.0000 (SE: NA)
print(results)
#>
#> Klein & Vella Estimation Results
#> ================================
#> Sample size: 1000
#> Variance type: exponential
#> Convergence: Yes
#>
#> Parameter Estimates:
#> -------------------
#> beta1_0 -0.0062 (SE: NA)
#> beta1_1 2.0702 (SE: NA)
#> gamma1.Y2 -0.2401 (SE: NA)
#> rho 0.0000 (SE: NA)
#>
#> *** Endogenous parameter