Skip to main content
fixed typo
Link
Peter Flom
  • 128.3k
  • 36
  • 184
  • 425

Multicollinearity between cathegoricalcategorical and continuous variable

added 11 characters in body
Source Link
Tomas
  • 6.2k
  • 14
  • 62
  • 106
glm(cbind(young, adults) ~ as.factor(month) + effort, family = "binomial")
glm(cbind(young, adults) ~ month + effort, family = "binomial")
glm(cbind(young, adults) ~ as.factor(month) + effort, family = "binomial")
added 4614 characters in body
Source Link
Tomas
  • 6.2k
  • 14
  • 62
  • 106

EDIT - response to Scortchi question - no, not actually:

> m = glm(cbind(young, adults) ~ as.factor(month) + effort, family = "quasibinomial")
> summary(m)

Call:
glm(formula = cbind(young, adults) ~ as.factor(month) + effort, family = "quasibinomial")

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.6829  -1.1138   0.0000   0.9717   4.0090  

Coefficients:
                     Estimate Std. Error t value Pr(>|t|)    
(Intercept)        -0.7868764  0.2170738  -3.625 0.000306 ***
as.factor(month)2   0.8857561  0.2606780   3.398 0.000710 ***
as.factor(month)3   0.7055741  0.2918895   2.417 0.015843 *  
as.factor(month)4   0.3943665  0.3269973   1.206 0.228138    
as.factor(month)5   0.4831113  0.3730987   1.295 0.195713    
as.factor(month)6  -0.5217349  0.5027560  -1.038 0.299676    
as.factor(month)7   0.1612901  0.4333682   0.372 0.709851    
as.factor(month)8   0.5114890  0.3545159   1.443 0.149444    
as.factor(month)9   0.7741060  0.3126087   2.476 0.013466 *  
as.factor(month)10  0.6601093  0.2609937   2.529 0.011608 *  
as.factor(month)11  0.4891778  0.2647303   1.848 0.064967 .  
as.factor(month)12  0.4743091  0.2565709   1.849 0.064849 .  
effort              0.0032506  0.0007976   4.075 5.02e-05 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for quasibinomial family taken to be 1.270962)

    Null deviance: 1518.0  on 878  degrees of freedom
Residual deviance: 1447.8  on 866  degrees of freedom
  (750 observations deleted due to missingness)
AIC: NA

Number of Fisher Scoring iterations: 4

Warning message:
In summary.glm(m) :
  observations with zero weight not used for calculating dispersion
> 
> 
> m = glm(cbind(young, adults) ~ as.factor(month), family = "quasibinomial")
> summary(m)

Call:
glm(formula = cbind(young, adults) ~ as.factor(month), family = "quasibinomial")

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-3.1142  -1.1266   0.0000   0.9235   3.6484  

Coefficients:
                   Estimate Std. Error t value Pr(>|t|)    
(Intercept)         -0.2296     0.1590  -1.444  0.14890    
as.factor(month)2    0.8610     0.2059   4.181 3.09e-05 ***
as.factor(month)3    1.0887     0.2062   5.280 1.51e-07 ***
as.factor(month)4    0.4184     0.2374   1.762  0.07822 .  
as.factor(month)5    0.1495     0.3086   0.485  0.62802    
as.factor(month)6   -0.6177     0.3872  -1.595  0.11091    
as.factor(month)7   -0.4636     0.3666  -1.265  0.20622    
as.factor(month)8    0.1089     0.2976   0.366  0.71440    
as.factor(month)9    0.4932     0.2490   1.980  0.04787 *  
as.factor(month)10   0.6322     0.2096   3.016  0.00261 ** 
as.factor(month)11   0.4919     0.2152   2.286  0.02243 *  
as.factor(month)12   0.2296     0.2127   1.079  0.28071    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for quasibinomial family taken to be 1.309215)

    Null deviance: 2400.1  on 1345  degrees of freedom
Residual deviance: 2310.4  on 1334  degrees of freedom
AIC: NA

Number of Fisher Scoring iterations: 4

Warning message:
In summary.glm(m) :
  observations with zero weight not used for calculating dispersion
> 
> 
> 
> m = glm(cbind(young, adults) ~ effort, family = "quasibinomial")
> summary(m)

Call:
glm(formula = cbind(young, adults) ~ effort, family = "quasibinomial")

Deviance Residuals: 
   Min      1Q  Median      3Q     Max  
-2.718  -1.119   0.000   1.011   4.236  

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.326899   0.102473  -3.190  0.00147 ** 
effort       0.003827   0.000688   5.563 3.52e-08 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for quasibinomial family taken to be 1.268467)

    Null deviance: 1518.0  on 878  degrees of freedom
Residual deviance: 1475.4  on 877  degrees of freedom
  (750 observations deleted due to missingness)
AIC: NA

Number of Fisher Scoring iterations: 4

Warning message:
In summary.glm(m) :
  observations with zero weight not used for calculating dispersion

EDIT - response to Scortchi question - no, not actually:

> m = glm(cbind(young, adults) ~ as.factor(month) + effort, family = "quasibinomial")
> summary(m)

Call:
glm(formula = cbind(young, adults) ~ as.factor(month) + effort, family = "quasibinomial")

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.6829  -1.1138   0.0000   0.9717   4.0090  

Coefficients:
                     Estimate Std. Error t value Pr(>|t|)    
(Intercept)        -0.7868764  0.2170738  -3.625 0.000306 ***
as.factor(month)2   0.8857561  0.2606780   3.398 0.000710 ***
as.factor(month)3   0.7055741  0.2918895   2.417 0.015843 *  
as.factor(month)4   0.3943665  0.3269973   1.206 0.228138    
as.factor(month)5   0.4831113  0.3730987   1.295 0.195713    
as.factor(month)6  -0.5217349  0.5027560  -1.038 0.299676    
as.factor(month)7   0.1612901  0.4333682   0.372 0.709851    
as.factor(month)8   0.5114890  0.3545159   1.443 0.149444    
as.factor(month)9   0.7741060  0.3126087   2.476 0.013466 *  
as.factor(month)10  0.6601093  0.2609937   2.529 0.011608 *  
as.factor(month)11  0.4891778  0.2647303   1.848 0.064967 .  
as.factor(month)12  0.4743091  0.2565709   1.849 0.064849 .  
effort              0.0032506  0.0007976   4.075 5.02e-05 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for quasibinomial family taken to be 1.270962)

    Null deviance: 1518.0  on 878  degrees of freedom
Residual deviance: 1447.8  on 866  degrees of freedom
  (750 observations deleted due to missingness)
AIC: NA

Number of Fisher Scoring iterations: 4

Warning message:
In summary.glm(m) :
  observations with zero weight not used for calculating dispersion
> 
> 
> m = glm(cbind(young, adults) ~ as.factor(month), family = "quasibinomial")
> summary(m)

Call:
glm(formula = cbind(young, adults) ~ as.factor(month), family = "quasibinomial")

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-3.1142  -1.1266   0.0000   0.9235   3.6484  

Coefficients:
                   Estimate Std. Error t value Pr(>|t|)    
(Intercept)         -0.2296     0.1590  -1.444  0.14890    
as.factor(month)2    0.8610     0.2059   4.181 3.09e-05 ***
as.factor(month)3    1.0887     0.2062   5.280 1.51e-07 ***
as.factor(month)4    0.4184     0.2374   1.762  0.07822 .  
as.factor(month)5    0.1495     0.3086   0.485  0.62802    
as.factor(month)6   -0.6177     0.3872  -1.595  0.11091    
as.factor(month)7   -0.4636     0.3666  -1.265  0.20622    
as.factor(month)8    0.1089     0.2976   0.366  0.71440    
as.factor(month)9    0.4932     0.2490   1.980  0.04787 *  
as.factor(month)10   0.6322     0.2096   3.016  0.00261 ** 
as.factor(month)11   0.4919     0.2152   2.286  0.02243 *  
as.factor(month)12   0.2296     0.2127   1.079  0.28071    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for quasibinomial family taken to be 1.309215)

    Null deviance: 2400.1  on 1345  degrees of freedom
Residual deviance: 2310.4  on 1334  degrees of freedom
AIC: NA

Number of Fisher Scoring iterations: 4

Warning message:
In summary.glm(m) :
  observations with zero weight not used for calculating dispersion
> 
> 
> 
> m = glm(cbind(young, adults) ~ effort, family = "quasibinomial")
> summary(m)

Call:
glm(formula = cbind(young, adults) ~ effort, family = "quasibinomial")

Deviance Residuals: 
   Min      1Q  Median      3Q     Max  
-2.718  -1.119   0.000   1.011   4.236  

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.326899   0.102473  -3.190  0.00147 ** 
effort       0.003827   0.000688   5.563 3.52e-08 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for quasibinomial family taken to be 1.268467)

    Null deviance: 1518.0  on 878  degrees of freedom
Residual deviance: 1475.4  on 877  degrees of freedom
  (750 observations deleted due to missingness)
AIC: NA

Number of Fisher Scoring iterations: 4

Warning message:
In summary.glm(m) :
  observations with zero weight not used for calculating dispersion
Source Link
Tomas
  • 6.2k
  • 14
  • 62
  • 106
Loading