robustbase: Interfaces for robustbase package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

Interfaces to robustbase functions that can be used in a pipeline implemented by magrittr.

Usage

1
2
3
4
5

Arguments

data

data frame, tibble, list, ...

...

Other arguments passed to the corresponding interfaced function.

Details

Interfaces call their corresponding interfaced function.

Value

Object returned by interfaced function.

Author(s)

Roberto Bertolusso

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
## Not run: 
library(intubate)
library(magrittr)
library(robustbase)


## ntbt_adjbox: Plot an Adjusted Boxplot for Skew Distributions
## Original function to interface
adjbox(len ~ dose, data = ToothGrowth)

## The interface puts data as first parameter
ntbt_adjbox(ToothGrowth, len ~ dose)

## so it can be used easily in a pipeline.
ToothGrowth %>%
  ntbt_adjbox(len ~ dose)


## ntbt_glmrob: Robust Fitting of Generalized Linear Models
data(carrots)

## Original function to interface
glmrob(cbind(success, total-success) ~ logdose + block,
       family = binomial, data = carrots, method= "Mqle",
       control= glmrobMqle.control(tcc=1.2))

## The interface puts data as first parameter
ntbt_glmrob(carrots, cbind(success, total-success) ~ logdose + block,
            family = binomial, method= "Mqle",
            control= glmrobMqle.control(tcc=1.2))

## so it can be used easily in a pipeline.
carrots %>%
  ntbt_glmrob(cbind(success, total-success) ~ logdose + block,
              family = binomial, method= "Mqle",
              control= glmrobMqle.control(tcc=1.2))


## ntbt_lmrob: MM-type Estimators for Linear Regression
data(coleman)

## Original function to interface
set.seed(0)
lmrob(Y ~ ., data = coleman, setting = "KS2011")

## The interface puts data as first parameter
ntbt_lmrob(coleman, Y ~ ., setting = "KS2011")

## so it can be used easily in a pipeline.
coleman %>%
  ntbt_lmrob(Y ~ ., setting = "KS2011")


## ntbt_ltsReg: Least Trimmed Squares Robust (High Breakdown) Regression
data(stackloss)

## Original function to interface
ltsReg(stack.loss ~ ., data = stackloss)

## The interface puts data as first parameter
ntbt_ltsReg(stackloss, stack.loss ~ .)

## so it can be used easily in a pipeline.
stackloss %>%
  ntbt_ltsReg(stack.loss ~ .)


## ntbt_nlrob: Robust Fitting of Nonlinear Regression Models
DNase1 <- DNase[ DNase$Run == 1, ]

## Original function to interface
nlrob(density ~ Asym/(1 + exp(( xmid - log(conc) )/scal ) ),
      data = DNase1, trace = TRUE,
      start = list( Asym = 3, xmid = 0, scal = 1 ))

## The interface puts data as first parameter
ntbt_nlrob(DNase1, density ~ Asym/(1 + exp(( xmid - log(conc) )/scal ) ),
           trace = TRUE,
           start = list( Asym = 3, xmid = 0, scal = 1 ))

## so it can be used easily in a pipeline.
DNase1 %>%
  ntbt_nlrob(density ~ Asym/(1 + exp(( xmid - log(conc) )/scal ) ),
             trace = TRUE,
             start = list( Asym = 3, xmid = 0, scal = 1 ))

## End(Not run)

Example output

$stats
      [,1]  [,2]  [,3]
[1,]  4.20 13.60 18.50
[2,]  7.15 16.00 23.45
[3,]  9.85 19.25 25.95
[4,] 13.00 23.45 28.35
[5,] 21.50 27.30 33.90

$n
[1] 20 20 20

$conf
          [,1]     [,2]     [,3]
[1,]  7.783202 16.61792 24.21884
[2,] 11.916798 21.88208 27.68116

$fence
          [,1]      [,2] [,3]
[1,]  2.461836  9.006864 16.1
[2,] 27.042045 39.332877 35.7

$out
numeric(0)

$group
numeric(0)

$names
[1] "0.5" "1"   "2"  

$stats
      [,1]  [,2]  [,3]
[1,]  4.20 13.60 18.50
[2,]  7.15 16.00 23.45
[3,]  9.85 19.25 25.95
[4,] 13.00 23.45 28.35
[5,] 21.50 27.30 33.90

$n
[1] 20 20 20

$conf
          [,1]     [,2]     [,3]
[1,]  7.783202 16.61792 24.21884
[2,] 11.916798 21.88208 27.68116

$fence
          [,1]      [,2] [,3]
[1,]  2.461836  9.006864 16.1
[2,] 27.042045 39.332877 35.7

$out
numeric(0)

$group
numeric(0)

$names
[1] "0.5" "1"   "2"  


Call:  glmrob(formula = cbind(success, total - success) ~ logdose +      block, family = binomial, data = carrots, method = "Mqle",      control = glmrobMqle.control(tcc = 1.2)) 

Coefficients:
(Intercept)      logdose      blockB2      blockB3  
     2.3883      -2.0491       0.2351      -0.4496  

Number of observations: 24 
Fitted by method  'Mqle' 

Call:  glmrob(formula = cbind(success, total - success) ~ logdose +      block, family = binomial, data = carrots, method = "Mqle",      control = glmrobMqle.control(tcc = 1.2)) 

Coefficients:
(Intercept)      logdose      blockB2      blockB3  
     2.3883      -2.0491       0.2351      -0.4496  

Number of observations: 24 
Fitted by method  'Mqle' 

Call:  glmrob(formula = cbind(success, total - success) ~ logdose +      block, family = binomial, data = ., method = "Mqle", control = glmrobMqle.control(tcc = 1.2)) 

Coefficients:
(Intercept)      logdose      blockB2      blockB3  
     2.3883      -2.0491       0.2351      -0.4496  

Number of observations: 24 
Fitted by method  'Mqle' 

Call:
lmrob(formula = Y ~ ., data = coleman, setting = "KS2011")
 \--> method = "SMDM"
Coefficients:
(Intercept)      salaryP     fatherWc      sstatus    teacherSc    motherLev  
   30.43635     -1.67840      0.08504      0.66706      1.17113     -4.13766  


Call:
lmrob(formula = Y ~ ., data = coleman, setting = "KS2011")
 \--> method = "SMDM"
Coefficients:
(Intercept)      salaryP     fatherWc      sstatus    teacherSc    motherLev  
   30.43635     -1.67840      0.08504      0.66706      1.17113     -4.13766  


Call:
lmrob(formula = Y ~ ., data = ., setting = "KS2011")
 \--> method = "SMDM"
Coefficients:
(Intercept)      salaryP     fatherWc      sstatus    teacherSc    motherLev  
   30.43635     -1.67840      0.08504      0.66706      1.17113     -4.13766  


Call:
ltsReg.formula(formula = stack.loss ~ ., data = stackloss)

Coefficients:
 Intercept    Air.Flow  Water.Temp  Acid.Conc.  
 -37.65246     0.79769     0.57734    -0.06706  

Scale estimate 1.922 


Call:
ltsReg.formula(formula = stack.loss ~ ., data = stackloss)

Coefficients:
 Intercept    Air.Flow  Water.Temp  Acid.Conc.  
 -37.65246     0.79769     0.57734    -0.06706  

Scale estimate 1.922 


Call:
ltsReg.formula(formula = stack.loss ~ ., data = .)

Coefficients:
 Intercept    Air.Flow  Water.Temp  Acid.Conc.  
 -37.65246     0.79769     0.57734    -0.06706  

Scale estimate 1.922 

robust iteration 1 
14.32279 :  3 0 1
0.4542698 :  2.1152456 0.8410193 1.2000640
0.05869602 :  2.446376 1.747516 1.189515
0.005663523 :  2.294087 1.412198 1.020463
0.004791528 :  2.341429 1.479688 1.040758
0.004789569 :  2.345135 1.483047 1.041439
0.004789569 :  2.345179 1.483089 1.041454
 --> irls.delta(previous, resid) = 0.999803 -- *not* converged
robust iteration 2 
0.003971483 :  2.345179 1.483089 1.041454
0.003954569 :  2.356445 1.495544 1.043788
0.003954564 :  2.356586 1.495650 1.043815
 --> irls.delta(previous, resid) = 0.0614627 -- *not* converged
robust iteration 3 
0.003934724 :  2.356586 1.495650 1.043815
0.00393411 :  2.358633 1.498205 1.044647
0.00393411 :  2.358657 1.498229 1.044655
 --> irls.delta(previous, resid) = 0.0121515 -- *not* converged
robust iteration 4 
0.003930685 :  2.358657 1.498229 1.044655
0.00393062 :  2.359307 1.499046 1.044928
0.00393062 :  2.359314 1.499053 1.044931
 --> irls.delta(previous, resid) = 0.00395064 -- *not* converged
robust iteration 5 
0.00392958 :  2.359314 1.499053 1.044931
0.003929573 :  2.359525 1.499320 1.045020
 --> irls.delta(previous, resid) = 0.00128452 -- *not* converged
robust iteration 6 
0.003929244 :  2.359525 1.499320 1.045020
0.003929244 :  2.359596 1.499409 1.045050
 --> irls.delta(previous, resid) = 0.000422973 -- *not* converged
robust iteration 7 
0.003929132 :  2.359596 1.499409 1.045050
0.003929132 :  2.359620 1.499438 1.045060
 --> irls.delta(previous, resid) = 0.000139345 -- *not* converged
robust iteration 8 
0.003929095 :  2.359620 1.499438 1.045060
0.003929095 :  2.359628 1.499448 1.045063
 --> irls.delta(previous, resid) = 4.5846e-05 -- *not* converged
robust iteration 9 
0.003929083 :  2.359628 1.499448 1.045063
0.003929083 :  2.359630 1.499451 1.045064
 --> irls.delta(previous, resid) = 1.51503e-05 -- *not* converged
robust iteration 10 
0.003929079 :  2.359630 1.499451 1.045064
Robustly fitted nonlinear regression model
  model:  density ~ Asym/(1 + exp((xmid - log(conc))/scal)) 
   data:  DNase1 
    Asym     xmid     scal 
2.359630 1.499451 1.045064 
 status:  converged 
robust iteration 1 
14.32279 :  3 0 1
0.4542698 :  2.1152456 0.8410193 1.2000640
0.05869602 :  2.446376 1.747516 1.189515
0.005663523 :  2.294087 1.412198 1.020463
0.004791528 :  2.341429 1.479688 1.040758
0.004789569 :  2.345135 1.483047 1.041439
0.004789569 :  2.345179 1.483089 1.041454
 --> irls.delta(previous, resid) = 0.999803 -- *not* converged
robust iteration 2 
0.003971483 :  2.345179 1.483089 1.041454
0.003954569 :  2.356445 1.495544 1.043788
0.003954564 :  2.356586 1.495650 1.043815
 --> irls.delta(previous, resid) = 0.0614627 -- *not* converged
robust iteration 3 
0.003934724 :  2.356586 1.495650 1.043815
0.00393411 :  2.358633 1.498205 1.044647
0.00393411 :  2.358657 1.498229 1.044655
 --> irls.delta(previous, resid) = 0.0121515 -- *not* converged
robust iteration 4 
0.003930685 :  2.358657 1.498229 1.044655
0.00393062 :  2.359307 1.499046 1.044928
0.00393062 :  2.359314 1.499053 1.044931
 --> irls.delta(previous, resid) = 0.00395064 -- *not* converged
robust iteration 5 
0.00392958 :  2.359314 1.499053 1.044931
0.003929573 :  2.359525 1.499320 1.045020
 --> irls.delta(previous, resid) = 0.00128452 -- *not* converged
robust iteration 6 
0.003929244 :  2.359525 1.499320 1.045020
0.003929244 :  2.359596 1.499409 1.045050
 --> irls.delta(previous, resid) = 0.000422973 -- *not* converged
robust iteration 7 
0.003929132 :  2.359596 1.499409 1.045050
0.003929132 :  2.359620 1.499438 1.045060
 --> irls.delta(previous, resid) = 0.000139375 -- *not* converged
robust iteration 8 
0.003929095 :  2.359620 1.499438 1.045060
0.003929095 :  2.359628 1.499448 1.045063
 --> irls.delta(previous, resid) = 4.58912e-05 -- *not* converged
robust iteration 9 
0.003929083 :  2.359628 1.499448 1.045063
0.003929083 :  2.359630 1.499451 1.045064
 --> irls.delta(previous, resid) = 1.50981e-05 -- *not* converged
robust iteration 10 
0.003929079 :  2.359630 1.499451 1.045064
Robustly fitted nonlinear regression model
  model:  density ~ Asym/(1 + exp((xmid - log(conc))/scal)) 
   data:  DNase1 
    Asym     xmid     scal 
2.359630 1.499451 1.045064 
 status:  converged 
robust iteration 1 
14.32279 :  3 0 1
0.4542698 :  2.1152456 0.8410193 1.2000640
0.05869602 :  2.446376 1.747516 1.189515
0.005663523 :  2.294087 1.412198 1.020463
0.004791528 :  2.341429 1.479688 1.040758
0.004789569 :  2.345135 1.483047 1.041439
0.004789569 :  2.345179 1.483089 1.041454
 --> irls.delta(previous, resid) = 0.999803 -- *not* converged
robust iteration 2 
0.003971483 :  2.345179 1.483089 1.041454
0.003954569 :  2.356445 1.495544 1.043788
0.003954564 :  2.356586 1.495650 1.043815
 --> irls.delta(previous, resid) = 0.0614627 -- *not* converged
robust iteration 3 
0.003934724 :  2.356586 1.495650 1.043815
0.00393411 :  2.358633 1.498205 1.044647
0.00393411 :  2.358657 1.498229 1.044655
 --> irls.delta(previous, resid) = 0.0121515 -- *not* converged
robust iteration 4 
0.003930685 :  2.358657 1.498229 1.044655
0.00393062 :  2.359307 1.499046 1.044928
0.00393062 :  2.359314 1.499053 1.044931
 --> irls.delta(previous, resid) = 0.00395064 -- *not* converged
robust iteration 5 
0.00392958 :  2.359314 1.499053 1.044931
0.003929573 :  2.359525 1.499320 1.045020
 --> irls.delta(previous, resid) = 0.00128452 -- *not* converged
robust iteration 6 
0.003929244 :  2.359525 1.499320 1.045020
0.003929244 :  2.359596 1.499409 1.045050
 --> irls.delta(previous, resid) = 0.000422973 -- *not* converged
robust iteration 7 
0.003929132 :  2.359596 1.499409 1.045050
0.003929132 :  2.359620 1.499438 1.045060
 --> irls.delta(previous, resid) = 0.000139375 -- *not* converged
robust iteration 8 
0.003929095 :  2.359620 1.499438 1.045060
0.003929095 :  2.359628 1.499448 1.045063
 --> irls.delta(previous, resid) = 4.58912e-05 -- *not* converged
robust iteration 9 
0.003929083 :  2.359628 1.499448 1.045063
0.003929083 :  2.359630 1.499451 1.045064
 --> irls.delta(previous, resid) = 1.50981e-05 -- *not* converged
robust iteration 10 
0.003929079 :  2.359630 1.499451 1.045064
Robustly fitted nonlinear regression model
  model:  density ~ Asym/(1 + exp((xmid - log(conc))/scal)) 
   data:  . 
    Asym     xmid     scal 
2.359630 1.499451 1.045064 
 status:  converged 

intubate documentation built on May 2, 2019, 2:46 p.m.