gpt4 book ai didi

r - 由于 stata 导入的标签,is.pbalanced.default(x) : argument "y" is missing, 中的错误没有默认值

转载 作者:行者123 更新时间:2023-12-04 10:21:02 26 4
gpt4 key购买 nike

对于以下面板数据集:

panel <- structure(list(uurwerk = structure(c(40, 40, 40, 40, 36, 1, 32, 
36, 32, 32, 36, 36, 40, 40, 40, 40, 40, 38, 38, 38, 38, 60, 55,
40, 42, 42, 42), label = "hours/week work in fact (on average)", class = c("labelled",
"numeric")), loon_c = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), label = "pay/salary [gross] mean int", class = c("labelled",
"numeric")), mtr_loon = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0.4195, 0.42, 0, 0.404, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0), label = "pay/salary [gross] mean int", class = c("labelled",
"numeric")), ntot = structure(c(33084.2085, 31810.0215, 21653.7235,
21961.9788, 21535.29225, 24139.039, 22988.2945, 22183.3175, 84427.88258,
21729.72304, 24248.3388, 23044.16914, 24783.0759660205, 24955.49,
26060.0875, 29328.0404, 30407.6135, 39047.7663137553, 24467.7521372549,
37826.93, 25963.83683, 24516.76866, 24941.179175, 27549.5975,
32690.0255, 25200.10125, 23777.335), label = "total net income", class = c("labelled",
"numeric")), INC = structure(c(6L, 6L, 3L, 3L, 5L, 4L, 5L, 5L,
6L, 5L, 4L, 4L, 3L, 3L, 3L, 3L, 4L, 4L, 6L, 5L, 1L, 4L, 4L, 6L,
5L, 5L, 5L), .Label = c("[ 0, 3010)", "[ 3010, 20300)",
"[20300, 27189)", "[27189, 34020)", "[34020, 40767)", "[40767, 50961)",
"[50961,1165420]"), class = c("labelled", "factor"), label = "total netto income household 2013"),
year = structure(c(1L, 2L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 1L, 4L, 5L, 6L, 7L, 1L, 3L, 4L, 6L, 5L, 8L, 1L, 2L,
3L, 4L), .Label = c("2011", "2012", "2013", "2014", "2015",
"2016", "2017", "2018"), class = "factor"), nohhold = structure(c(1L,
1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L,
4L, 5L, 5L, 5L, 5L, 6L, 6L, 7L, 7L, 7L, 7L), .Label = c("6",
"21", "38", "106", "116", "175", "262"), class = "factor")), row.names = c("6-2011",
"6-2012", "6-2015", "6-2016", "38-2011", "38-2012", "38-2013",
"38-2014", "38-2015", "38-2016", "38-2017", "38-2018", "106-2011",
"106-2014", "106-2015", "106-2016", "106-2017", "116-2011", "116-2013",
"116-2014", "116-2016", "175-2015", "175-2018", "262-2011", "262-2012",
"262-2013", "262-2014"), class = c("pdata.frame", "data.frame"
), index = structure(list(nohhold = structure(c(1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L,
4L, 5L, 5L, 6L, 6L, 6L, 6L), .Label = c("6", "38", "106", "116",
"175", "262"), class = "factor"), year = structure(c(1L, 2L,
5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 4L, 5L, 6L, 7L, 1L,
3L, 4L, 6L, 5L, 8L, 1L, 2L, 3L, 4L), .Label = c("2011", "2012",
"2013", "2014", "2015", "2016", "2017", "2018"), class = "factor")), row.names = c(1L,
2L, 5L, 6L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 28L,
29L, 30L, 31L, 33L, 35L, 36L, 38L, 43L, 46L, 47L, 48L, 49L, 50L
), class = c("pindex", "data.frame")))

我想运行一个(ny)随机效应模型:
library(plm)
summary(plm(uurwerk ~ loon_c + ntot, model="random", data=panel))

但我收到错误:
Error in is.pbalanced.default(x) : argument "y" is missing, with no default

我终其一生都无法弄清楚这是怎么回事。

有什么建议?

最佳答案

问题来自您的因变量:

class(panel$uurwerk)
[1] "pseries" "labelled" "numeric"

根据您的公式,我猜您将其视为连续的,因此您可以执行以下操作:
plm(as.numeric(uurwerk) ~ loon_c + ntot, model="random",data=panel)

Model Formula: as.numeric(uurwerk) ~ loon_c + ntot

Coefficients:
(Intercept) loon_c ntot
4.0427e+01 -9.8477e-02 -9.2704e-06

关于r - 由于 stata 导入的标签,is.pbalanced.default(x) : argument "y" is missing, 中的错误没有默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60847460/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com