diff --git a/book/articles/reference/comparisons.qmd b/book/articles/reference/comparisons.qmd index 820eb1624..fee1a9c0f 100644 --- a/book/articles/reference/comparisons.qmd +++ b/book/articles/reference/comparisons.qmd @@ -770,19 +770,19 @@ posterior using the function supplied to the ## Equivalence, Inferiority, Superiority -
\theta
is an estimate, \sigma_\theta
its estimated standard error, and [a, b]
are the bounds of the interval supplied to the equivalence
argument.
+
$\theta$ is an estimate, $\sigma_\theta$ its estimated standard error, and $[a, b]$ are the bounds of the interval supplied to the equivalence
argument.
Non-inferiority:
H_0
: \theta \leq a
+
$H_0$: $\theta \leq a$
H_1
: \theta > a
+
$H_1$: $\theta > a$
t=(\theta - a)/\sigma_\theta
+
$t=(\theta - a)/\sigma_\theta$
p: Upper-tail probability @@ -793,13 +793,13 @@ posterior using the function supplied to the
H_0
: \theta \geq b
+
$H_0$: $\theta \geq b$
H_1
: \theta < b
+
$H_1$: $\theta < b$
t=(\theta - b)/\sigma_\theta
+
$t=(\theta - b)/\sigma_\theta$
p: Lower-tail probability @@ -844,7 +844,7 @@ posterior using the function supplied to the ## Examples -```{r} +```{r, warning=FALSE, message=FALSE} library(marginaleffects) library(marginaleffects) diff --git a/book/articles/reference/datagrid.qmd b/book/articles/reference/datagrid.qmd index ea67e9920..6667eb7bb 100644 --- a/book/articles/reference/datagrid.qmd +++ b/book/articles/reference/datagrid.qmd @@ -135,7 +135,7 @@ explicitly defined are held at their mean or mode. ## Examples -```{r} +```{r, warning=FALSE, message=FALSE} library(marginaleffects) # The output only has 2 rows, and all the variables except `hp` are at their diff --git a/book/articles/reference/hypotheses.qmd b/book/articles/reference/hypotheses.qmd index 5091728fb..8b26771c6 100644 --- a/book/articles/reference/hypotheses.qmd +++ b/book/articles/reference/hypotheses.qmd @@ -250,19 +250,19 @@ For the Chi-squared test, the degrees of freedom are Q. ## Equivalence, Inferiority, Superiority -
\theta
is an estimate, \sigma_\theta
its estimated standard error, and [a, b]
are the bounds of the interval supplied to the equivalence
argument.
+
$\theta$ is an estimate, $\sigma_\theta$ its estimated standard error, and $[a, b]$ are the bounds of the interval supplied to the equivalence
argument.
Non-inferiority:
H_0
: \theta \leq a
+
$H_0$: $\theta \leq a$
H_1
: \theta > a
+
$H_1$: $\theta > a$
t=(\theta - a)/\sigma_\theta
+
$t=(\theta - a)/\sigma_\theta$
p: Upper-tail probability @@ -273,13 +273,13 @@ For the Chi-squared test, the degrees of freedom are Q.
H_0
: \theta \geq b
+
$H_0$: $\theta \geq b$
H_1
: \theta < b
+
$H_1$: $\theta < b$
t=(\theta - b)/\sigma_\theta
+
$t=(\theta - b)/\sigma_\theta$
p: Lower-tail probability @@ -299,7 +299,7 @@ For the Chi-squared test, the degrees of freedom are Q. ## Examples -```{r} +```{r, warning=FALSE, message=FALSE} library(marginaleffects) library(marginaleffects) diff --git a/book/articles/reference/inferences.qmd b/book/articles/reference/inferences.qmd index 9e6c8642b..8c8df0f73 100644 --- a/book/articles/reference/inferences.qmd +++ b/book/articles/reference/inferences.qmd @@ -168,7 +168,7 @@ ## Examples -```{r} +```{r, warning=FALSE, message=FALSE} library(marginaleffects) library(marginaleffects) diff --git a/book/articles/reference/marginal_means.qmd b/book/articles/reference/marginal_means.qmd index 9f27ff15f..eb2ea1875 100644 --- a/book/articles/reference/marginal_means.qmd +++ b/book/articles/reference/marginal_means.qmd @@ -431,19 +431,19 @@ posterior using the function supplied to the ## Equivalence, Inferiority, Superiority -
\theta
is an estimate, \sigma_\theta
its estimated standard error, and [a, b]
are the bounds of the interval supplied to the equivalence
argument.
+
$\theta$ is an estimate, $\sigma_\theta$ its estimated standard error, and $[a, b]$ are the bounds of the interval supplied to the equivalence
argument.
Non-inferiority:
H_0
: \theta \leq a
+
$H_0$: $\theta \leq a$
H_1
: \theta > a
+
$H_1$: $\theta > a$
t=(\theta - a)/\sigma_\theta
+
$t=(\theta - a)/\sigma_\theta$
p: Upper-tail probability @@ -454,13 +454,13 @@ posterior using the function supplied to the
H_0
: \theta \geq b
+
$H_0$: $\theta \geq b$
H_1
: \theta < b
+
$H_1$: $\theta < b$
t=(\theta - b)/\sigma_\theta
+
$t=(\theta - b)/\sigma_\theta$
p: Lower-tail probability @@ -505,7 +505,7 @@ posterior using the function supplied to the ## Examples -```{r} +```{r, warning=FALSE, message=FALSE} library(marginaleffects) library(marginaleffects) diff --git a/book/articles/reference/plot_comparisons.qmd b/book/articles/reference/plot_comparisons.qmd index 16e289a98..e41766791 100644 --- a/book/articles/reference/plot_comparisons.qmd +++ b/book/articles/reference/plot_comparisons.qmd @@ -315,7 +315,7 @@ the table below. ## Examples -```{r} +```{r, warning=FALSE, message=FALSE} library(marginaleffects) mod <- lm(mpg ~ hp * drat * factor(am), data = mtcars) diff --git a/book/articles/reference/plot_predictions.qmd b/book/articles/reference/plot_predictions.qmd index 8b7bf2fe6..43e74afbb 100644 --- a/book/articles/reference/plot_predictions.qmd +++ b/book/articles/reference/plot_predictions.qmd @@ -275,7 +275,7 @@ the table below. ## Examples -```{r} +```{r, warning=FALSE, message=FALSE} library(marginaleffects) mod <- lm(mpg ~ hp + wt, data = mtcars) diff --git a/book/articles/reference/plot_slopes.qmd b/book/articles/reference/plot_slopes.qmd index e2968a367..6cfb11a68 100644 --- a/book/articles/reference/plot_slopes.qmd +++ b/book/articles/reference/plot_slopes.qmd @@ -304,7 +304,7 @@ the table below. ## Examples -```{r} +```{r, warning=FALSE, message=FALSE} library(marginaleffects) library(marginaleffects) diff --git a/book/articles/reference/predictions.qmd b/book/articles/reference/predictions.qmd index 623b190f5..05a285bde 100644 --- a/book/articles/reference/predictions.qmd +++ b/book/articles/reference/predictions.qmd @@ -574,19 +574,19 @@ posterior using the function supplied to the ## Equivalence, Inferiority, Superiority -
\theta
is an estimate, \sigma_\theta
its estimated standard error, and [a, b]
are the bounds of the interval supplied to the equivalence
argument.
+
$\theta$ is an estimate, $\sigma_\theta$ its estimated standard error, and $[a, b]$ are the bounds of the interval supplied to the equivalence
argument.
Non-inferiority:
H_0
: \theta \leq a
+
$H_0$: $\theta \leq a$
H_1
: \theta > a
+
$H_1$: $\theta > a$
t=(\theta - a)/\sigma_\theta
+
$t=(\theta - a)/\sigma_\theta$
p: Upper-tail probability @@ -597,13 +597,13 @@ posterior using the function supplied to the
H_0
: \theta \geq b
+
$H_0$: $\theta \geq b$
H_1
: \theta < b
+
$H_1$: $\theta < b$
t=(\theta - b)/\sigma_\theta
+
$t=(\theta - b)/\sigma_\theta$
p: Lower-tail probability @@ -648,7 +648,7 @@ posterior using the function supplied to the ## Examples -```{r} +```{r, warning=FALSE, message=FALSE} library(marginaleffects) # Adjusted Prediction for every row of the original dataset diff --git a/book/articles/reference/slopes.qmd b/book/articles/reference/slopes.qmd index 5f1f9fb1a..e61533842 100644 --- a/book/articles/reference/slopes.qmd +++ b/book/articles/reference/slopes.qmd @@ -375,9 +375,9 @@ including non-linear models with transformations (e.g., polynomials). Uncertainty estimates are computed using the delta method.
Numerical derivatives for the slopes
function are calculated
-using a simple epsilon difference approach: \partial Y / \partial X = (f(X + \varepsilon/2) - f(X-\varepsilon/2)) / \varepsilon
,
+using a simple epsilon difference approach: $\partial Y / \partial X = (f(X + \varepsilon/2) - f(X-\varepsilon/2)) / \varepsilon$,
where f is the predict()
method associated with the model class, and
-\varepsilon
is determined by the eps
argument.
+$\varepsilon$ is determined by the eps
argument.
\theta
is an estimate, \sigma_\theta
its estimated standard error, and [a, b]
are the bounds of the interval supplied to the equivalence
argument.
+
$\theta$ is an estimate, $\sigma_\theta$ its estimated standard error, and $[a, b]$ are the bounds of the interval supplied to the equivalence
argument.
Non-inferiority:
H_0
: \theta \leq a
+
$H_0$: $\theta \leq a$
H_1
: \theta > a
+
$H_1$: $\theta > a$
t=(\theta - a)/\sigma_\theta
+
$t=(\theta - a)/\sigma_\theta$
p: Upper-tail probability @@ -579,13 +579,13 @@ posterior using the function supplied to the
H_0
: \theta \geq b
+
$H_0$: $\theta \geq b$
H_1
: \theta < b
+
$H_1$: $\theta < b$
t=(\theta - b)/\sigma_\theta
+
$t=(\theta - b)/\sigma_\theta$
p: Lower-tail probability
@@ -630,7 +630,7 @@ posterior using the function supplied to the
## Examples
-```{r}
+```{r, warning=FALSE, message=FALSE}
library(marginaleffects)
diff --git a/book/utils/utils.R b/book/utils/utils.R
index 7ad5012c9..3578ca138 100644
--- a/book/utils/utils.R
+++ b/book/utils/utils.R
@@ -85,7 +85,6 @@ rd2qmd = function(src) {
# superfluous header and footer
tmp = readLines(tmp_html)
- tmp = gsub("\\eqn\\{.*\\}\\{.*\\}", "\\$\\1\\$", tmp)
tmp = tmp[(grep("$", tmp)[1] + 1):length(tmp)]
tmp = tmp[seq_len(which("" == tmp) - 3)]
@@ -107,9 +106,20 @@ rd2qmd = function(src) {
ex = gsub(">", ">", ex)
ex = ex[!grepl("## Not run:", ex)]
ex = ex[!grepl("## End", ex)]
- tmp = c(tmp[2:idx], "```{r}", "library(marginaleffects)", ex, "```")
+ tmp = c(tmp[2:idx], "```{r, warning=FALSE, message=FALSE}", "library(marginaleffects)", ex, "```")
}
+ # cleanup equations
+ tmp <- gsub(
+ '(.*?)>(.*?)
',
+ '\\1>\\2
',
+ tmp)
+ tmp <- gsub(
+ '(.*?)<(.*?)
',
+ '\\1<\\2
',
+ tmp)
+ tmp <- gsub('(.*?)
', '\\$\\1\\$', tmp)
+
# title
funname = tools::file_path_sans_ext(basename(src))
if (!is.null(title)) {