Does R's glm function use randomness?

Does R's glm function use randomness in any way? Exercise 8(d) in chapter 5 (section 5.4) of An Introduction to Statistical Learning (a free book) seems to indicate that it does because it has the reader change the random seed and fit a new model (with the same data).

Remark: I'm not using (and don't use) R, so I couldn't test it.

• Per the documentation [1], it uses iteratively reweighted least squares (IWLS) to fit the model -- might be a place to start. [1]: stat.ethz.ch/R-manual/R-devel/library/stats/html/glm.html
– dlid
May 11 '21 at 21:26
• Thanks @dlid. Looks like the only place where there could be any randomness is in the initial "guess" of the approximation algorithm (as in Newton's method). R has a separate IWLS function and its documentation indicates that its implementation is from a research paper, "page 46 of Suveges (2007)". I checked that out and didn't see any obvious randomness there either. (I might've missed it.) May 11 '21 at 22:26
• Try running it twice with the same inputs and see if the outputs are identical.
– Ben
May 12 '21 at 2:11
• Thanks @Ben. That's what I meant I cannot do when I said "I couldn't test it." May 12 '21 at 18:51

There is no randomness in the fitting algorithm or in the initialisation for the built-in link and family. glm accepts user-defined link/family combinations and these could in principle use randomness.