| parglm | R Documentation |
A function like glm which can make the computation
in parallel. The function supports most families listed in family.
See "vignette("parglm", "parglm")" for run time examples.
parglm(
formula,
family = gaussian,
data,
weights,
subset,
na.action,
start = NULL,
offset,
control = list(...),
contrasts = NULL,
model = TRUE,
x = FALSE,
y = TRUE,
...
)
parglm.fit(
x,
y,
weights = rep(1, NROW(x)),
start = NULL,
etastart = NULL,
mustart = NULL,
offset = rep(0, NROW(x)),
family = gaussian(),
control = list(),
intercept = TRUE,
...
)
formula |
an object of class |
family |
a |
data |
an optional data frame, list or environment containing the variables in the model. |
weights |
an optional vector of 'prior weights' to be used in the fitting process. Should
be |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
a function which indicates what should happen when the data contain |
start |
starting values for the parameters in the linear predictor. |
offset |
this can be used to specify an a priori known component to be included in the linear predictor during fitting. |
control |
a list of parameters for controlling the fitting process.
For parglm.fit this is passed to |
contrasts |
an optional list. See the |
model |
a logical value indicating whether model frame should be included as a component of the returned value. |
x, y |
For For |
... |
For For |
etastart |
starting values for the linear predictor. Not supported. |
mustart |
starting values for the vector of means. Not supported. |
intercept |
logical. Should an intercept be included in the null model? |
The current implementation uses min(as.integer(n / p), nthreads)
threads where n is the number of observations, p is the
number of covariates, and nthreads is the nthreads element of
the list
returned by parglm.control. Thus, there is likely little (if
any) reduction in computation time if p is almost equal to n.
The current implementation cannot handle p > n.
Since parglm returns a standard glm object, it is
compatible with the sandwich package for heteroskedasticity-consistent
(HC) and cluster-robust standard errors via vcovHC
and vcovCL. This requires model = TRUE
(the default). See vignette("sandwich", "parglm") for examples.
glm object as returned by glm but differs mainly by the qr
element. The qr element in the object returned by parglm(.fit) only has the R
matrix from the QR decomposition.
# mtcars has 32 rows, sufficient for 2 threads (>= 16 rows per thread)
f1 <- glm (mpg ~ wt + hp, data = mtcars, family = Gamma(link = "log"))
f2 <- parglm(mpg ~ wt + hp, data = mtcars, family = Gamma(link = "log"),
control = parglm.control(nthreads = 2L))
all.equal(coef(f1), coef(f2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.