我正在尝试进行逐步回归,但是我得到的输出比输入数据帧短。不幸的是,我无法共享我的数据,但是任何帮助将不胜感激。先感谢您!
#training data
a3<-na.omit(train_occur)
sum(is.na(train_occur))
> 0
dim(a3)
>2228 10
full_log<-glm(formula = occurrence ~ . , family=binomial(link=logit), data= train_occur, control = list(maxit = 50))
back_log_occur<-step(full_log)
length(back_log_occur$fitted.values)
>66
#test data
dim(test_occur) #I took out the response variable although I found it doesn't seem to matter whether or not the response variable is there...
>243 9
pred_back_log_occur<-predict(object=back_log_occur,data=test_occur,type="response")
length(pred_back_log_occur)
> 66
我预计训练的2228个拟合值和测试集的243个预测值。