inv function

Calculate the inverse of a number

Calculate the inverse of a number

This function returns the inverse of a numeric vector.

inv(x)

Arguments

  • x: A numeric vector

Returns

a numeric vector containing the inverse of x.

Details

This function is manly used when fitting statistical models. If one of the variables in a model is an inverse of a vector, the lm

function does not properly compute the variable, if 1/vector is inserted directly in the model, leading to the need of creating a separate variable. This function allows the user to get the inverse of a given numeric vector inside the model, without the need to create a new variable.

Examples

library(forestmangr) data("exfm15") head(exfm15) # Get the inverse of a vector inv(iris$Petal.Length) # Fit a model that contains the inverse of a variable, without the need to # create a new variable for the inverse: lm(log(TH) ~ inv(DBH), exfm15 ) # or lm_table(exfm15, log(TH) ~ inv(DBH) )

Author(s)

Sollano Rabelo Braga sollanorb@gmail.com

  • Maintainer: Sollano Rabelo Braga
  • License: MIT + file LICENSE
  • Last published: 2024-12-01