Learn R Programming

profileModel (version 0.5-7)

scaleFit: Scales the estimates of a fitted in scale-invariant fits.

Description

Scales the estimates of a fitted object. Each column of the model matrix is divided by the maximum absolute value of the column and the model is re-fitted using the new model matrix.

Usage

scaleFit(fitted)

Arguments

fitted
a glm-like fitted object with linear predictor that supports the method model.matrix.

Value

  • An object of the same class as fitted.

Side Effects

Causes creation of the matrix .the.scaled. and the vector .the.offs. in the global environment if they do not already exist, otherwise their values are updated. This is done in order to ensure that the fitting procedure that resulted fitted will find these quantities.

Details

scale.fit should only be used when the inferences using the model that fitted corresponds to, are invariant on the scale of the parameters (e.g. a GLM). In other words, scaleFit should only affect the estimated parameters and not the fit and the inferences made.

Examples

Run this code
## Begin Example
y <- rpois(100,1)
x <- rnorm(100,0,0.2)*1e+6
m1 <- glm(y ~ -1 + x, family = poisson)
m2 <- scaleFit(m1)
## m1 and m2 are the same fits but on a different scale
sum(abs(m1$fitted-m2$fitted))
## End Example

Run the code above in your browser using DataLab