data <- data.frame(
ret_excess = rnorm(100),
mkt_excess = rnorm(100),
smb = rnorm(100),
hml = rnorm(100)
)
# Estimate model with a single independent variable
estimate_model(data, "ret_excess ~ mkt_excess")
# Estimate model with multiple independent variables
estimate_model(data, "ret_excess ~ mkt_excess + smb + hml")
# Estimate model without intercept
estimate_model(data, "ret_excess ~ mkt_excess - 1")
Run the code above in your browser using DataLab