FisherScoring: Fisher Scoring algorithm in Generalized Linear Models

View source: R/glms.R

FisherScoringR Documentation

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 = 10)

Arguments

object

one object of the class glm.

verbose

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

digits

an (optional) integer value indicating the number of decimal places to be used. By default, digits is set to be 10.

Value

a matrix whose first three columns are the following

Iteration the iteration number,
Deviance value of the (unscaled) deviance computed using the current value of the parameter vector,
Tolerance value of |deviance-deviance_{old}|/(deviance_{old} + 0.1),

Examples

###### 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)


glmtoolbox documentation built on Oct. 10, 2023, 9:06 a.m.