> InstallmentRatePercentage_r18 <- InstallmentRatePercentage^2
> reg18 <- glm(Class1~Housing.Own+SavingsAccountBonds.lt.100+CreditHistory.Delay+CreditHistory.PaidDuly+CreditHistory.Critical+CheckingAccountStatus.lt.0+CheckingAccountStatus.0.to.200+Duration+InstallmentRatePercentage_r18,family = binomial(link = 'logit'))
> prediction_reg18 <- predict(reg18,newdata = data.frame(test1))
Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) :
变数的长度不一样('InstallmentRatePercentage_r18')
In addition: Warning message:
'newdata'必需有200行 但变量里有800行
> length(InstallmentRatePercentage)
[1] 800
> length(InstallmentRatePercentage_r18)
[1] 800
请教大神,为什么用predict 函数在新的方程不能用,用没有square的变量时候可以赋值,但是square之后就不行了。