trcoef: Transform coefficients

View source: R/emdbook.R

trcoefR Documentation

Transform coefficients

Description

Perform standard transformations of coefficients based on information encoded in the names or the transf attribute of the vector or list

Usage

trcoef(x, inverse = FALSE)

Arguments

x

A numeric vector of coefficients with names and/or a transf attribute

inverse

(logical) Perform inverse transform?

Details

If inverse=FALSE and coefficient names begin with "logit", "log", or "sqrt" the function will back-transform them (using plogis, exp, or squaring), strip the descriptor from the names, and set the transf attribute. Naturally, inverse=TRUE will do the opposite. If the transf attribute is all empty strings after an inverse transformation, it will be deleted.

Value

A vector of transformed variables with modified names and transf attributes.

Author(s)

Ben Bolker

Examples

x = c(loga=1,logitb=2,sqrtc=2)
trx = trcoef(x); trx
trcoef(trx,inverse=TRUE)

emdbook documentation built on July 9, 2023, 6:33 p.m.

Related to trcoef in emdbook...