-
Notifications
You must be signed in to change notification settings - Fork 6
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
Cleanup Variables API #207
base: devel
Are you sure you want to change the base?
Conversation
replaced by observed_vars()
replaced by nvars()
and add default implementation samples(::SemObserved)
* it is unused * if ever rowwise access would be required, it could be done with eachrow(data) without allocation
check_round(partable.columns[c][var_indices]; digits = digits) for c in var_columns | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
check_round(partable.columns[c][var_indices]; digits = digits) for c in var_columns | |
) | |
check_round(partable.columns[c][var_indices]; digits = digits) for c in var_columns |
@@ -143,9 +144,13 @@ function RAM(; | |||
# μ | |||
if meanstructure | |||
has_meanstructure = Val(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
has_meanstructure = Val(true) | |
!isnothing(M_indices) || throw( | |
ArgumentError( | |
"You set `meanstructure = true`, but your model specification contains no mean parameters.", | |
), | |
) |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #207 +/- ##
==========================================
+ Coverage 69.64% 70.65% +1.01%
==========================================
Files 51 52 +1
Lines 2421 2457 +36
==========================================
+ Hits 1686 1736 +50
+ Misses 735 721 -14 ☔ View full report in Codecov by Sentry. |
for missing data pattern: nobserved_vars() -> nmeasured_vars(), obs_cov/obs_mean -> measured_cov/measured_mean
check_round(partable.columns[c][var_indices]; digits = digits) for c in var_columns | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
check_round(partable.columns[c][var_indices]; digits = digits) for c in var_columns | |
) | |
check_round(partable.columns[c][var_indices]; digits = digits) for c in var_columns |
@@ -143,9 +144,13 @@ function RAM(; | |||
# μ | |||
if meanstructure | |||
has_meanstructure = Val(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
has_meanstructure = Val(true) | |
!isnothing(M_indices) || throw( | |
ArgumentError( | |
"You set `meanstructure = true`, but your model specification contains no mean parameters.", | |
), | |
) |
@Maximilian-Stefan-Ernst I have also cleaned up the existing unit tests and added the tests to cover the vars/params API calls |
""" | ||
nparams(semobj) | ||
|
||
Return the number of parameters in a SEM model associated with `semboj`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return the number of parameters in a SEM model associated with `semboj`. | |
Return the number of parameters in a SEM model associated with `semobj`. | |
|
||
See also [`vars`](@ref). | ||
""" | ||
nvars(semobj) = length(vars(semobj)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function (and the next ones) do not seem to be exported - I think we should do that.
Another round of cherry-picks from #193 that cleans up the variables API, as discussed in #199:
vars()
/nvars()
methods to get the vector of SEM model variables/count of variables.observed_vars()
/nobserved_vars()
to get the vector of observed variables ordered as in observed data (nobserved_vars()
replacesn_man()
method)latent_vars()
/nlatent_vars()
to get the vector of latent variables, preserving their order invars()
get_data()
renamed tosamples()
,nsamples()
is the number of data points/samples/observations in the observed data (nsamples()
replacesn_obs()
method)SemMissingData
nmeasured_vars()
is the count of observed variables with measurements (within the given data pattern)types.jl
to the files, where the methods of a particular type are defined (new files are created to accommodate methods for the abstract classes, e.g.SemSpecification
)RAMMatrices
orParameterTable
, but also for the types that refer to SEM specification (SemImply
,AbstractSem
etc)get_colnames()
, orget_n_nodes()
removedPer #199 discussion, an alternative to observed/latent terms would be manifest/latent. Also, samples could be replaced with observations (keeping both
nobserved_vars()
andnobservations()
may lead to confusion), and measured/missing terms could be replaced with observed/missing. I really don't have a strong preference here, so if SEM stakeholders think manifest/latent + observed/missing is a better choice, I can update the PR.Also, I think
obs_cov
/obs_mean
have to be updated accordingly (observed_cov
/observed_mean
ormanifest_cov
/manifest_mean
).This PR should be really the last one that does not introduce improvements or new features, but it should help to make the improvements easier.