0

外気温度と TOD (96 カテゴリ変数、時刻) を使用して、15 分間隔で負荷消費の前日予測を取得する次のコードがあります。以下のコードを実行すると、次のエラーが発生します。

  i = 97:192
  formula = as.formula(load[i] ~ load[i-96] + oat[i])
  model = glm(formula, data = train.set, family=Gamma(link=vlog()))   

glm() を使用して最後の行の後に次のエラーが表示されます。

Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : 
  contrasts can be applied only to factors with 2 or more levels

そして、predict() を使用して最後の行の後に次のエラーが表示されます。

Warning messages:
1: In if (!se.fit) { :
  the condition has length > 1 and only the first element will be used
2: 'newdata' had 96 rows but variable(s) found have 1 rows 
3: In predict.lm(object, newdata, se.fit, scale = residual.scale, type = ifelse(type ==  :
  prediction from a rank-deficient fit may be misleading
4: In if (se.fit) list(fit = predictor, se.fit = se, df = df, residual.scale = sqrt(res.var)) else predictor :
  the condition has length > 1 and only the first element will be used
4

1 に答える 1