我试图适应线性模型,但我面对这个警告;
> reg=lm(Data.readmitted ~., newdata)
Warning messages:
1: In model.response(mf, "numeric") :
` using type = "numeric" with a factor response will be ignored
`2: In Ops.factor(y, z$residuals) : ‘-’ not meaningful for factors
来自我的数据集的及其str()
:
> str(newdata)
'data.frame': 94613 obs. of 4 variables:
$ Data.race : Factor w/ 5 levels "AfricanAmerican",..: 3 3 1 3 3 3 3 3 3 3 ...
$ Data.gender : Factor w/ 3 levels "Female","Male",..: 1 1 1 2 2 2 2 2 1 1 ...
$ Data.age : Factor w/ 10 levels "[0-10)","[10-20)",..: 1 2 3 4 5 6 7 8 9 10 ..
$ Data.readmitted: Factor w/ 3 levels "<30",">30","NO": 3 2 3 3 3 2 3 2 3 3 ...
- attr(*, "na.action")=Class 'omit' Named int [1:2153] 20 21 22 55 66 88 100 112 128 178 ...
.. ..- attr(*, "names")= chr [1:2153] "20" "21" "22" "55" ...