Error in xj[i] : invalid subscript type ‘list’

The issue is in subset=train. According to the ?glm. the subset should be a vector as oppose to a subset of original dataset:

subset an optional vector specifying a subset of observations to be used in the fitting process.

Hence, you may need to change the code to: glm.fit=glm(Status~Length+Right+Bottom+Top+Diagonal,data=train,family=binomial)

or

glm.fit=glm(Status~Length+Right+Bottom+Top+Diagonal,data=bank,family=binomial,subset=1:100)

Leave a Comment