### Install easystats Packages (R) Source: https://easystats.github.io/easystats/reference/install_latest Installs the latest development or CRAN versions of easystats packages. Allows specifying packages, forcing reinstallation, and toggling verbose output. Installs from R-universe by default. ```R install_latest( source = "development", packages = "all", force = FALSE, verbose = TRUE ) ``` ```R if (FALSE) { # install latest development-version of easystats packages from # the r-universe repository, but only those packages that have newer # versions available install_latest() # install all latest development-version of easystats packages from # the r-universe repository, no matter whether local installations # are up to date or not. install_latest(force = TRUE) } ``` -------------------------------- ### Install easystats Suite Source: https://easystats.github.io/easystats/reference/index The `install_latest()` function installs the entire easystats suite. It can install from R-universe (GitHub) or CRAN. No specific inputs are required. ```R install_latest() ``` -------------------------------- ### Install Suggested Packages for easystats (R) Source: https://easystats.github.io/easystats/index Installs all suggested packages for easystats to ensure the full functionality. This command is part of the easystats package itself. ```R easystats::install_suggested() ``` -------------------------------- ### Install Suggested Packages with easystats Source: https://easystats.github.io/easystats/reference/install_suggested Installs all suggested packages for easystats or specified packages to ensure full functionality. It utilizes `{pak}` if available, otherwise falls back to `utils::install.packages()`. This function is primarily for its side-effect of installing packages. ```R install_suggested(package = "easystats") ``` -------------------------------- ### Example: Download all suggested packages in easystats Source: https://easystats.github.io/easystats/reference/install_suggested An example demonstrating how to download all suggested packages for the 'easystats' package to ensure all functionalities are available. This code is typically run within an `if (FALSE)` block to prevent accidental execution. ```R # download all suggested packages if (FALSE) { install_suggested("easystats") } ``` -------------------------------- ### Example: List reverse dependencies of easystats packages Source: https://easystats.github.io/easystats/reference/install_suggested An example demonstrating how to list all packages that have a reverse dependency on easystats packages. This helps in understanding the ecosystem of packages that rely on easystats. ```R # listing all reverse dependencies of easystats packages show_reverse_dependencies() ``` -------------------------------- ### Install easystats Package (R) Source: https://easystats.github.io/easystats/index Provides commands to install the easystats R package from different sources. The 'install.packages' function is used for CRAN and r-universe, while 'remotes::install_github' is for development versions from GitHub. ```R install.packages("easystats") ``` ```R install.packages("easystats", repos = "https://easystats.r-universe.dev") ``` ```R remotes::install_github("easystats/easystats") ``` -------------------------------- ### Install Suggested Packages with Dependencies Source: https://easystats.github.io/easystats/news/index The `install_suggested()` function ensures that suggested packages for easystats are installed, along with their required hard-dependencies. This function was updated to correctly handle these dependencies, fixing a previous issue. ```r install_suggested() ``` -------------------------------- ### Install Latest easystats Packages from GitHub Source: https://easystats.github.io/easystats/news/index The `install_latest()` function with the `source = "github"` option enables installation of the most recent versions of easystats packages directly from their GitHub repositories' main branches. This is an alternative to using pre-compiled binaries from r-universe. ```r install_latest(source = "github") ``` -------------------------------- ### Get easystats Download Statistics Source: https://easystats.github.io/easystats/reference/index The `easystats_downloads()` function reports download statistics for packages within the easystats ecosystem. It does not require any input arguments. ```R easystats_downloads() ``` -------------------------------- ### Example: Customize easystats Model Dashboard Output Source: https://easystats.github.io/easystats/reference/model_dashboard Demonstrates how to customize the output of the `model_dashboard` function by passing arguments to underlying functions like `parameters::model_parameters` and `performance::model_performance`. It also shows how to optimize plotting performance by adjusting arguments for `performance::check_model`. ```r if (FALSE) { # interactive() && require("xml2", quietly = TRUE) && require("flexdashboard", quietly = TRUE) # define a regression model mod <- lm(wt ~ mpg, mtcars) # with default options model_dashboard(mod) # customizing 'parameters' output: standardize coefficients model_dashboard(mod, parameters_args = list(standardize = "refit")) # customizing 'performance' output: only show selected performance metrics model_dashboard(mod, performance_args = list(metrics = c("AIC", "RMSE"))) # customizing output of model assumptions plot: don't show dots (faster plot) model_dashboard(mod, check_model_args = list(show_dots = FALSE)) } ``` -------------------------------- ### Force Update easystats Packages Source: https://easystats.github.io/easystats/news/index The `install_latest()` function now includes a `force` argument. Setting `force = TRUE` will update all packages, while `force = FALSE` (or omitting the argument) will only update locally installed packages for which newer versions are available. ```r install_latest(force = TRUE) ``` -------------------------------- ### Get Citation for easystats Package (R) Source: https://easystats.github.io/easystats/index Retrieves citation information for the easystats R package. This includes the formal citation and a BibTeX entry for LaTeX users. ```R citation("easystats") ``` -------------------------------- ### Get Easystats Publication Citations (R) Source: https://easystats.github.io/easystats/index Retrieves and displays the number of Google Scholar citations for easystats publications. This function sorts the results by citation count in descending order. It requires the 'easystats' R package to be installed. ```r easystats::easystats_citations(sort_by = "cites") ``` -------------------------------- ### Get easystats Citations Source: https://easystats.github.io/easystats/reference/index The `easystats_citations()` function retrieves and displays citation information for publications related to the easystats project. It requires no input. ```R easystats_citations() ``` -------------------------------- ### Update easystats packages and dependencies (R) Source: https://easystats.github.io/easystats/reference/easystats_update Updates easystats packages and their dependencies from CRAN. The 'which' argument controls whether to update core packages, dependencies, or all. It defaults to updating everything. If the 'pak' package is installed, it uses 'pak::pkg_install()'; otherwise, it falls back to 'utils::install.packages()'. ```r easystats_update(which = "all") easystats_update("core") ``` -------------------------------- ### Manage Suggested Packages Source: https://easystats.github.io/easystats/reference/index Functions to manage suggested packages within the easystats ecosystem. `install_suggested()` downloads all suggested packages, `show_suggested()` displays them, and `show_reverse_dependencies()` shows reverse dependencies. ```R install_suggested() ``` ```R show_suggested() ``` ```R show_reverse_dependencies() ``` -------------------------------- ### Show Suggested Packages with easystats Source: https://easystats.github.io/easystats/reference/install_suggested Displays a list of suggested packages for a given easystats package. This is a helper function to identify optional dependencies. ```R show_suggested(package = "easystats") ``` -------------------------------- ### Creating Sample Descriptions with report Source: https://easystats.github.io/easystats/articles/workflow_easystats Generates a descriptive summary of sample characteristics, including means and confidence intervals for continuous variables, and proportions for categorical variables, grouped by a specified factor. This function is part of the report package. ```r library(report) # Sample description report_sample( coffee_data, by = "treatment", select = c("alertness", "time"), ci = 0.95 ) ``` -------------------------------- ### Check Model Assumptions and Fit Source: https://easystats.github.io/easystats/articles/workflow_easystats Performs a graphical summary of important model checks, aiding in the assessment of model quality and assumptions. Requires the performance package and a model object. ```r library(performance) # checking model assunptions check_model(model) ``` -------------------------------- ### Show Reverse Dependencies with easystats Source: https://easystats.github.io/easystats/reference/install_suggested Lists all packages that depend on a specified easystats package. This is useful for understanding the broader impact and usage of easystats components. ```R show_reverse_dependencies(package = "easystats") ``` -------------------------------- ### Display Welcome Message (R) Source: https://easystats.github.io/easystats/reference/easystats_zen The `easystats_zen()` function displays a reassuring message, similar to a Yoda-esque quote. It requires no input arguments and returns a character string. ```R easystats_zen() ``` -------------------------------- ### Data Preparation and Recoding with datawizard Source: https://easystats.github.io/easystats/articles/workflow_easystats Prepares data for analysis by dichotomizing an outcome variable and renaming a predictor variable using functions from the datawizard package. It uses the coffee_data dataset from the modelbased package as input. ```r library(datawizard) # for data management, e.g. recodings data(coffee_data, package = "modelbased") # dichotomize outcome variable coffee_data$alertness <- categorize(coffee_data$alertness, lowest = 0) # rename variable coffee_data <- data_rename(coffee_data, select = c(treatment = "coffee")) ``` -------------------------------- ### Compare Two Models with test_performance() and test_likelihoodratio() Source: https://easystats.github.io/easystats/articles/workflow_performance This snippet demonstrates comparing two models using both test_performance() (which uses Bayes Factor) and test_likelihoodratio() (for Likelihood-Ratio Test) to confirm findings. It highlights how both tests can indicate which model is a significantly better fit. ```r test_performance(model2, model3) #> Name | Model | BF | df | df_diff | Chi2 | p #> ---------------------------------------------------------- #> model2 | glmmTMB | | 17 | | | #> model3 | glmmTMB | > 1000 | 18 | 1 | 133.83 | < .001 #> Models were detected as nested (in terms of fixed parameters) and are compared in sequential order. test_likelihoodratio(model2, model3) #> # Likelihood-Ratio-Test (LRT) for Model Comparison (ML-estimator) #> #> Name | Model | df | df_diff | Chi2 | p #> ------------------------------------------------- #> model2 | glmmTMB | 17 | | | #> model3 | glmmTMB | 18 | 1 | 133.83 | < .001 ``` -------------------------------- ### Generate Regression Model Summary with easystats Source: https://easystats.github.io/easystats/reference/model_dashboard The `model_dashboard` function generates a comprehensive HTML dashboard for regression models. It includes tabular summaries of parameter estimates and model fit, dot-and-whisker plots, model assumption checks, and text reports. It leverages functions from the 'performance' and 'parameters' packages. The output is an HTML file that can be optionally browsed in an interactive session. ```r model_dashboard( model, check_model_args = NULL, parameters_args = NULL, performance_args = NULL, output_file = "easydashboard.html", output_dir = getwd(), rmd_dir = system.file("templates/easydashboard.Rmd", package = "easystats"), quiet = FALSE, browse_html = interactive() ) ``` -------------------------------- ### Display Model Coefficients Source: https://easystats.github.io/easystats/articles/workflow_easystats Displays the model parameters, including odds ratios for logistic regression models. Useful for an initial overview of the model's effects. Requires the model object as input. ```r model_parameters(model, exponentiate = TRUE) ``` -------------------------------- ### List easystats Packages (R) Source: https://easystats.github.io/easystats/reference/easystats_packages The easystats_packages() function returns a character vector containing the names of all packages that are part of the easystats ecosystem. It requires no arguments and is useful for understanding the available tools within the project. ```R easystats_packages() ``` -------------------------------- ### Estimate All Pairwise Contrasts Source: https://easystats.github.io/easystats/articles/workflow_easystats Estimates all possible pairwise comparisons for specified variables in a statistical model. This function is useful for understanding the differences between all levels of the contrasted predictors. No specific dependencies are mentioned beyond the model object and the contrast specification. ```r estimate_contrasts(model, c("time", "treatment")) ``` -------------------------------- ### Download easystats Package Statistics (R) Source: https://easystats.github.io/easystats/reference/easystats_downloads This function retrieves download statistics for easystats packages from CRAN using the cranlogs package. It allows sorting by total or monthly downloads and limiting the output length. The function returns a data frame with package names, total downloads, and average monthly downloads. ```R easystats_downloads(from = "2019-02-26", sort_by = "total", length = 30) ``` ```R # easystats_downloads() # Package | Total | Monthly # ---------------------------------- # insight | 9,060,161 | 114,686 # datawizard | 5,888,058 | 113,232 # parameters | 3,933,155 | 53,151 # performance | 3,932,325 | 50,414 # bayestestR | 3,831,208 | 49,118 # effectsize | 2,940,541 | 41,416 # correlation | 1,093,680 | 16,324 # see | 865,795 | 11,244 # modelbased | 596,163 | 8,640 # report | 307,814 | 5,700 # easystats | 128,336 | 3,377 # Total | 32,577,236 | 467,302 ``` -------------------------------- ### Generating Descriptive Tables with datawizard Source: https://easystats.github.io/easystats/articles/workflow_easystats Creates frequency tables and cross-tables for categorical variables in a dataset using the datawizard package. It can tabulate single variables or cross-tabulate two variables, with options for handling missing values. ```r library(report) # Note: report is also loaded here, though the functions used are from datawizard # Frequency table data_tabulate(coffee_data, c("treatment", "time")) # Cross table data_tabulate(coffee_data, "treatment", by = "time") ``` -------------------------------- ### Visual Model Fit Check for Improved Model Source: https://easystats.github.io/easystats/articles/workflow_performance Performs a visual model fit check on the model with the added zero-inflation component. This helps assess if the inclusion of the zero-inflation formula has improved the model's adherence to its assumptions. ```R check_model(model2) ``` -------------------------------- ### Zero-Inflation Test for Improved Model Source: https://easystats.github.io/easystats/articles/workflow_performance Verifies the zero-inflation status of the model after incorporating the zero-inflation component. This test confirms whether the model now adequately predicts the observed number of zeros. ```R check_zeroinflation(model2) ``` -------------------------------- ### Generate Model Dashboard Source: https://easystats.github.io/easystats/reference/index The `model_dashboard()` function generates a summary dashboard for regression models fitted using easystats. It takes a model object as input. ```R model_dashboard() ``` -------------------------------- ### Compare Multiple Models Using test_performance() Source: https://easystats.github.io/easystats/articles/workflow_performance The test_performance() function compares multiple statistical models, automatically selecting an appropriate test (e.g., Bayes factor based on BIC) and presenting results including model fit statistics and significance. ```r test_performance(model1, model2, model3) #> Name | Model | BF | df | df_diff | Chi2 | p #> ---------------------------------------------------------- #> model1 | glmmTMB | | 9 | | | #> model2 | glmmTMB | > 1000 | 17 | 8 | 193.31 | < .001 #> model3 | glmmTMB | > 1000 | 18 | 1 | 133.83 | < .001 #> Models were detected as nested (in terms of fixed parameters) and are compared in sequential order. ``` -------------------------------- ### Fit Initial Poisson GLMM Source: https://easystats.github.io/easystats/articles/workflow_performance Fits a generalized linear mixed-effects model using a Poisson distribution with a random intercept for 'site'. It utilizes the 'glmmTMB' package and the 'Salamanders' dataset. ```R library(performance) model1 <- glmmTMB::glmmTMB( count ~ mined + spp + (1 | site), family = poisson, data = glmmTMB::Salamanders ) ``` -------------------------------- ### Plotting easystats Package Dependencies Source: https://easystats.github.io/easystats/index Visualizes the dependency graph of easystats packages up to a specified depth. This function helps understand the interconnections between packages within the ecosystem, excluding stamp information for a cleaner graph. It requires the 'deepdep' package. ```r library(deepdep) plot_dependencies("easystats", depth = 2L, show_stamp = FALSE) ``` -------------------------------- ### Generate Model Summary Dashboard Source: https://easystats.github.io/easystats/news/index The `model_dashboard()` function creates a dashboard that summarizes regression models using easystats. It includes an option `browse_html` to control whether the generated HTML dashboard is automatically opened in a web browser. ```r model_dashboard(browse_html = TRUE) ``` ```r model_dashboard(browse_html = FALSE) ``` -------------------------------- ### Estimate Grouped Pairwise Contrasts Source: https://easystats.github.io/easystats/articles/workflow_easystats Estimates pairwise comparisons grouped by a specified variable. This allows for a more focused analysis, showing how contrasts differ across levels of another predictor. The function takes the model, the variable to contrast, and a grouping variable as input. ```r estimate_contrasts(model, "treatment", by = "time") ``` -------------------------------- ### Visualize Predicted Probabilities Source: https://easystats.github.io/easystats/articles/workflow_easystats Generates a plot to visually interpret the model's predictions, making it easier to understand the relationships between variables and the outcome. Takes the 'predictions' object (output from estimate_means) as input. ```r # plot predicted probabilities plot(predictions) ``` -------------------------------- ### Summarize GLMM Parameters Source: https://easystats.github.io/easystats/articles/workflow_performance Extracts and displays the estimated parameters, standard errors, confidence intervals, and p-values for a fitted glmmTMB model. It uses the 'parameters' package for a clear presentation of fixed and random effects. ```R library(parameters) model_parameters(model1) ``` -------------------------------- ### Examine Model Parameters with model_parameters() Source: https://easystats.github.io/easystats/articles/workflow_performance The model_parameters() function provides a detailed summary of the estimated parameters for a given statistical model, including fixed effects, random effects, and dispersion parameters, along with their standard errors, confidence intervals, and p-values. ```r model_parameters(model3) #> # Fixed Effects (Count Model) ... (output truncated for brevity) ``` -------------------------------- ### Fitting Logistic Regression Model with glm Source: https://easystats.github.io/easystats/articles/workflow_easystats Fits a logistic regression model using the generalized linear model function `glm` from base R. The model predicts the `alertness` outcome based on `treatment` and `time`, including their interaction term. The `family = binomial()` argument specifies a logistic regression. ```r library(parameters) # Note: parameters is loaded for subsequent use, though not directly in this snippet. # model model <- glm(alertness ~ treatment * time, data = coffee_data, family = binomial()) ``` -------------------------------- ### Zero-Inflation Test for GLMM Source: https://easystats.github.io/easystats/articles/workflow_performance Assesses the model for zero-inflation by comparing the number of observed zeros to the number of predicted zeros. A ratio close to 1 indicates that the model adequately accounts for the zeros in the data. ```R check_zeroinflation(model1) ``` -------------------------------- ### Fit a GLMM with Negative Binomial Distribution using glmmTMB Source: https://easystats.github.io/easystats/articles/workflow_performance This R code snippet demonstrates fitting a generalized linear mixed-effects model (GLMM) using the glmmTMB package. It specifies a negative binomial distribution (nbinom2) for the response variable and includes formulas for both the count and zero-inflation components, along with random effects. ```r model4 <- glmmTMB::glmmTMB( count ~ mined + spp + (1 | site), ziformula = ~ mined + spp, family = glmmTMB::nbinom2, data = glmmTMB::Salamanders ) check_model(model4) #> `check_outliers()` does not yet support models of class `glmmTMB`. ``` -------------------------------- ### Compare Model Performance with easystats Source: https://easystats.github.io/easystats/articles/workflow_performance Compares the performance of multiple statistical models (model1, model2, model3) using various fit indices including AIC, AICc, BIC, and Proper Scoring Rules. The results are stored in a 'result' object and can be visualized using the plot() function. ```r result <- compare_performance( model1, model2, model3, metrics = c("AIC", "AICc", "BIC", "SCORE") ) result #> # Comparison of Model Performance Indices #> #> Name | Model | AIC (weights) | AICc (weights) | BIC (weights) | Score_log | Score_spherical #> ------------------------------------------------------------------------------------------------- #> model1 | glmmTMB | 1962.8 (<.001) | 1963.1 (<.001) | 2003.0 (<.001) | -1.457 | 0.032 #> model2 | glmmTMB | 1785.5 (<.001) | 1786.5 (<.001) | 1861.4 (<.001) | -1.328 | 0.032 #> model3 | glmmTMB | 1653.7 (>.999) | 1654.8 (>.999) | 1734.1 (>.999) | -1.275 | 0.032 plot(result) ``` -------------------------------- ### Check CRAN Status of easystats Packages Source: https://easystats.github.io/easystats/news/index The `check_cran_status()` function allows users to view CRAN check results (errors or warnings) for packages within the easystats ecosystem. This was previously shown by default on startup but can now be explicitly called. ```r easystats::check_cran_status() ``` -------------------------------- ### Update easystats Packages Source: https://easystats.github.io/easystats/reference/index The `easystats_update()` function checks for and applies necessary updates for easystats packages and their dependencies from CRAN. It operates automatically without requiring input. ```R easystats_update() ``` -------------------------------- ### Analyze Model Parameters in R Source: https://easystats.github.io/easystats/articles/workflow_performance Extracts and displays detailed parameters for a fitted statistical model, including fixed effects, zero-inflation components, dispersion, and random effects variances. This function is crucial for understanding the influence and significance of different predictors and model components. It typically takes a fitted model object as input and provides coefficients, standard errors, confidence intervals, and p-values. ```r model_parameters(model4) #> # Fixed Effects (Count Model) #> #> Parameter | Log-Mean | SE | 95% CI | z | p #> -------------------------------------------------------------- #> (Intercept) | -0.61 | 0.41 | [-1.40, 0.18] | -1.51 | 0.132 #> mined [no] | 1.43 | 0.37 | [ 0.71, 2.15] | 3.90 | < .001 #> spp [PR] | -0.96 | 0.64 | [-2.23, 0.30] | -1.50 | 0.134 #> spp [DM] | 0.17 | 0.24 | [-0.29, 0.63] | 0.73 | 0.468 #> spp [EC-A] | -0.39 | 0.34 | [-1.06, 0.28] | -1.13 | 0.258 #> spp [EC-L] | 0.49 | 0.24 | [ 0.02, 0.96] | 2.05 | 0.041 #> spp [DES-L] | 0.59 | 0.23 | [ 0.14, 1.04] | 2.59 | 0.010 #> spp [DF] | -0.11 | 0.24 | [-0.59, 0.36] | -0.46 | 0.642 #> #> # Fixed Effects (Zero-Inflation Component) #> #> Parameter | Log-Odds | SE | 95% CI | z | p #> --------------------------------------------------------------- #> (Intercept) | 0.91 | 0.63 | [-0.32, 2.14] | 1.45 | 0.147 #> mined [no] | -2.56 | 0.60 | [-3.75, -1.38] | -4.24 | < .001 #> spp [PR] | 1.16 | 1.33 | [-1.45, 3.78] | 0.87 | 0.384 #> spp [DM] | -0.94 | 0.80 | [-2.51, 0.63] | -1.17 | 0.241 #> spp [EC-A] | 1.04 | 0.71 | [-0.36, 2.44] | 1.46 | 0.144 #> spp [EC-L] | -0.56 | 0.73 | [-1.99, 0.86] | -0.77 | 0.439 #> spp [DES-L] | -0.89 | 0.75 | [-2.37, 0.58] | -1.19 | 0.236 #> spp [DF] | -2.54 | 2.18 | [-6.82, 1.74] | -1.16 | 0.244 #> #> # Dispersion #> #> Parameter | Coefficient | 95% CI #> ---------------------------------------- #> (Intercept) | 1.51 | [0.93, 2.46] #> #> # Random Effects Variances #> #> Parameter | Coefficient | 95% CI #> ------------------------------------------------- #> SD (Intercept: site) | 0.38 | [0.17, 0.87] #> #> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed #> using a Wald z-distribution approximation. ``` -------------------------------- ### Fit Improved Poisson GLMM with Zero-Inflation Source: https://easystats.github.io/easystats/articles/workflow_performance Fits an improved generalized linear mixed-effects model by explicitly including a zero-inflation component. The formula for the zero-inflation part (ziformula) is specified, along with the main model formula, family, and data. ```R model2 <- glmmTMB::glmmTMB( count ~ mined + spp + (1 | site), ziformula = ~ mined + spp, family = poisson, data = glmmTMB::Salamanders ) ``` -------------------------------- ### Fit Negative Binomial Model with glmmTMB Source: https://easystats.github.io/easystats/articles/workflow_performance Fits a generalized linear mixed-effects model using a negative binomial distribution (nbinom1) to account for potential overdispersion and zero-inflation in count data. It then uses check_model to assess the model fit, and specific functions check_overdispersion and check_zeroinflation to evaluate dispersion and zero-inflation. ```r model3 <- glmmTMB::glmmTMB( count ~ mined + spp + (1 | site), ziformula = ~ mined + spp, family = glmmTMB::nbinom1, data = glmmTMB::Salamanders ) check_model(model3) #> `check_outliers()` does not yet support models of class `glmmTMB`. check_overdispersion(model3) #> # Overdispersion test #> #> dispersion ratio = 1.081 #> p-value = 0.54 #> No overdispersion detected. check_zeroinflation(model3) #> # Check for zero-inflation #> #> Observed zeros: 387 #> Predicted zeros: 389 #> Ratio: 1.00 #> Model seems ok, ratio of observed and predicted zeros is within the #> tolerance range (p > .999). ``` -------------------------------- ### Overdispersion Test for Improved Model Source: https://easystats.github.io/easystats/articles/workflow_performance Re-evaluates the overdispersion of the model after adding the zero-inflation component. This check helps determine if the zero-inflation component has also alleviated any overdispersion issues. ```R check_overdispersion(model2) ``` -------------------------------- ### Compare Models with Likelihood Ratio Test in R Source: https://easystats.github.io/easystats/articles/workflow_performance Performs a Likelihood-Ratio Test (LRT) to compare nested statistical models. This function helps determine if a more complex model provides a significantly better fit to the data than a simpler one. It typically requires two models fitted using compatible methods, such as Maximum Likelihood (ML). The output includes key statistics like Chi2 and p-values for comparison. ```r test_likelihoodratio(model3, model4) #> # Likelihood-Ratio-Test (LRT) for Model Comparison (ML-estimator) #> #> Name | Model | df | df_diff | Chi2 | p #> ------------------------------------------------ #> model3 | glmmTMB | 18 | | | #> model4 | glmmTMB | 18 | 0 | 16.64 | < .001 ``` -------------------------------- ### Check for Zero-Inflation in a GLMM Source: https://easystats.github.io/easystats/articles/workflow_performance The check_zeroinflation() function evaluates the extent of zero-inflation in a count model by comparing the observed number of zeros to the predicted number of zeros. It provides a ratio to help diagnose if the zero-inflation component of the model is adequate. ```r check_zeroinflation(model4) #> # Check for zero-inflation #> #> Observed zeros: 387 #> Predicted zeros: 386 #> Ratio: 1.00 ``` -------------------------------- ### Visual Model Fit Check Source: https://easystats.github.io/easystats/articles/workflow_performance Performs a comprehensive visual inspection of a fitted model's assumptions using simulated residuals. It generates various diagnostic plots, including posterior predictive checks and Q-Q plots, to assess model fit. Note that outlier checks are not yet supported for glmmTMB models. ```R check_model(model1) ``` -------------------------------- ### Estimate Adjusted Predictions (Probabilities) Source: https://easystats.github.io/easystats/articles/workflow_easystats Calculates adjusted predictions on the response scale of the model. For logistic regression, this yields predicted probabilities. Useful for interpreting interactions by specifying focal terms. Requires the modelbased package. ```r library(modelbased) # predicted probabilities predictions <- estimate_means(model, c("time", "treatment")) predictions ``` -------------------------------- ### Overdispersion Test for GLMM Source: https://easystats.github.io/easystats/articles/workflow_performance Conducts a statistical test to detect overdispersion in a fitted model, using simulated residuals. It reports a dispersion ratio, Pearson's Chi-Squared statistic, and a p-value to indicate the presence of overdispersion. ```R check_overdispersion(model1) ``` -------------------------------- ### Report citations for easystats publications using R Source: https://easystats.github.io/easystats/reference/easystats_citations The easystats_citations function retrieves Google Scholar citation counts for easystats publications. It requires the 'scholar' package and returns a data frame with citation details. Limitations include potential connection issues with Google Scholar. ```R easystats_citations(sort_by = "year", length = 30) # Example of usage: easystats_citations() # > Warning: Cannot connect to Google Scholar. Is the ID you provided correct? # > Warning: Cannot connect to Google Scholar. Is the ID you provided correct? # > NULL ``` -------------------------------- ### Check for Overdispersion in a GLMM Source: https://easystats.github.io/easystats/articles/workflow_performance The check_overdispersion() function assesses whether the variance of the response variable is greater than its mean, a common issue in count models. It provides a dispersion ratio and a p-value to help determine if overdispersion is present. ```r check_overdispersion(model4) #> # Overdispersion test #> #> dispersion ratio = 0.958 #> p-value = 0.93 #> No overdispersion detected. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.