R 如何使用plm软件包进行内部回归,并为每组获得不同的系数?
我有以下面板数据,包括支出数据、政府紧缩指数、日期和该县收入四分位数R 如何使用plm软件包进行内部回归,并为每组获得不同的系数?,r,dataframe,regression,data-analysis,R,Dataframe,Regression,Data Analysis,我有以下面板数据,包括支出数据、政府紧缩指数、日期和该县收入四分位数 # A tibble: 47,898 x 5 countyfips date spend_all GovernmentResponseIndex income_quartile <fct> <chr> <dbl> <dbl> <dbl> 1 1001 20
# A tibble: 47,898 x 5
countyfips date spend_all GovernmentResponseIndex income_quartile
<fct> <chr> <dbl> <dbl> <dbl>
1 1001 20200112 -0.0831 0 3
2 1001 20200119 0.0038 0 3
3 1001 20200126 0.0917 0 3
4 1001 20200202 -0.00724 0 3
5 1001 20200209 0.00567 0 3
6 1001 20200216 0.125 0 3
7 1001 20200223 -0.0929 0 3
8 1001 20200301 -0.0455 0 3
9 1001 20200308 0.108 5.13 3
10 1001 20200315 0.212 12.8 3
# … with 47,888 more rows
#tible:47898 x 5
countyfips日期支出\所有政府责任指数收入\四分位数
1 1001 20200112 -0.0831 0 3
2 1001 20200119 0.0038 0 3
3 1001 20200126 0.0917 0 3
4 1001 20200202 -0.00724 0 3
5 1001 20200209 0.00567 0 3
6 1001 20200216 0.125 0 3
7 1001 20200223 -0.0929 0 3
8 1001 20200301 -0.0455 0 3
9 1001 20200308 0.108 5.13 3
10 1001 20200315 0.212 12.8 3
#…还有47888行
我想进行一次内部回归,分别得到每个收入四分位数的支出和指数之间的关系。
我尝试了以下方法:
plm_spending_income <- plm(data = Affinity_County_Weekly.csv.p, spend_all ~ GovernmentResponseIndex * factor(income_quartile), model = "within")
plm\u支出\u收入