init_weight: Reweighting functions that comprise an IRLS iteration

Description Usage Arguments Details Value See Also Examples

View source: R/oomglm.R

Description

Reweighting functions that comprise an IRLS iteration

Usage

1
2
3
4
5
init_weight(object)

weight(object, data)

end_weight(object, tolerance = 1e-08)

Arguments

object

oomglm model.

data

an optional oomdata_tbl, oomdata_dbi, oomdata_con, tibble, data.frame, or list of observations to fit

tolerance

Tolerance used to determine convergence. Represents change in coefficient as a multiple of standard error.

Details

The IRLS process comprises iterative calls to init_weight(), weight() and end_weight() which can be managed via a single call to fit().

These comprising functions are exposed for lower level control of the fitting process.

Value

oomglm model

See Also

fit(), oomglm()

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
# initiate `oomglm` model and `oomdata_tbl`
x <- oomglm(mpg ~ cyl + disp)
chunks <- oomdata_tbl(mtcars, chunk_size = 10)

# manually perform one round of IRLS and check results
x <- init_weight(x)
x <- weight(x, data = chunks)
x <- end_weight(x)

print(x$converged)
print(coef(x))

# manually perform an additional round of IRLS
x <- init_weight(x)
x <- weight(x, data = chunks)
x <- end_weight(x)

print(x$converged)
print(coef(x))

# the IRLS process as implemented by `fit()`
# is similar to the following
x <- oomglm(mpg ~ cyl + disp)
chunks <- oomdata_tbl(mtcars, chunk_size = 10)

while(!x$converged) {
  
  x <- init_weight(x)
  x <- weight(x, data = chunks)
  x <- end_weight(x) 
  
}

tidy(x)

blakeboswell/ploom documentation built on May 25, 2019, 3:24 p.m.