[R] Predictions on training set shorter than training set

Mark Drummond mark at markdrummond.ca
Thu Apr 23 19:23:24 CEST 2015

Hi all,

Given a simple logistic regression on a training data set using glm,
the number of predicted values is less than the number of observations
in the training set:

> fit.train.pred <- predict(fit, type = "response")
> nrow(train)
[1] 62660
> length(fit.train.pred)
[1] 58152

As a relative newcomer, I've run lots of simple glm, CART etc. models
but this is the first time I have seen this happen.

Is this a common issue and is there a fix? An option to predict() perhaps?

Cheers, Mark

Mark Drummond
mark at markdrummond.ca

When I get sad, I stop being sad and be Awesome instead. TRUE STORY.

More information about the R-help mailing list