Description Usage Arguments Value Methods (by class) Examples
Evaluate (i.e., solve for the outcome) the supplied equation at the supplied values of the covariates
1 2 3 4 5 6 7 8 9 10 | evaluate_at(x, ...)
## S3 method for class 'eq'
evaluate_at(x, ...)
## S3 method for class 'eqs'
evaluate_at(x, ..., .outcome = NULL)
## S3 method for class 'eqs_bag'
evaluate_at(x, ..., .outcome = NULL)
|
x |
equation(s set/bag) object |
... |
sequence of named coefficients' values |
.outcome |
(chr, default NULL) an optional declaration of which outcome(s) the computation has to consider |
a one row tibble with one column each covariate supplied, one column for possible strata considered, one column with the outcome, one column with the value of the outcome that solve the equation when its the covariates assume the values supplied, and one last column with the name of the equation used
eq
: Evaluate (i.e., solve for the outcome) the
supplied equation at the supplied values of the covariates.
eqs
: Evaluate (i.e., solve for the outcome)
all the eq
uations in the eqs
object
at the supplied values of the covariates.
eqs_bag
: Evaluate (i.e., solve for the outcome)
all the eq
uations in all the possible
eqs
at the supplied values of the covariates.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | library(equationer)
eq_test <- eq(age = 0.1, bmi = -0.3,
name = "first eq_test",
outcome = "out"
)
eq2_test <- eq(age = 0.1, bmi = -0.3,
name = "first eq_test",
outcome = "out",
strata = list(sex = "female")
)
evaluate_at(eq_test, age = 38, bmi = 18)
evaluate_at(eq_test, age = 38, sex = 1, bmi = 18)
evaluate_at(eq2_test, age = 38, bmi = 18)
## Not run:
# ERRORS
evaluate_at(eq_test, age = 38, bmi = 18, sex = "female")
evaluate_at(eq_test, age = 38)
## End(Not run)
library(equationer)
eq_test <- eq(age = 0.5, bmi = -0.3,
name = "eq_test",
outcome = "kcal/day",
strata = list(sex = "female")
)
eq2_test <- eq(age = 0.3, bmi = -0.5,
name = "eq2_test",
outcome = "kcal/day",
strata = list(sex = "male")
)
eqs_test <- eqs(eq_test, eq2_test, name = "eqs-test")
evaluate_at(eqs_test, age = 38, bmi = 18, sex = "female")
evaluate_at(eqs_test, age = 38, bmi = 18, sex = "male")
## Not run:
# ERRORS
evaluate_at(eq_test, age = 38, bmi = 18, mellitus = "yes"))
evaluate_at(eqs_test, age = 38, bmi = 18, sex = "unknown")
evaluate_at(eq_test, age = 38)
## End(Not run)
eq1 <- eq(age = 0.3, bmi = -0.5,
name = "cl_test_1",
outcome = "kcal/day",
strata = list(sex = "male", nyha = 1)
)
eq2 <- eq(age = 0.5, bmi = -0.3, # change strata wrt eq1
name = "cl_test_2",
outcome = "kcal/day",
strata = list(sex = "female", nyha = 1)
)
eq3 <- eq(age = -0.3, bmi = 0.5,
name = "cl_test_3",
outcome = "kcal/day",
strata = list(sex = "male", nyha = 2)
)
eq4 <- eq(age = -0.5, bmi = 0.3,
name = "cl_test_4",
outcome = "kcal/day",
strata = list(sex = "female", nyha = 2)
)
eq9 <- eq(age = -0.1, weight = 0.2, # change var, strata
name = "cl_test_9",
outcome = "kcal/month",
strata = list(sex = "female")
)
eq10 <- eq(age = -0.2, weight = 0.1, # change var, strata
name = "cl_test_10",
outcome = "kcal/month",
strata = list(sex = "male")
)
eq11 <- eq(age = 0.1, weight = -0.2, # change var, strata
name = "cl_test_11",
outcome = "kcal/day",
strata = list(sex = "female")
)
eq12 <- eq(age = 0.2, weight = -0.2, # change var, strata
name = "cl_test_12",
outcome = "kcal/day",
strata = list(sex = "male")
)
eqs1 <- eqs(eq1, eq2, eq3, eq4,
name = "eqs1",
reference = "ref-a"
)
eqs2 <- eqs(eq9, eq10, eq11, eq12,
name = "eqs2",
reference = "ref-b"
)
eqs_bag_test <- eqs_bag(eqs1, eqs2,
name = "overall-bag",
reference = "equationer-test-bag"
)
evaluate_at(eqs_bag_test, age = 35)
evaluate_at(eqs_bag_test, age = 35, bmi = 18)
evaluate_at(eqs_bag_test, age = 35, bmi = 18, weight = 81)
evaluate_at(eqs_bag_test, age = 35, bmi = 18, sex = "female")
evaluate_at(eqs_bag_test, age = 35, bmi = 18, weight = 81, sex = "female")
evaluate_at(eqs_bag_test, age = 35, bmi = 18, weight = 81, nyha = 1)
evaluate_at(eqs_bag_test, age = 35, bmi = 18, weight = 81, .outcome = "kcal/day")
evaluate_at(eqs_bag_test, age = 35, bmi = 18, weight = 81, sex = "female", .outcome = "kcal/day")
one_patient <- dplyr::tribble(
~id, ~age, ~bmi, ~weight, ~sex,
1, 35, 18, 81, "female"
)
more_patients <- dplyr::tribble(
~id, ~age, ~bmi, ~weight, ~sex,
1, 35, 18, 81, "female",
2, 27, 20, 93, "male"
)
evaluate_at(eqs_bag_test, one_patient)
evaluate_at(eqs_bag_test, more_patients)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.