error glm,NA / NaN / Inf in'y

问题描述 投票:0回答:1

我正在尝试将GLM模型适合我的数据。数据(rope_complete)如下所示:

      rope.X...Sound rope.directional.change rope.Time.of.the.shark.in.the.video
1           5_min_blank                       5              23
2           Snorkeling                        11             37
3                 Fish1                       1              17
4                 Fish1                       6              46
5                 Diving                      6              37

现在我想检查我是否具有NA值:

table(is.na(rope_complete))

看到我没有:

FALSE  : 3225 

现在我做了我的GLM:

directional_turn_fit<-glm(rope_complete$rope.directional.change~
                        rope_complete$rope.X...Sound
                      +offset(
          log(rope_complete$rope.Time.of.the.shark.in.the.video))
          , family = poisson)

但是我仍然遇到相同的错误:

Error in glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  :             
Na/NaN/Inf in 'y'

我有点迷茫,因为我不知道我现在应该做什么。我知道我的数据是泊松分布的。

r na glm
1个回答
0
投票
只需尝试在此处完成问题。当您将此模型建模为泊松分布并将“ rope.time.of.the.shark.in.the.video”作为偏移量时,您正在有效地建模每数量发生的“ rope.directional.change”的计数鲨鱼出现在视频中的时间。当鲨鱼不在视频中时,此构造将不起作用,因此需要丢弃这些数据。
© www.soinside.com 2019 - 2024. All rights reserved.