R Under development (unstable) (2024-06-18 r86781 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > library(robustbase) > ### "intercept only" : "no x" > > > set.seed(101) > k <- rbinom(100, size=3, pr = 0.2) > y <- cbind(k, n.k = 3 - k) > > gg <- glm(y ~ 1, family = "binomial") > (cfK <- coef(summary(gg))) Estimate Std. Error z value Pr(>|z|) (Intercept) -1.22723 0.1378993 -8.899464 5.611711e-19 > > Inf. <- 1e5 # FIXME (note that much larger values *deteriorate* slightly!) > rg.Inf <- glmrob(y ~ 1, family = "binomial", tcc= Inf.) > stopifnot(all.equal(unname(cfK[1:2]), + unname(unlist(coef(summary(rg.Inf))[1:2])), + tolerance = 1e-7))# 4.09e-8 > > rg.0 <- glmrob(y ~ 1, family = "binomial") > summary(rg.0) Call: glmrob(formula = y ~ 1, family = "binomial") Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -1.2228 0.1408 -8.684 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Robustness weights w.r * w.x: 87 weights are ~= 1. The remaining 13 ones are summarized as Min. 1st Qu. Median Mean 3rd Qu. Max. 0.4213 0.7411 0.7411 0.7165 0.7411 0.7411 Number of observations: 100 Fitted by method 'Mqle' (in 2 iterations) (Dispersion parameter for binomial family taken to be 1) No deviance values available Algorithmic parameters: acc tcc 0.0001 1.3450 maxit 50 test.acc "coef" > str(rg.0, digits= 6) List of 28 $ coefficients : Named num -1.2228 ..- attr(*, "names")= chr "(Intercept)" $ residuals : Named num [1:100] -0.939795 -0.939795 0.437532 0.437532 -0.939795 ... ..- attr(*, "names")= chr [1:100] "1" "2" "3" "4" ... $ fitted.values : Named num [1:100] 0.227444 0.227444 0.227444 0.227444 0.227444 ... ..- attr(*, "names")= chr [1:100] "1" "2" "3" "4" ... $ w.r : num [1:100] 1 1 1 1 1 1 1 1 1 1 ... $ w.x : num [1:100] 1 1 1 1 1 1 1 1 1 1 ... $ ni : num [1:100] 3 3 3 3 3 3 3 3 3 3 ... $ dispersion : num 1 $ cov : num [1, 1] 0.0198292 ..- attr(*, "dimnames")=List of 2 .. ..$ : chr "(Intercept)" .. ..$ : chr "(Intercept)" $ matM : num [1, 1] 0.436674 ..- attr(*, "dimnames")=List of 2 .. ..$ : chr "(Intercept)" .. ..$ : chr "(Intercept)" $ matQ : num [1, 1] 0.378112 ..- attr(*, "dimnames")=List of 2 .. ..$ : chr "(Intercept)" .. ..$ : chr "(Intercept)" $ tcc : num 1.345 $ family :List of 13 ..$ family : chr "binomial" ..$ link : chr "logit" ..$ linkfun :function (mu) ..$ linkinv :function (eta) ..$ variance :function (mu) ..$ dev.resids:function (y, mu, wt) ..$ aic :function (y, n, mu, wt, dev) ..$ mu.eta :function (eta) ..$ initialize: language { if (NCOL(y) == 1) { ... ..$ validmu :function (mu) ..$ valideta :function (eta) ..$ simulate :function (object, nsim) ..$ dispersion: num 1 ..- attr(*, "class")= chr "family" $ linear.predictors: Named num [1:100] -1.2228 -1.2228 -1.2228 -1.2228 -1.2228 ... ..- attr(*, "names")= chr [1:100] "1" "2" "3" "4" ... $ deviance : NULL $ iter : int 2 $ y : Named num [1:100] 0 0 0.333333 0.333333 0 ... ..- attr(*, "names")= chr [1:100] "1" "2" "3" "4" ... $ converged : logi TRUE $ model :'data.frame': 100 obs. of 1 variable: ..$ y: num [1:100, 1:2] 0 0 1 1 0 0 1 0 1 1 ... .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : NULL .. .. ..$ : chr [1:2] "k" "n.k" ..- attr(*, "terms")=Classes 'terms', 'formula' language y ~ 1 .. .. ..- attr(*, "variables")= language list(y) .. .. ..- attr(*, "factors")= int(0) .. .. ..- attr(*, "term.labels")= chr(0) .. .. ..- attr(*, "order")= int(0) .. .. ..- attr(*, "intercept")= int 1 .. .. ..- attr(*, "response")= int 1 .. .. ..- attr(*, ".Environment")= .. .. ..- attr(*, "predvars")= language list(y) .. .. ..- attr(*, "dataClasses")= Named chr "nmatrix.2" .. .. .. ..- attr(*, "names")= chr "y" $ call : language glmrob(formula = y ~ 1, family = "binomial") $ formula :Class 'formula' language y ~ 1 .. ..- attr(*, ".Environment")= $ terms :Classes 'terms', 'formula' language y ~ 1 .. ..- attr(*, "variables")= language list(y) .. ..- attr(*, "factors")= int(0) .. ..- attr(*, "term.labels")= chr(0) .. ..- attr(*, "order")= int(0) .. ..- attr(*, "intercept")= int 1 .. ..- attr(*, "response")= int 1 .. ..- attr(*, ".Environment")= .. ..- attr(*, "predvars")= language list(y) .. ..- attr(*, "dataClasses")= Named chr "nmatrix.2" .. .. ..- attr(*, "names")= chr "y" $ data : $ offset : NULL $ control :List of 4 ..$ acc : num 1e-04 ..$ test.acc: chr "coef" ..$ maxit : num 50 ..$ tcc : num 1.345 $ method : chr "Mqle" $ prior.weights : num [1:100] 1 1 1 1 1 1 1 1 1 1 ... $ contrasts : NULL $ xlevels : NULL - attr(*, "class")= chr [1:2] "glmrob" "glm" > > proc.time() user system elapsed 0.26 0.01 0.26