fracpoly | R Documentation |
fracpoly fits the best fitting fractional polynomial of degree 1 and 2.
fracpoly(y = y, x = x, covar = NULL, family = "gaussian")
y |
outcome. |
x |
exposure. |
covar |
data.frame with covariates. |
family |
the glm family (options: gaussian and binomial). |
List of best-fitting polynomials of degrees 1 and 2 as well as associated statistics.
power_d1 |
power of the best-fitting fractional polynomial of degree 1 |
fp1 |
model of the best-fitting fractional polynomial of degree 1 |
power_d2 |
powers of the best-fitting fractional polynomial of degree 2 |
fp2 |
model of the best-fitting fractional polynomial of degree 2 |
p_d1 |
p-value testing the best-fitting fractional polynomial of degree 1 against the linear model |
p_d2 |
p-value testing the best-fitting fractional polynomial of degree 2 against the best-fitting fractional polynomial of degree 2 |
xmin |
miniumum value of the exposure |
xmax |
maximum value of the exposure |
family |
family used in the analysis |
James Staley jrstaley95@gmail.com
# Data
y <- rnorm(5000)
x <- rnorm(5000, 10, 1)
c1 <- rbinom(5000, 1, 0.5)
c2 <- rnorm(5000)
study <- c(rep("study1", 1000), rep("study2", 1000), rep("study3", 1000), rep("study4", 1000), rep("study5", 1000))
covar <- data.frame(c1 = c1, c2 = c2, study = study)
# Analyses
res <- fracpoly(y = y, x = x, covar = covar, family = "gaussian")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.