Learn R Programming

glmtoolbox (version 0.1.12)

FisherScoring: Fisher Scoring algorithm in Generalized Linear Models

Description

This function displays the entire path performed by the Fisher Scoring algorithm for parameter estimation in Generalized Linear Models. It starts with the starting value until convergence is achieved or the maximum number of iterations is exceeded.

Usage

FisherScoring(object, verbose = TRUE, digits = max(3, getOption("digits") - 2))

Value

a matrix whose first three columns are the following

Iterationthe iteration number,
Deviancevalue of the (unscaled) deviance computed using the current value of the parameter vector,
Tolerancevalue of \(|deviance-deviance_{old}|/(deviance_{old} + 0.1)\),

Arguments

object

one object of the class glm.

verbose

an (optional) logical indicating if should the report of results be printed. As default, verbose is set to TRUE.

digits

an (optional) integer value indicating the number of decimal places to be used. As default, digits is set to max(3, getOption("digits") - 2).

Examples

Run this code
###### Example 1: Fuel efficiency of cars
Auto <- ISLR::Auto
fit1 <- glm(mpg ~ horsepower + weight + horsepower*weight, family=Gamma(inverse), data=Auto,
            control=list(trace=TRUE))
FisherScoring(fit1)

###### Example 2: Hill races in Scotland
data(races)
fit2 <- glm(rtime ~ log(distance) + cclimb, family=Gamma(log), data=races,
            control=list(trace=TRUE))
FisherScoring(fit2)

###### Example 3:
burn1000 <- aplore3::burn1000
burn1000 <- within(burn1000, death <- factor(death, levels=c("Dead","Alive")))
fit3 <- glm(death ~ age*inh_inj + tbsa*inh_inj, family=binomial("logit"), data=burn1000,
            control=list(trace=TRUE))
FisherScoring(fit3)

###### Example 4: Skin cancer in women
data(skincancer)
fit4 <- glm(cases ~ offset(log(population)) + city + age, family=poisson, data=skincancer,
            control=list(trace=TRUE))
FisherScoring(fit4)

###### Example 5: Agents to stimulate cellular differentiation
data(cellular)
fit5 <- glm(cbind(cells,200-cells) ~ tnf + ifn, family=binomial(logit), data=cellular,
            control=list(trace=TRUE))
FisherScoring(fit5)

###### Example 6: Advertising
data(advertising)
fit6 <- glm(sales ~ log(TV) + radio + log(TV)*radio, family=gaussian(log), data=advertising,
            control=list(trace=TRUE))
FisherScoring(fit6)

Run the code above in your browser using DataLab