parglm.control: Auxiliary for Controlling GLM Fitting in Parallel

Description Usage Arguments Details Value References Examples

View source: R/parglm.R

Description

Auxiliary function for parglm fitting.

Usage

1
2
parglm.control(epsilon = 1e-08, maxit = 25, trace = FALSE,
  nthreads = 1L, block_size = NULL, method = "LINPACK")

Arguments

epsilon

positive convergence tolerance.

maxit

integer giving the maximal number of IWLS iterations.

trace

logical indicating if output should be produced doing estimation.

nthreads

number of cores to use. You may get the best performance by using your number of physical cores if your data set is sufficiently large. Using the number of physical CPUs/cores may yield the best performance (check your number e.g., by calling parallel::detectCores(logical = FALSE)).

block_size

number of observation to include in each parallel block.

method

string specifying which method to use. Either "LINPACK", "LAPACK", or "FAST".

Details

The LINPACK method uses the same QR method as glm.fit for the final QR decomposition. This is the dqrdc2 method described in qr. All other QR decompositions but the last are made with DGEQP3 from LAPACK. See Wood, Goude, and Shaw (2015) for details on the QR method.

The FAST method computes the Fisher information and then solves the normal equation. This is faster but less numerically stable.

Value

A list with components named as the arguments.

References

Wood, S.N., Goude, Y. & Shaw S. (2015) Generalized additive models for large datasets. Journal of the Royal Statistical Society, Series C 64(1): 139-155.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# use one core
clotting <- data.frame(
 u = c(5,10,15,20,30,40,60,80,100),
 lot1 = c(118,58,42,35,27,25,21,19,18),
 lot2 = c(69,35,26,21,18,16,13,12,12))
f1 <- parglm(lot1 ~ log(u), data = clotting, family = Gamma,
             control = parglm.control(nthreads = 1L))

# use two cores
f2 <- parglm(lot1 ~ log(u), data = clotting, family = Gamma,
             control = parglm.control(nthreads = 2L))
all.equal(coef(f1), coef(f2))

parglm documentation built on Oct. 14, 2021, 5:23 p.m.