R error which says “Models were not all fitted to the same size of dataset”

后端 未结 6 1041
栀梦
栀梦 2020-12-01 21:42

I have created two generalised linear models as follows:

glm1 <-glm(Y ~ X1 + X2 + X3, family=binomial(link=logit))

glm2 <-glm(Y ~ X1 + X2, family=bino         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 22:07

    I'm guessing that you meant to type:

    glm1 <-glm(Y ~ X1+X2+X3, family=binomial(link=logit))
    
    glm2 <-glm(Y ~ X1 + X2, family=binomial(link=logit))
    

    The formula interface for R regression functions does not recognize commas as adding covariates to the RHS of the formula. And don't use attach(); use the data argument to regression functions.

提交回复
热议问题