### Prepare Demo Data for bruceR::PROCESS Function Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet loads the `bruceR` package and prepares a demo dataset from `mediation::student`. It renames columns, creates new variables like `gender01` and `pass`, and converts relevant variables to factors for use in subsequent analyses. Note: `nsim=100` is used in examples to save time; `nsim=1000` or larger is suggested for formal analyses. ```R library(bruceR) #### NOTE #### ## In the following examples, I set nsim=100 to save time. ## In formal analyses, nsim=1000 (or larger) is suggested! #### Demo Data #### # ?mediation::student data=mediation::student %>% dplyr::select(SCH_ID, free, smorale, pared, income, gender, work, attachment, fight, late, score) names(data)[2:3]=c("SCH_free", "SCH_morale") names(data)[4:7]=c("parent_edu", "family_inc", "gender", "partjob") data$gender01=1-data$gender # 0 = female, 1 = male # dichotomous X: as.factor() data$gender=factor(data$gender01, levels=0:1, labels=c("Female", "Male")) # dichotomous Y: as.factor() data$pass=as.factor(ifelse(data$score>=50, 1, 0)) ``` -------------------------------- ### Install bruceR Package from CRAN or GitHub Source: https://github.com/psychbruce/brucer/blob/main/README.md This snippet provides two methods to install the bruceR R package: from CRAN (the official R package repository) or directly from GitHub. It emphasizes setting 'dep=TRUE' to ensure all dependencies are installed for full functionality, and suggests installing 'devtools' for GitHub installation. ```R ## Method 1: Install from CRAN install.packages("bruceR", dep=TRUE) # dependencies=TRUE ## Method 2: Install from GitHub install.packages("devtools") devtools::install_github("psychbruce/bruceR", dep=TRUE, force=TRUE) ``` -------------------------------- ### Update: bruceR Package Dependencies Streamlined Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Explains the reduction in strong package dependencies for faster and more robust installation. Specifically, `rio` and `jmv` have been removed from dependencies, and `rio` and `psych` are no longer loaded by default when `bruceR` is loaded. ```APIDOC Package Dependencies: - Fewer strong dependencies for faster and more robust installation. - Removed 'rio' and 'jmv' from dependencies. - 'rio' and 'psych' no longer loaded when calling library(bruceR). ``` -------------------------------- ### Perform Descriptive Statistics and Correlation Analysis in R Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet demonstrates basic data exploration using `bruceR` functions. `Freq` is used for frequency tables, `Describe` for comprehensive descriptive statistics, and `Corr` for correlation matrices. These functions are useful for initial data understanding before complex modeling. ```R #### Descriptive Statistics and Correlation Analyses #### Freq(data$gender) Freq(data$pass) Describe(data) # Describe(data, file="xxx.doc") Corr(data[,4:11]) # Corr(data, file="xxx.doc") ``` -------------------------------- ### Perform Three-Way Moderated Mediation (Model 12) with bruceR::PROCESS Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet illustrates Model 12 of the `PROCESS` function, which extends Model 8 to include three-way moderation on both the X-M and X-Y paths. It shows how to specify multiple moderators and the `mod.path` argument for this advanced moderated mediation model. ```R ## Model 12 ## PROCESS(data, y="score", x="fight", meds="late", mods=c("gender", "family_inc"), mod.path=c("x-m", "x-y"), mod.type="3-way", ci="boot", nsim=100, seed=1) ``` -------------------------------- ### Perform Two-Way Moderated Mediation (Model 10) with bruceR::PROCESS Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet demonstrates Model 10 of the `PROCESS` function, which extends Model 8 to include two-way moderation on both the X-M and X-Y paths. It shows how to specify multiple moderators and the `mod.path` argument for this complex moderated mediation model. ```R ## Model 10 ## PROCESS(data, y="score", x="fight", meds="late", mods=c("gender", "family_inc"), mod.path=c("x-m", "x-y"), mod.type="2-way", ci="boot", nsim=100, seed=1) ``` -------------------------------- ### Perform Two-Way Moderation Analysis (Model 2) with bruceR::PROCESS Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet illustrates Model 2 of the `PROCESS` function, which handles two-way interaction moderation. It shows how to specify multiple moderators using the `mods` argument for a more complex interaction effect. ```R ## Model 2 ## PROCESS(data, y="score", x="late", mods=c("gender", "family_inc"), mod.type="2-way") # or omit "mod.type", default is "2-way" ``` -------------------------------- ### Perform Moderation Analysis (Model 1) with bruceR::PROCESS Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This section demonstrates Model 1 of the `PROCESS` function for simple moderation analysis. It covers continuous and dichotomous dependent variables, multilevel moderation, and extraction of Johnson-Neyman intervals and plots for conditional effects. ```R #### PROCESS Analyses #### ## Model 1 ## PROCESS(data, y="score", x="late", mods="gender") # continuous Y PROCESS(data, y="pass", x="late", mods="gender") # dichotomous Y # (multilevel moderation) PROCESS(data, y="score", x="late", mods="gender", # continuous Y (LMM) clusters="SCH_ID") PROCESS(data, y="pass", x="late", mods="gender", # dichotomous Y (GLMM) clusters="SCH_ID") # (Johnson-Neyman (J-N) interval and plot) PROCESS(data, y="score", x="gender", mods="late")->P P$results[[1]]$jn[[1]] # Johnson-Neyman interval P$results[[1]]$jn[[1]]$plot # Johnson-Neyman plot (ggplot object) GLM_summary(P$model.y) # detailed results of regression # (allows multicategorical moderator) d=airquality d$Month=as.factor(d$Month) # moderator: factor with levels "5"~"9" PROCESS(d, y="Temp", x="Solar.R", mods="Month") ``` -------------------------------- ### Perform Moderated Mediation Analysis (Model 8) with bruceR::PROCESS Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet illustrates Model 8 of the `PROCESS` function, where moderation occurs on both the X-M (predictor to mediator) and X-Y (predictor to outcome) paths. It demonstrates how to specify mediators, moderators, and the `mod.path` argument for multiple moderated paths. ```R ## Model 8 ## PROCESS(data, y="score", x="fight", meds="late", mods="gender", mod.path=c("x-m", "x-y"), ci="boot", nsim=100, seed=1) ``` -------------------------------- ### Perform Three-Way Moderation Analysis (Model 3) with bruceR::PROCESS Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet demonstrates Model 3 of the `PROCESS` function, which performs three-way interaction moderation. It shows how to specify multiple moderators and custom values for conditional effects using `mod1.val` and `mod2.val`. ```R ## Model 3 ## PROCESS(data, y="score", x="late", mods=c("gender", "family_inc"), mod.type="3-way") PROCESS(data, y="pass", x="gender", mods=c("late", "family_inc"), mod1.val=c(1, 3, 5), # moderator 1: late mod2.val=seq(1, 15, 2), # moderator 2: family_inc mod.type="3-way") ``` -------------------------------- ### Perform Serial Mediation Analysis (Model 6) with bruceR::PROCESS Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet demonstrates Model 6 of the `PROCESS` function, which handles serial mediation. It shows how to specify multiple mediators in a sequential chain using `med.type='serial'`, allowing for the analysis of indirect effects through a series of mediators. ```R ## Model 6 ## PROCESS(data, y="score", x="parent_edu", meds=c("family_inc", "late"), covs=c("gender", "partjob"), med.type="serial", ci="boot", nsim=100, seed=1) ``` -------------------------------- ### Perform Simple Mediation Analysis (Model 4) with bruceR::PROCESS Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This section demonstrates Model 4 of the `PROCESS` function, focusing on simple mediation analysis. It showcases various confidence interval types for indirect effects, including Percentile Bootstrap, Bias-Corrected Percentile Bootstrap, Bias-Corrected and Accelerated Percentile Bootstrap, and Monte Carlo CIs. It also covers multiple parallel mediators and multilevel mediation. ```R ## Model 4 ## # Percentile Bootstrap CI PROCESS(data, y="score", x="parent_edu", meds="family_inc", covs="gender", ci="boot", nsim=100, seed=1) # Bias-Corrected Percentile Bootstrap CI PROCESS(data, y="score", x="parent_edu", meds="family_inc", covs="gender", ci="bc.boot", nsim=100, seed=1) # Bias-Corrected and Accelerated Percentile Bootstrap CI PROCESS(data, y="score", x="parent_edu", meds="family_inc", covs="gender", ci="bca.boot", nsim=100, seed=1) # Monte Carlo CI PROCESS(data, y="score", x="parent_edu", meds="family_inc", covs="gender", ci="mcmc", nsim=100, seed=1) # (allows an infinite number of multiple mediators in parallel) PROCESS(data, y="score", x="parent_edu", meds=c("family_inc", "late"), covs=c("gender", "partjob"), ci="boot", nsim=100, seed=1) # (multilevel mediation) PROCESS(data, y="score", x="SCH_free", meds="late", clusters="SCH_ID", ci="mcmc", nsim=100, seed=1) ``` -------------------------------- ### Perform Moderated Mediation Analysis (Model 5) with bruceR::PROCESS Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet illustrates Model 5 (and its variants 5.2/5.3) of the `PROCESS` function, which performs moderated mediation where the moderation occurs on the X-Y path. It demonstrates how to specify mediators, moderators, covariates, and the `mod.path` argument for specific moderated effects. ```R ## Model 5 / 5.2 / 5.3 ## PROCESS(data, y="score", x="fight", meds="late", mods="gender", covs="parent_edu", mod.path="x-y", ci="boot", nsim=100, seed=1) PROCESS(data, y="score", x="fight", meds=c("late", "attachment"), mods=c("gender", "partjob"), covs=c("parent_edu", "family_inc"), mod.path="x-y", mod.type="3-way", ci="boot", nsim=100, seed=1) ``` -------------------------------- ### Calculate Index of Moderated Mediation with bruceR and mediation Source: https://github.com/psychbruce/brucer/blob/main/note/PROCESS-bruceR-SPSS.md This snippet demonstrates how to calculate the Index of Moderated Mediation, building upon the results from `bruceR::PROCESS` (specifically Model 8). It uses the `mediation` package's `mediate` and `test.modmed` functions to compare indirect effects across different levels of a moderator, providing a formal test of moderated mediation. ```R ## Index of Moderated Mediation (based on Model 8) ## pro=PROCESS(data, y="score", x="fight", meds="late", mods="gender", mod.path=c("x-m", "x-y"), ci="boot", nsim=1000, seed=1) mediation::test.modmed( mediation::mediate( model.m=pro$model.m[[1]], model.y=pro$model.y, treat="fight", mediator="late", boot=TRUE, sims=1000), covariates.1=list(gender="Female"), covariates.2=list(gender="Male")) ``` -------------------------------- ### Access bruceR Package and Function Help Pages Source: https://github.com/psychbruce/brucer/blob/main/README.md This snippet illustrates how to load the `bruceR` library and access its help documentation. It shows commands to view the package overview and specific function help pages using `help()` or `?`. ```R library(bruceR) ## Overview help("bruceR") help(bruceR) ?bruceR ## See help pages of functions ## (use `?function` or `help(function)`) ?cc ?add ?.mean ?set.wd ?import ?export ?Describe ?Freq ?Corr ?Alpha ?MEAN ?RECODE ?TTEST ?MANOVA ?EMMEANS ?PROCESS ?model_summary ?lavaan_summary ?GLM_summary ?HLM_summary ... ``` -------------------------------- ### EMMEANS Function File Output Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The EMMEANS() function now supports saving the contrast table directly to a Microsoft Word file using the new `file` argument. This enhances reporting capabilities by allowing direct output to a common document format. ```APIDOC EMMEANS(..., file = "path/to/output.docx") ``` -------------------------------- ### Minor Change: Package Dependencies Moved to SUGGESTS Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Notes that `mediation`, `interactions`, `MuMIn`, and `texreg` packages are now listed under `SUGGESTS` rather than `IMPORTS` for the `bruceR` package. ```APIDOC Package Dependencies: - 'mediation', 'interactions', 'MuMIn', and 'texreg' are now SUGGESTS rather ``` -------------------------------- ### Enhanced Import Function (import) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `import()` function now includes `pkg` and `value.labels` arguments, offering more flexible settings for data import. It also supports importing data directly from URL sources and files without extensions, increasing its versatility. ```APIDOC import(..., pkg = "package_name", value.labels = TRUE) ``` ```APIDOC import("http://example.com/data.csv") ``` -------------------------------- ### Improvement: CFA and lavaan_summary Functions in bruceR Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Details that `CFA()` now exclusively uses `lavaan::cfa()` to build models and `lavaan_summary()` to present results. Highlights numerous bug fixes and an improved result table format for `lavaan_summary()`, with both functions supporting saving tables to MS Word. ```APIDOC Function: CFA() - Now only uses lavaan::cfa() to build models. - Uses lavaan_summary() to present results. Function: lavaan_summary() - Many bugs have been fixed. - Result table format has been changed and improved. - Both CFA() and lavaan_summary() now support saving tables to MS Word. ``` -------------------------------- ### Minor Change: set_wd() Alias for set.wd() Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Notes the addition of `set_wd()` as a new alias for the `set.wd()` function. ```APIDOC Function: set_wd() - Added as an alias for set.wd(). ``` -------------------------------- ### Flexible Variable Matching in .mean() Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The .mean() function now allows more flexible input for `var` and `items` arguments, supporting pattern matching for variable names. This simplifies selecting sequential or patterned variables for aggregation. ```R .mean(var="X", items=1:3) ``` ```R .mean(var="X.{any_placeholder}.pre", items=1:3) ``` -------------------------------- ### Improvement: MANOVA and EMMEANS Functions in bruceR Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Details bug fixes, output improvements using `print_table()`, and a revised Cohen's *d* estimation method using RMSE for pooled SD. Explains different pooled SD calculations for between-subjects and within-subjects designs, referencing `lm` object, `sigma()`, and `residuals()` functions. Mentions new arguments `ss.type`, `aov.include`, and `model.type`. ```APIDOC Function: MANOVA() - Fixed several bugs. - Output tables now use print_table(). - Added arguments: - ss.type: Specify Type-II or Type-III Sum of Square. - aov.include: (See help pages for details). Function: EMMEANS() - Fixed several bugs. - Output tables now use print_table(). - Cohen's d estimation improved: - Uses Root Mean Square Error (RMSE) as the pooled SD. - For between-subjects designs: Uses square root of Mean Square Error (MSE). - For within-subjects/mixed designs: Uses square root of mean variance of all paired differences of the residuals of repeated measures. - Extracts 'lm' object from MANOVA() return value. - Uses 'sigma()' and 'residuals()' functions for estimates. - Added arguments: - model.type: (See help pages for details). - Added warning messages for wrong usage. ``` -------------------------------- ### Tidy Sum and Mean Functions (.sum, .mean) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md New tidy functions `.sum()` and `.mean()` are designed specifically for use within `add()` and `added()` for convenient aggregation. They provide a streamlined syntax for common data transformations. ```R add(data, total = .sum(var1, var2)) ``` -------------------------------- ### PROCESS Function Centering Control Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `PROCESS()` function now includes a `center` argument (default TRUE), allowing users to control automatic grand-mean centering. While centering is generally recommended for main effects, this provides flexibility for specific analytical needs. ```APIDOC PROCESS(..., center = FALSE) ``` -------------------------------- ### R Function: set.wd Working Directory Improvement Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `set.wd()` function has been improved to use `rstudioapi::getSourceEditorContext()` for extracting file paths, making it effective even when running in the R console. This update requires RStudio version >= 0.99.1111 and resolves previous encoding problems, particularly for paths with Chinese characters on Windows systems. ```APIDOC set.wd(): Description: Sets the working directory. Improvement: Uses rstudioapi::getSourceEditorContext() for path extraction. Requirements: RStudio version >= 0.99.1111. Fixes: Encoding problems (e.g., Chinese characters on Windows). Warning: Prints warnings if RStudio version is lower than required (>= 1.4.843 for complete implementation). ``` -------------------------------- ### CFA Function Estimator Control Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `CFA()` function now accepts an `estimator` argument (default "ML"), providing flexibility to specify different estimation methods for Confirmatory Factor Analysis. This addresses issue #17, allowing users to choose appropriate estimators. ```APIDOC CFA(..., estimator = "ML") ``` -------------------------------- ### Perform Correlation and Regression Analysis with bruceR Source: https://github.com/psychbruce/brucer/blob/main/README.md This snippet demonstrates how to perform correlation analysis and regression analysis using `bruceR` functions. It shows how to save the output of `Corr()` and `model_summary()` to Microsoft Word files, and how to generate standardized regression coefficients. ```R ## Correlation analysis (and descriptive statistics) Corr(airquality, file="cor.doc") ## Regression analysis lm1 = lm(Temp ~ Month + Day, data=airquality) lm2 = lm(Temp ~ Month + Day + Wind + Solar.R, data=airquality) model_summary(list(lm1, lm2), file="reg.doc") model_summary(list(lm1, lm2), std=TRUE, file="reg_std.doc") ``` -------------------------------- ### bruceR Basic R Programming Functions Source: https://github.com/psychbruce/brucer/blob/main/README.md This section lists core functions in `bruceR` for fundamental R programming tasks, including utility functions for setting working directories, importing/exporting data, package management, formatting, printing, and custom operators. ```APIDOC cc() set.wd() (alias: set_wd()) import() export() pkg_depend() pkg_install_suggested() formatF() formatN() print_table() Print() Glue() Run() %^% %notin% %allin% %anyin% %nonein% %partin% ``` -------------------------------- ### Improvement: Alpha Function for Reliability Analysis in bruceR Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Explains the change in `Alpha()` from using `jmv::reliability()` to directly using `psych::alpha()` and `psych::omega()` for reliability analysis, noting the improved format of result output. ```APIDOC Function: Alpha() - Now directly uses psych::alpha() and psych::omega() for reliability analysis. - Previously used jmv::reliability(). - Result output format has been changed and improved. ``` -------------------------------- ### Improvement: EFA Function for Factor Analysis in bruceR Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Describes the almost complete rewrite of `EFA()` to now directly use `psych::principal()` and `psych::fa()` instead of `jmv::efa()` for factor analysis. Mentions improved output format, MS Word output support, and the addition of `PCA()` as a wrapper function. ```APIDOC Function: EFA() - Almost completely rewritten. - Now directly uses psych::principal() and psych::fa() for factor analysis (PCA or EFA). - Previously used jmv::efa(). - Result output format has been changed and improved. - Supports MS Word output. - Added wrapper function: PCA() (equivalent to EFA(..., method="pca")). ``` -------------------------------- ### Minor Change: Word Output Support for Statistical Functions Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Announces the addition of MS Word output capability for the `lavaan_summary()` and `granger_test()` functions. ```APIDOC Function: lavaan_summary() - Added Word output support. Function: granger_test() - Added Word output support. ``` -------------------------------- ### R Function: Run Code Parsed from Text Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The new `Run()` function allows users to execute code that has been parsed from a text string. This utility can be useful for dynamic code execution or scripting within R. ```APIDOC Run(): Description: Executes code parsed from a text string. ``` -------------------------------- ### String Splitting Function (cc) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `cc()` function is introduced and later improved, allowing easy splitting of strings into character vectors based on specified or default separators. It automatically trims whitespace around separators, making string parsing more convenient. ```R cc("A 1 , B 2 ; C 3 | D 4 \t E 5") ``` -------------------------------- ### R Function: Alpha Reliability (Cronbach's α and McDonald's ω) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `Alpha()` function has been enhanced to include a `varrange` parameter, aligning its functionality with `SUM()` and `MEAN()`. It now reports both Cronbach's α and McDonald's ω, providing a more comprehensive assessment of internal consistency reliability with detailed documentation. ```APIDOC Alpha(): Description: Computes internal consistency reliability. Parameters: varrange: Specifies variable list by start and end positions (e.g., "E1:E5"). var: Common and unique parts of variable names (e.g., "RSES", items=1:10). vars: Directly defines variable list (e.g., c("E1", "E2")). rev: Variables to reverse-score (e.g., c(3, 5, 8, 9, 10) or c("E1", "E2")). Output: Both Cronbach's α and McDonald's ω. ``` -------------------------------- ### Minor Change: digits Parameter Added to Relevant Functions Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md States that the `digits` parameter has been added to all relevant functions as an equivalent to the `nsmall` parameter. ```APIDOC Parameter: digits - Added as the equivalent to the 'nsmall' parameter for all relevant functions. ``` -------------------------------- ### bruceR Function Output Capabilities Source: https://github.com/psychbruce/brucer/blob/main/README.md This section provides a table detailing which `bruceR` functions can output results to the R Console and/or Microsoft Word files, indicating suggested or partial support where applicable. ```APIDOC bruceR Function | Output: R Console | Output: MS Word |:----------------------|:-----------------:|:-----------------:| | `print_table()` | √ | √ (basic usage) | | `Describe()` | √ | √ | | `Freq()` | √ | √ | | `Corr()` | √ | **√ (suggested)** | | `Alpha()` | √ | (unnecessary) | | `EFA()` / `PCA()` | √ | √ | | `CFA()` | √ | √ | | `TTEST()` | √ | √ | | `MANOVA()` | √ | √ | | `EMMEANS()` | √ | √ | | `PROCESS()` | √ | √ (partial) | | `model_summary()` | √ | **√ (suggested)** | | `med_summary()` | √ | √ | | `lavaan_summary()` | √ | √ | | `GLM_summary()` | √ | | | `HLM_summary()` | √ | | | `HLM_ICC_rWG()` | √ | (unnecessary) | | `granger_test()` | √ | √ | | `granger_causality()` | √ | √ | ``` -------------------------------- ### R Function: theme_bruce Markdown/HTML Rich Text Support Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `theme_bruce()` function now integrates `ggtext::element_markdown()` to enable rendering of Markdown/HTML rich text format within plot elements, such as titles. This allows for more flexible and visually appealing text formatting in plots generated with this theme. ```APIDOC theme_bruce(): Description: Provides a ggplot2 theme. Improvement: Uses ggtext::element_markdown() for Markdown/HTML rich text rendering in plot text (e.g., titles). ``` -------------------------------- ### Minor Change: print_table Function Output Improvements Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Describes a fix for incorrect length of Chinese character output in `print_table()` and an increase in between-column blanks to two spaces for clearer table presentation. ```APIDOC Function: print_table() - Fixed an issue of incorrect length of Chinese character output. - Between-column blanks are now 2 spaces (rather than 1 space) for clearer presentation. ``` -------------------------------- ### Deprecated nsmall Argument, Use digits Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `nsmall` argument has been deprecated across all functions in favor of `digits`. This change standardizes precision control across the package, ensuring consistency in numerical output. ```APIDOC Function(..., digits = 2) ``` -------------------------------- ### R Function: model_summary Bug Fixes Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Bug fixes for `model_summary()` address issues with `NULL` model names, `NULL` or problematic multicollinearity check results, and UTF-8 encoding problems specifically with WPS software. These fixes improve the robustness and reliability of model summarization. ```APIDOC model_summary(): Description: Provides a summary of statistical models. Bug Fixes: - Handles NULL model names. - Corrects issues with NULL or problematic multicollinearity check results. - Resolves UTF-8 encoding problems in WPS software. ``` -------------------------------- ### R Function: CFA Bug Fix for lavaan-style Output Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md A bug in the `CFA()` function related to its `lavaan`-style output has been fixed. This ensures correct and consistent output when performing Confirmatory Factor Analysis. ```APIDOC CFA(): Description: Performs Confirmatory Factor Analysis. Bug Fix: Corrected issues with lavaan-style output. ``` -------------------------------- ### R Function: EMMEANS Cohen's d Disclaimer and SPSS Consistency Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `EMMEANS()` function now includes a disclaimer regarding Cohen's *d* computation, advising users of the disagreement in calculation methods and their responsibility for setting 'sd.pooled'. The function's results are now consistently identical to SPSS outputs by using `lm` or `mlm` objects for tests, resolving previous discrepancies for ANOVAs with repeated measures. ```APIDOC EMMEANS(): Description: Computes estimated marginal means. Parameters: sd.pooled: Users are responsible for setting this parameter for Cohen's d computation. Behavior: - Includes disclaimer about Cohen's d computation. - Results are identical to SPSS when model="multivariate" in emmeans::joint_tests() and emmeans::emmeans(). - Uses lm or mlm objects for tests. - Simple-effect F tests may not be reported for singular error matrices, but estimated marginal means and pairwise comparisons are unaffected. ``` -------------------------------- ### Enhanced Variable Manipulation Functions (add, added) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md New functions `add()` and `added()` are introduced, combining features from data.table's `:=` and dplyr's `mutate()`/`transmute()` for flexible variable creation, modification, and deletion. They offer a convenient way to manipulate data frames. ```R add(data, new_var = expression) ``` -------------------------------- ### bruceR Multivariate Computation Functions Source: https://github.com/psychbruce/brucer/blob/main/README.md This section outlines functions within `bruceR` designed for multivariate computations, such as adding variables, calculating sums and means, and recoding or rescaling data. ```APIDOC add() added() .sum() .mean() SUM() MEAN() STD() MODE() COUNT() CONSEC() RECODE() RESCALE() LOOKUP() ``` -------------------------------- ### R Function: Show Colors/Palette in Plot Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The new `show_colors()` function enables users to visualize multiple colors or an entire color palette within a plot. This is helpful for selecting and verifying color schemes for data visualization. ```APIDOC show_colors(): Description: Displays multiple colors or a color palette in a plot. ``` -------------------------------- ### R Function: Output Word Document Format for Tables Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `print_table()` function and other functions that utilize it now support outputting tables in Word document (.doc) format. This enhancement allows users to directly generate formatted tables for various statistical analyses, including descriptive statistics, frequencies, correlations, MANOVA, mediation summaries, and Granger causality tests, simplifying report generation. ```APIDOC print_table(): Description: Generates tables, now with .doc output support. Used by: Describe(), Freq(), Corr(), MANOVA(), med_summary(), granger_causality() Output: .doc (Word document) ``` -------------------------------- ### bruceR T-Test, ANOVA, and Post-Hoc Analysis Functions Source: https://github.com/psychbruce/brucer/blob/main/README.md This section covers `bruceR` functions for conducting t-tests, multi-factor ANOVA, simple-effect analysis, and post-hoc multiple comparisons, including estimated marginal means. ```APIDOC TTEST() MANOVA() EMMEANS() ``` -------------------------------- ### Multilevel Correlation Function (cor_multilevel) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md Introduces `cor_multilevel()`, a new function for calculating multilevel correlations. It distinguishes between within-level and between-level correlations, providing a comprehensive analysis for hierarchical data. ```R cor_multilevel(data, ...) ``` -------------------------------- ### Cohen's d Types for Paired-Samples T-Test (TTEST) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The `TTEST()` function now includes a `paired.d.type` argument, allowing users to specify three types of Cohen's d for paired-samples t-tests: "dz", "dav", and "drm", based on Lakens (2013). This provides more nuanced effect size reporting. ```APIDOC TTEST(..., paired.d.type = "dz") TTEST(..., paired.d.type = "dav") TTEST(..., paired.d.type = "drm") Cohen's d_z = M_diff / SD_diff Cohen's d_av = M_diff / ((SD_1 + SD_2) / 2) Cohen's d_rm = (M_diff * sqrt(2 * (1 - r_1,2))) / sqrt(SD_1^2 + SD_2^2 - 2 * r_1,2 * SD_1 * SD_2) ``` -------------------------------- ### bruceR Descriptive Statistics and Correlation Functions Source: https://github.com/psychbruce/brucer/blob/main/README.md This section lists `bruceR` functions for generating descriptive statistics, frequency tables, and performing various correlation analyses, including correlation difference tests and multilevel correlations. ```APIDOC Describe() Freq() Corr() cor_diff() cor_multilevel() ``` -------------------------------- ### R Operator: Paste Strings Together (`%^%`) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The new `%^%` operator is introduced as a convenient wrapper for the `paste0()` function, providing a concise way to concatenate strings without a separator. This simplifies string manipulation in R. ```APIDOC %^%: Description: Custom operator for string concatenation. Functionality: Wrapper for paste0(). Usage: string1 %^% string2 ``` -------------------------------- ### bruceR Reliability and Factor Analysis Functions Source: https://github.com/psychbruce/brucer/blob/main/README.md This section details `bruceR` functions for performing reliability analyses (e.g., Cronbach's Alpha) and various factor analyses, including Exploratory Factor Analysis (EFA), Principal Component Analysis (PCA), and Confirmatory Factor Analysis (CFA). ```APIDOC Alpha() EFA() / PCA() CFA() ``` -------------------------------- ### bruceR Regression Model Reporting Functions Source: https://github.com/psychbruce/brucer/blob/main/README.md This section presents `bruceR` functions designed to generate tidy summaries and reports for various regression models, including general linear models, hierarchical linear models, and `lavaan` models. ```APIDOC model_summary() lavaan_summary() GLM_summary() HLM_summary() HLM_ICC_rWG() regress() ``` -------------------------------- ### bruceR Mediation and Moderation Analysis Functions Source: https://github.com/psychbruce/brucer/blob/main/README.md This section lists `bruceR` functions specifically for performing mediation and moderation analyses, including a function for summarizing mediation results. ```APIDOC PROCESS() med_summary() ``` -------------------------------- ### bruceR Additional Statistics and Graphics Functions Source: https://github.com/psychbruce/brucer/blob/main/README.md This section provides a list of supplementary functions in `bruceR` for advanced statistical operations like grand mean centering, group mean centering, cross-correlation function plots, Granger causality tests, and custom ggplot2 themes. ```APIDOC grand_mean_center() group_mean_center() ccf_plot() granger_test() granger_causality() theme_bruce() show_colors() ``` -------------------------------- ### R Function: HLM Indices Report (ICC, rWG) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The new `HLM_ICC_rWG()` function provides a tidy report of Hierarchical Linear Modeling (HLM) indices. It calculates and presents ICC(1) for data non-independence, ICC(2) for group mean reliability, and rWG/rWG(J) for within-group agreement for single-item or multi-item measures. ```APIDOC HLM_ICC_rWG(): Description: Generates a tidy report of HLM indices. Calculates: - ICC(1): Non-independence of data. - ICC(2): Reliability of group means. - rWG / rWG(J): Within-group agreement (single-item/multi-item). ``` -------------------------------- ### R Function: Granger Causality Test (Multivariate) Source: https://github.com/psychbruce/brucer/blob/main/NEWS.md The new `granger_causality()` function performs multivariate Granger causality tests based on vector autoregression (VAR) models. It serves as an advanced and more generalized version of the existing `granger_test()` function, which only handles bivariate cases. ```APIDOC granger_causality(): Description: Performs multivariate Granger causality tests. Basis: Vector autoregression (VAR) model. Relationship: Advanced and more general version of granger_test() (bivariate). ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.