[R] Question re predict.glm & predict.lm in STATS

STEPHEN KAISLER @k@|@|er1 @end|ng |rom comc@@t@net
Tue Feb 15 18:44:55 CET 2022


Folks:

I haved glm/lm to build a model on a training set derived from auto_mpg data of 274 records (70% sampling)

The test data set has 118 records.

I am trying to use predict.glm or predict.lm to predict the values of mpg from disp, hp,weight, accel, and cyl.

However I get the following message:


So, the resulting vector has 274 rows, when I believe it should have just 118 rows - the size of the test data set.

I would appreciate it if someone could explain if am making the call
in error.

Steve Kaisler


More information about the R-help mailing list