将常数定义为 r 回归的系数
Defining a constant as a coefficient from an r regression
我正在尝试将常数定义为 r 回归的系数。 IE。尝试将弹性定义为您可以在照片中看到的数字 -1.64431。
reg <- lm(ln_q ~ ln_price, data=df)
elasticity <- reg[["coefficients","ln_price"]]
print(elasticity)
我收到错误:
Error in reg[["coefficients", "ln_price"]] :
incorrect number of subscripts
非常感谢任何帮助! :)
elasticity <- reg$coefficients[names(reg$coefficients)=="ln_price"]
我正在尝试将常数定义为 r 回归的系数。 IE。尝试将弹性定义为您可以在照片中看到的数字 -1.64431。
reg <- lm(ln_q ~ ln_price, data=df)
elasticity <- reg[["coefficients","ln_price"]]
print(elasticity)
我收到错误:
Error in reg[["coefficients", "ln_price"]] :
incorrect number of subscripts
非常感谢任何帮助! :)
elasticity <- reg$coefficients[names(reg$coefficients)=="ln_price"]