View source: R/PolyMRDataSim_polynomial_function.R
get_polynomial_function | R Documentation |
This function factory is intended for use with the PolyMRDataSim class. It simplifies the creation of polynomial functions based on its coefficients.
get_polynomial_function(polynomial_coefficients = c(0.1))
polynomial_coefficients |
A vector of coefficients for the polynomial terms, in ascending order of degree (default is c(0.1)). The length of the vector determines the degree of the resulting polynomial. |
A polynomial function with the corresponding coefficients.
cubic_polynomial <- get_polynomial_function(c(0.5, 0, 2))
some_values <- rnorm(100)
all(cubic_polynomial(some_values) == 0.5*some_values + 2*some_values^3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.