## Binomial response --------------
data(carrots)
Cfit1 <- glm(cbind(success, total-success) ~ logdose + block,
data = carrots, family = binomial)
summary(Cfit1)
Rfit1 <- glmrob(cbind(success, total-success) ~ logdose + block,
family = binomial, data = carrots, method= "Mqle",
control= glmrobMqle.control(tcc=1.2))
summary(Rfit1)
Rfit2 <- glmrob(success/total ~ logdose + block, weights = total,
family = binomial, data = carrots, method= "Mqle",
control= glmrobMqle.control(tcc=1.2))
coef(Rfit2) ## The same as Rfit1
## Binary response --------------
data(vaso)
Vfit1 <- glm(Y ~ log(Volume) + log(Rate), family=binomial, data=vaso)
coef(Vfit1)
Vfit2 <- glmrob(Y ~ log(Volume) + log(Rate), family=binomial, data=vaso,
method="Mqle", control = glmrobMqle.control(tcc=3.5))
## Note the problems with tcc <= 3 %% FIXME algorithm ???
coef(Vfit2) # c = 3.5 ==> not much different from classical
## Poisson response --------------
data(epilepsy)
Efit1 <- glm(Ysum ~ Age10 + Base4*Trt, family=poisson, data=epilepsy)
summary(Efit1)
Efit2 <- glmrob(Ysum ~ Age10 + Base4*Trt, family = poisson,
data = epilepsy, method= "Mqle",
control = glmrobMqle.control(tcc= 1.2))
summary(Efit2)
## 'x' weighting:
(Efit3 <- glmrob(Ysum ~ Age10 + Base4*Trt, family = poisson,
data = epilepsy, method= "Mqle", weights.on.x = "hat",
control = glmrobMqle.control(tcc= 1.2)))
try( # gives singular cov matrix: 'Trt' is binary factor -->
# affine equivariance and subsampling are problematic
Efit4 <- glmrob(Ysum ~ Age10 + Base4*Trt, family = poisson,
data = epilepsy, method= "Mqle", weights.on.x = "covMcd",
control = glmrobMqle.control(tcc=1.2, maxit=100))
)
Run the code above in your browser using DataLab