0
我想用功能glm()
中建立的R來預測足球比賽結果。但是我得到Error in family:poisson(link = "log") : NA/NaN argument
。家族中的錯誤:poisson(link =「log」):NA/NaN參數
,我使用的代碼是:
model <- glm(HomeTeamScore ~ AwayTeamScore + HomeTeam + AwayTeam,
family:poisson(link = "log"), data = results)
summary(model)
結果如下表所示: -
Day Date HomeTeam AwayTeam HomeTeamScore AwayTeamScore Competition
1 Friday 2015-08-14 Aston Villa Man United 0 1 PremierLeague
2 Monday 2015-08-10 West Brom Man City 0 3 PremierLeague
3 Monday 2015-08-17 Liverpool Bournemouth 1 0 PremierLeague
4 Monday 2015-08-24 Arsenal Liverpool 0 0 PremierLeague
5 Monday 2015-09-14 West Ham Newcastle 2 0 PremierLeague
6 Monday 2015-09-28 West Brom Everton 2 3 PremierLeague
感謝宋哲元,它成功了! –