In this article, we will show you how to use the power() function in R. The power() function can help you create the link object based on your link function. Let’s follow this article to learn more about it with the explanation and examples below.
What does power() do in R?
The power function can help you create the link object based on your link function. The power function only has one parameter, which is a real number. Walk through to the next title to learn about the syntax of this function.
Syntax:
power(lambda = 1)
Parameter:
- lambda: The default is 1. It is the real number.
After learning the usage and syntax of the power function in R, you will learn how to use it in the next title below.
How to use the power function in R?
The power() function in R can help you create the link object based on the link function. It is beneficial to help you work with mathematics in R.
Let’s see some examples below to learn how the power function operates.
Using the power function without the parameter
In this example, we will use the power function to create the link object with the default parameter which value is 1.
Look at the example below to see how it operates.
# Use the power() function without the parameter.
power()
Output
$linkfun
function (mu)
mu
<environment: namespace:stats>
$linkinv
function (eta)
eta
<environment: namespace:stats>
$mu.eta
function (eta)
rep.int(1, length(eta))
<environment: namespace:stats>
$valideta
function (eta)
TRUE
<environment: namespace:stats>
$name
[1] "identity"
attr(,"class")
[1] "link-glm"
Using the power function with a real number
In this example, we will use the power function to create the link object by assigning the parameter for it.
Look at the example below to see how it operates.
power(lambda = 47.22)
Output
$linkfun
function (mu)
mu^lambda
<bytecode: 0x000001b935de67f0>
<environment: 0x000001b933eb4e38>
$linkinv
function (eta)
pmax(eta^(1/lambda), .Machine$double.eps)
<bytecode: 0x000001b935de66a0>
<environment: 0x000001b933eb4e38>
$mu.eta
function (eta)
pmax((1/lambda) * eta^(1/lambda - 1), .Machine$double.eps)
<bytecode: 0x000001b935de6208>
<environment: 0x000001b933eb4e38>
$valideta
function (eta)
all(is.finite(eta)) && all(eta > 0)
<bytecode: 0x000001b935de5b08>
<environment: 0x000001b933eb4e38>
$name
[1] "mu^47.22"
attr(,"class")
[1] "link-glm"
Summary
You have learned about the usage, syntax, and how to use the power function in R. The power function can help you create the link object based on your link function. If you have any questions about this tutorial, leave your comment below, and I will answer your questions. We hope this tutorial is helpful to you. Thanks!
Maybe you are interested:
- fuzzy join in R: What fuzzy join in R is and how to perform it
- ave() Function in R
- min() and max() Function in R

My name is Thomas Valen. As a software developer, I am well-versed in programming languages. Don’t worry if you’re having trouble with the C, C++, Java, Python, JavaScript, or R programming languages. I’m here to assist you!
Name of the university: PTIT
Major: IT
Programming Languages: C, C++, Java, Python, JavaScript, R