support lavaan.mi models#1188
Conversation
Summary of ChangesHello @strengejacke, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for lavaan.mi model objects to the parameters package. The changes include adding a new model_parameters.lavaan.mi S3 method, updating the DESCRIPTION and NAMESPACE files, and adding a new test file. The implementation for lavaan.mi models is well-structured and follows the existing pattern for lavaan models. I've found one area for improvement in how function arguments are validated, which I've detailed in a specific comment. Overall, this is a great addition to the package.
|
@gemini-code-assist review |
There was a problem hiding this comment.
Code Review
This pull request adds support for lavaan.mi models, which is a valuable enhancement. The implementation is well-structured, including a new S3 method, documentation, and tests. I've identified a critical bug and another potential issue in the new R/methods_lavaan.mi.R file that should be addressed.
| params$Component[as.character(params$From) == as.character(params$To)] <- "Variance" | ||
|
|
||
| if ("p" %in% colnames(params)) { | ||
| params$p[is.na(params$p)] <- 0 |
There was a problem hiding this comment.
There was a problem hiding this comment.
@mattansb I would agree, the code was copied from the .lavaan method, which was first implemented by @DominiqueMakowski (b34d66d). Any ideas why we set p to 0 for missing p-values?
There was a problem hiding this comment.
Pull request overview
This pull request adds support for lavaan.mi models to the parameters package, enabling model_parameters() to work with multiple imputation SEM models from the lavaan.mi package. This addresses issue #1187.
Changes:
- Added new
model_parameters.lavaan.mi()method to handle lavaan.mi models - Added
.extract_parameters_lavaan_mi()helper function based on the existing lavaan implementation - Modified NAMESPACE to export predict methods as regular functions instead of S3 methods
- Added lavaan.mi to package Suggests
- Added test coverage for the new functionality
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| R/methods_lavaan.mi.R | New file implementing model_parameters method for lavaan.mi objects |
| tests/testthat/test-lavaan.mi.R | New test file verifying lavaan.mi support works correctly |
| R/methods_lavaan.R | Reformatted function signatures for consistency (no functional changes) |
| R/methods_psych.R | Reformatted function signatures and updated documentation to include "defined" component |
| NAMESPACE | Added lavaan.mi method export and changed predict methods from S3method to export |
| DESCRIPTION | Version bump and added lavaan.mi to Suggests |
| man/*.Rd | Documentation updates reflecting code changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Something weird is happening with the namespace and Rd files - see copilots comments. |
Yeah, saw it (and fixed it). Not sure why roxygen did this change? Or was it Gemini when it worked on the PR? |
|
btw, ignore the lavaan-methods file, that is just styling. |
|
Thanks @strengejacke ! |
Fixes #1187