inv | R Documentation |
This function returns the inverse of a numeric vector.
inv(x)
x |
A numeric vector |
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.
a numeric vector containing the inverse of x
.
Sollano Rabelo Braga sollanorb@gmail.com
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) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.