Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error in vignette #319

Merged
merged 9 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions vignettes/parameters.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
data("qol_cancer")

set.seed(12345)
sleepstudy$grp <- sample(1:5, size = 180, replace = TRUE)

Check warning on line 77 in vignettes/parameters.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=vignettes/parameters.Rmd,line=77,col=19,[sample_int_linter] sample.int(n, m, ...) is preferable to sample(1:n, m, ...).

theme_set(theme_modern())
```
Expand Down Expand Up @@ -234,14 +234,14 @@
# We download the model to save computation time. Here is the code
# to refit the exact model used below...

# zinb <- read.csv("http://stats.idre.ucla.edu/stat/data/fish.csv")

Check warning on line 237 in vignettes/parameters.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=vignettes/parameters.Rmd,line=237,col=3,[commented_code_linter] Remove commented code.
# set.seed(123)

Check warning on line 238 in vignettes/parameters.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=vignettes/parameters.Rmd,line=238,col=3,[commented_code_linter] Remove commented code.
# model <- brm(bf(
# count ~ persons + child + camper + (1 | persons),

Check warning on line 240 in vignettes/parameters.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=vignettes/parameters.Rmd,line=240,col=7,[commented_code_linter] Remove commented code.
# zi ~ child + camper + (1 | persons)

Check warning on line 241 in vignettes/parameters.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=vignettes/parameters.Rmd,line=241,col=7,[commented_code_linter] Remove commented code.
# ),
# data = zinb,

Check warning on line 243 in vignettes/parameters.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=vignettes/parameters.Rmd,line=243,col=5,[commented_code_linter] Remove commented code.
# family = zero_inflated_poisson()

Check warning on line 244 in vignettes/parameters.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=vignettes/parameters.Rmd,line=244,col=5,[commented_code_linter] Remove commented code.
# )
brms_model <- insight::download_model("brms_zi_2")
result <- model_parameters(
Expand Down Expand Up @@ -281,7 +281,7 @@
## Model Parameters of Meta-Analysis models

```{r}
mydat <- data.frame(
mydat <<- data.frame(
effectsize = c(-0.393, 0.675, 0.282, -1.398),
standarderror = c(0.317, 0.317, 0.13, 0.36)
)
Expand Down Expand Up @@ -323,7 +323,8 @@
)
dat$author <- make.unique(dat$author)
dat$disease <- sample(c("Cancer", "CVD", "Depression"), size = nrow(dat), replace = TRUE)
model <- rma(yi, vi, mods = ~disease, data = dat, digits = 3, slab = author)
mydat <<- dat
model <- rma(yi, vi, mods = ~disease, data = mydat, digits = 3, slab = author)
result <- model_parameters(model)

result
Expand Down Expand Up @@ -413,16 +414,6 @@
plot(result)
```

### From simulated model parameters

```{r fig.height=8}
simulated_parameters <- simulate_model(model1, component = "conditional")
result <- equivalence_test(simulated_parameters)
result

plot(result)
```

## p-value function and consonance/compatibility plot

_([related function documentation](https://easystats.github.io/parameters/reference/p_function.html))_
Expand Down
29 changes: 19 additions & 10 deletions vignettes/performance.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ plot(result)
Example where model **is** a good fit.

```{r}
model <- glm(am ~ mpg + vs + cyl, data = mtcars, family = "binomial")
model <- suppressWarnings(glm(am ~ mpg + vs + cyl, data = mtcars, family = "binomial"))
result <- binned_residuals(model)
result

Expand Down Expand Up @@ -150,26 +150,35 @@ plot(result, type = "bars")
_([related function documentation](https://easystats.github.io/performance/reference/check_normality.html))_

```{r}
model <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars)
result <- check_normality(model)
model2 <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars)
result2 <- check_normality(model2)
```

### Density Plot

```{r}
plot(result, type = "density")
```{r echo=FALSE}
plot(result2, type = "density", data = model2)
```
```{r eval=FALSE}
plot(result2, type = "density")
```

### QQ Plot

```{r}
plot(result, type = "qq")
```{r echo=FALSE}
plot(result2, type = "qq", data = model2)
```
```{r eval=FALSE}
plot(result2, type = "qq")
```

### PP Plot

```{r}
plot(result, type = "pp")
```{r echo=FALSE}
plot(result2, type = "pp", data = model2)
```
```{r eval=FALSE}
plot(result2, type = "pp")
```

## Check for Normal Distributed Random Effects
Expand Down Expand Up @@ -199,7 +208,7 @@ _([related function documentation](https://easystats.github.io/performance/refer
```{r}
model <- lm(len ~ supp + dose, data = ToothGrowth)
result <- check_homogeneity(model)
plot(result)
suppressWarnings(plot(result))
```

## Posterior Predictive Checks
Expand Down
Loading