Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

zs

Standardisation functions for models


Description

These functions are for use in fitting linear models (or allies) with scaled predictors, in such a way that when the fitted model objects are used for prediction (or visualisation) the same scaling parameters will be used with the new data.

Usage

zs(x)

zu(x)

zr(x)

zq(x)

Arguments

x

A numeric vector

Value

a standardised vector containing the parameters needed for use in prediction with new data

Examples

fm <- lm(Gas ~ Insul/zs(Temp), whiteside)
gm <- lm(Gas ~ Insul/zu(Temp), whiteside)
hm <- lm(Gas ~ Insul/Temp,     whiteside)
c(fm = unname(predict(fm, data.frame(Insul = "Before", Temp = 0.0))),
  gm = unname(predict(gm, data.frame(Insul = "Before", Temp = 0.0))),
  hm = unname(predict(hm, data.frame(Insul = "Before", Temp = 0.0))))
rm(fm, gm, hm)

MASSExtra

Some 'MASS' Enhancements

v1.1.2
GPL-2 | GPL-3
Authors
Bill Venables
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.