find_best_fp_powers: Returns the powers of the GLM fitted model which has the...

View source: R/fractional_polynomial_models.R

find_best_fp_powersR Documentation

Returns the powers of the GLM fitted model which has the lowest deviance score.

Description

Refers to section 6.2.

Usage

find_best_fp_powers(age, pos, tot, p, mc, degree, link = "logit")

Arguments

age

the age vector.

pos

the pos vector.

tot

the tot vector.

p

a powers sequence.

mc

indicates if the returned model should be monotonic.

degree

the degree of the model. Recommended to be <= 2.

link

the link function. Defaulted to "logit".

Value

list of 3 elements:

p

The best power for fp model.

deviance

Deviance of the best fitted model.

model

The best model fitted

Examples

df <- hav_be_1993_1994
best_p <- find_best_fp_powers(
df$age, df$pos, df$tot,
p=seq(-2,3,0.1), mc=FALSE, degree=2, link="cloglog"
)
best_p


serosv documentation built on Oct. 18, 2024, 5:07 p.m.