使用R函数分析“简单斜率”时出现错误

时间:2019-09-03 12:21:54

标签: r debugging

我已经尝试通过中度回归分析“简单斜率” 使用库名称互动 但事实证明那是行不通的

我已经在Google中搜索过,但似乎没有人遇到与我相同的问题

install.packages("interactions", dependencies = TRUE)
library(interactions)

out1 = lm(timetogether ~ malehappy + femalehappy, df)
out2 = lm(timetogether ~ malehappy*femalehappy, df)

summary(out1)
summary(out2)

anova(out1, out2)

sim_slopes(out2, pred = "malehappy", modx = "femalehappy")

当我计算函数名称sim_slopes(out2, pred...)时 它返回我为

  

“ isFALSE(row.names)中的错误:找不到函数“ isFALSE””

某些程序可以运行sim_slopes()而不会出现任何错误。 但是不适合我 我应该怎么做才能解决或检查它?

谢谢

这是dput(df)

的输出
 structure(list(malehappy = structure(c(62, 53, 55, 36, 60, 50,  45,
 53, 48, 50, 63, 46, 72, 40, 40, 30, 49, 49, 45, 59, 46.1513513513514, 
 51, 36, 47, 53, 65, 46, 39, 41, 56, 54, 41, 36, 46.1513513513514,  51,
 50, 47, 56, 44, 42, 61, 44, 47, 55, 57, 55, 32, 62, 53, 60,  59, 65,
 49, 49, 60, 56, 67, 54, 46.1513513513514, 46.1513513513514, 
 46.1513513513514, 34, 57, 61, 73, 42, 84, 46.1513513513514, 47,  43, 46.1513513513514, 59, 40, 42, 49, 55, 46, 56, 50, 48, 57,  50, 53, 46.1513513513514, 50, 46.1513513513514, 61, 64, 48, 42,  31, 71, 54, 29, 45, 56, 53, 56, 47, 48, 39, 58, 51, 48, 54, 52,  57, 89, 53, 53,
 44, 53, 40, 47, 40, 47, 54, 69, 60, 56, 47, 65,  50, 29, 58, 50,
 46.1513513513514, 39, 66, 50, 46.1513513513514,  47, 38, 50, 70, 36, 59, 71, 41, 54, 18, 46.1513513513514, 38,  29, 71, 46.1513513513514,
 51, 46, 48, 61, 52, 41, 48, 44, 37,  43, 54, 56, 44, 55, 51, 64, 52,
 38, 48, 60, 45, 43, 44, 39, 54,  56, 47, 53, 51, 43, 49, 50, 56, 41,
 37, 49, 59, 60, 72, 31, 58,  52, 49, 58, 60, 52, 47, 65, 63, 67,
 46.1513513513514, 54, 60, 
 46.1513513513514, 52, 43, 45, 26, 50, 40, 35, 43, 38, 40, 53,  36, 62, 30, 30, 46.1513513513514, 39, 39, 35, 49, 34, 41, 26,  37, 43, 55, 36,
 29, 31, 46, 44, 31, 26, 28, 41, 40, 37, 46, 34, 
 46.1513513513514, 51, 34, 37, 45, 47, 45, 22, 52, 43, 50, 49,  55, 39, 39, 50, 46, 46.1513513513514, 44, 46.1513513513514, 43, 
 46.1513513513514, 24, 47, 51, 63, 32, 74, 24, 37, 33, 42, 49,  30, 32, 39, 45, 36, 46, 40, 46.1513513513514, 47, 40, 43, 58,  40, 47, 51, 54,
 38, 32, 21, 61, 44, 19, 35, 46, 43, 46, 37, 38,  29, 48, 41, 38, 44,
 42, 47, 79, 43, 43, 34, 43, 30, 37, 30, 37,  44, 59, 50, 46,
 46.1513513513514, 55, 40, 19, 48, 40, 37, 29,  56, 40, 49, 37, 28, 46.1513513513514, 60, 26, 49, 61, 31, 44,  8, 36, 28, 19, 61, 38, 41, 36, 38, 51, 42, 31, 38, 34, 27, 33,  44, 46, 46.1513513513514,
 46.1513513513514, 46.1513513513514,  54, 42, 28, 38, 50, 35, 46.1513513513514, 34, 29, 46.1513513513514,  46, 37, 43, 41, 33, 39, 40, 46, 31, 27, 39, 49, 46.1513513513514,  62, 46.1513513513514, 48,
 42, 39, 48, 50, 42, 37, 55, 53, 57,  44, 44, 50, 52), imputed = c(21L,
 34L, 59L, 60L, 61L, 68L, 71L,  84L, 86L, 127L, 131L, 142L, 146L, 197L,
 200L, 216L, 240L, 257L,  259L, 261L, 280L, 321L, 334L, 359L, 360L,
 361L, 368L, 371L, 384L,  386L), class = "impute"), femalehappy =
 structure(c(59, 54, 51,  35, 50, 55.5978260869565, 45, 59, 49, 63, 53,
 57, 65, 38, 45,  45, 34, 48, 35, 89, 45, 53, 46, 30, 54, 59, 31, 44,
 37, 55, 46,  63, 41, 43, 57, 65, 41, 67, 52, 55, 69, 41, 55, 37, 50,
 39, 23,  63, 63, 47, 53, 52, 37, 51, 52, 34, 58, 55, 55.5978260869565,
 60, 55.5978260869565, 42, 42, 55.5978260869565, 55, 39, 71,
 55.5978260869565,  41, 51, 38, 38, 44, 72, 57, 44, 45, 57, 56, 43, 55.5978260869565,  51, 46, 64, 64, 65, 74, 58, 54, 51, 45, 61, 56, 39, 48, 49, 57,  56, 39, 51, 35, 42, 49, 43, 43, 53, 64, 67, 43, 54, 49,
 57, 43,  44, 57, 48, 64, 56, 57, 69, 55.5978260869565, 65, 65, 37, 52,
 50, 55.5978260869565, 55.5978260869565, 61, 57, 55.5978260869565,  46,
 62, 55, 66, 50, 70, 63, 44, 62, 36, 55.5978260869565, 23,  47, 54,
 55.5978260869565, 41, 40, 57, 40, 61, 45, 57, 30, 40,  42, 55.5978260869565, 57, 45, 44, 46, 48, 33, 45, 49, 55, 47,  40, 47, 42, 60, 55.5978260869565, 38, 55.5978260869565, 41, 55,  36, 52, 50, 36,
 44, 50, 59, 59, 55.5978260869565, 49, 62, 57,  37, 59, 63, 43, 38, 63,
 53, 58, 60, 47, 49, 55.5978260869565,  69, 64, 61, 45, 60, 61, 55, 69,
 59, 73, 63, 67, 75, 48, 55, 55.5978260869565,  44, 58, 45, 99, 55, 63,
 56, 40, 64, 69, 55.5978260869565, 54,  47, 65, 56, 73, 51, 53, 67, 75,
 51, 77, 62, 55.5978260869565,  79, 51, 65, 47, 60, 49, 33, 73, 73,
 55.5978260869565, 63, 62,  47, 61, 62, 44, 68, 65, 55.5978260869565, 70, 55.5978260869565,  52, 52, 64, 65, 49, 81, 48, 51, 61, 48, 48, 54,
 55.5978260869565,  67, 54, 55, 67, 66, 55.5978260869565, 55.5978260869565, 61, 56,  74, 74, 75, 84, 68, 64, 61, 55, 71, 66, 49, 58, 59, 67, 66, 49,  61, 45, 52, 59, 53, 53, 55.5978260869565, 74, 77,
 53, 64, 59,  67, 53, 54, 67, 58, 74, 66, 67, 79, 57, 75, 75, 47, 62,
 60, 57,  42, 71, 67, 63, 56, 72, 65, 76, 60, 80, 73, 54, 72, 46, 57,
 33,  57, 64, 72, 51, 50, 67, 50, 71, 55, 67, 40, 50, 52, 56, 67,
 55.5978260869565,  54, 55.5978260869565, 58, 43, 55.5978260869565, 59, 65, 57, 55.5978260869565,  57, 52, 70, 56, 48, 65, 51, 65, 46, 62, 60,
 46, 55.5978260869565,  60, 69, 69, 84, 59, 72, 67, 47, 69, 73, 53, 48,
 73, 63, 68, 70,  57, 59, 72), imputed = c(6L, 59L, 61L, 64L, 68L, 81L,
 121L, 127L,  128L, 131L, 142L, 146L, 157L, 172L, 174L, 185L, 200L,
 216L, 227L,  240L, 250L, 259L, 261L, 274L, 280L, 281L, 306L, 359L,
 361L, 364L,  368L, 381L), class = "impute"), timetogether =
 structure(c(132,  89, 86, 19, 96, 74, 47, 91.7415143603133, 62, 104,
 114, 76, 195,  27, 39, 18, 30, 63, 28, 91.7415143603133, 45, 79, 29,
 18, 89,  145, 20, 34, 26, 101, 69, 70, 25, 32, 93, 107, 43, 136, 60,
 59,  165, 37, 73, 43, 89, 49, 6, 146, 91.7415143603133, 85,
 91.7415143603133,  115, 36, 71, 103, 35, 145, 93, 37, 104, 69, 91.7415143603133,  64, 114, 152, 31, 91.7415143603133, 20, 43, 54, 43, 51, 36, 87,  85, 65, 50, 109, 85, 48, 89, 74, 67, 178, 105, 136, 186,
 138,  75, 51, 19, 172, 96, 14, 55, 84, 98, 91.7415143603133, 38, 68, 
 22, 64, 70, 49, 60, 82, 132, 277, 60, 89, 54, 98, 36, 51, 57,  58,
 122, 142, 118, 146, 57, 165, 109, 13, 95, 70, 55, 17, 153,  88, 103,
 52, 58, 82, 190, 36, 162, 184, 38, 91.7415143603133,  0, 56, 5, 17,
 139, 90, 48, 39, 82, 61, 103, 41, 82, 16, 26, 38,  68, 108, 45, 66,
 61, 98, 29, 34, 64, 114, 51, 35, 51, 30, 109,  74, 35, 89, 50,
 91.7415143603133, 34, 75, 85, 26, 31, 67, 122,  128, 237, 21, 130, 95, 36, 123, 141, 55, 37, 158, 116, 145, 109,  72, 92, 91.7415143603133,
 164, 113, 120, 47, 137, 100, 73, 119,  88, 111, 157, 87, 231, 57, 59,
 23, 78, 91, 71, 205, 71, 103,  41, 70, 116, 181, 70, 54, 60, 130, 108,
 63, 43, 51, 111, 111,  79, 147, 75, 65, 179, 69, 87, 97, 127, 101, 47,
 171, 124, 130,  139, 163, 81, 95, 142, 95, 185, 118, 66, 121, 96, 39,
 113, 151,  206, 63, 325, 41, 79, 71, 90, 110, 56, 69, 101, 109, 79,
 134,  103, 82, 125, 99, 103, 211, 110, 150, 194, 175, 93, 66, 25, 214,
 120, 26, 78, 121, 120, 132, 78, 91, 55, 114, 100, 83, 103, 108,  148,
 91.7415143603133, 102, 115, 74, 120, 59, 83, 59, 84, 134,  189, 150, 91.7415143603133, 85, 193, 114, 28, 131, 98, 83, 55,  188, 105, 138, 81, 49, 102, 223, 42, 172, 222, 61, 132, 0, 81,  54, 16, 191, 96, 90,
 74, 91.7415143603133, 119, 91.7415143603133,  62, 97, 64, 50, 67, 106,
 133, 71, 109, 96, 91.7415143603133,  84, 51, 89, 149,
 91.7415143603133, 68, 74, 53, 128, 116, 76,  113, 91, 70, 80, 98, 121, 60, 48, 92, 149, 157, 262, 21, 151,  114, 81, 148, 164, 97, 78, 188,
 158, 186, 126, 91.7415143603133,  136, 174), imputed = c(8L, 20L, 49L,
 51L, 62L, 67L, 98L, 140L,  176L, 200L, 308L, 320L, 349L, 351L, 362L,
 367L, 398L), class = "impute"), 
     kids = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2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L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
     ), .Label = c("nokids", "kids"), class = "factor")), .Names = c("malehappy",  "femalehappy", "timetogether", "kids"), row.names =
 c(NA, -400L ), class = "data.frame")

1 个答案:

答案 0 :(得分:0)

它与R版本有关。从3.5版开始,isFALSE函数内置于R中。使用R 3.4时,软件包“ jjtools”遇到相同的错误。将R升级到版本3.6,问题消失了。