-
Notifications
You must be signed in to change notification settings - Fork 194
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
Added Minimal Support for Reliability Scores (aka Crombach's alpha) #701
Conversation
Co-authored-by: Bogumił Kamiński <[email protected]>
In general maybe it would be also good to add other reliability measures like https://en.wikipedia.org/wiki/Congeneric_reliability. |
Co-authored-by: Bogumił Kamiński <[email protected]>
Thanks for the PR. Unfortunately I don't have time to review it right now, but I just wanted to note that the API design is faced with similar challenges as things like pairwise correlation and distances: how to pass variables (matrix, iterator of vectors, and/or Tables.jl object), and whether/how/when to report variable names. See #627 and nalimilan/FreqTables.jl#54. |
Great to see that this kind of API is being worked on. I will work on @bkamins suggestions, and make it ready once you are ready to review. On quick question: Do any of you think we should expect a covariance matrix or should we expect a matrix and do the covariance matrix construction inside the @bkamins could you point me towards on how to implement a test if the the data satisfies tau-equivalence? I'm not a psychometrics specialist... |
I would assume this function should take a covariance matrix. However, then the challenge is with column names as @nalimilan said, as currently we do not have a set standard AFAICT how to pass them.
all off-diagonal values should be the same. But maybe - if other software does not do this check we can also skip it and rely on the user to test it. |
Ok, I also agree that the user should pass a covariance matrix. Regarding tau equivalence, R's |
That is why I have said above that we might consider adding other reliability scores. But we can leave it for later and skip checking the assumptions of the method here. |
Ok, I think all suggestions and reviews were addressed. One thing we need to decide is to whether use the |
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.
Nice - it looks good now. I hope you enjoyed it :). Let us wait for other reviewers now.
Yeah I learned a ton, thanks! I had huge respect for you and all of your work. After this PR it increased orders of magnitude! |
src/reliability.jl
Outdated
|
||
struct Reliability{T <: Real} | ||
alpha::T | ||
dropped::Vector{Pair{Int, T}} |
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.
The first parameter here should be Any
not Int
dropped::Vector{Pair{Int, T}} | |
dropped::Vector{Pair{Any, T}} |
I think.
This would allow passing names to items. The Int
we have now is not useful (it is just a position in a vector so it is redundant).
@storopoli - I would wait with working on this on @nalimilan to comment about the API and passing item names here.
@nalimilan - I believe that the computational part in this PR is finished. We just need to decide on the way we handle the item names.
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.
I suggest we only store a Vector{T}
of values for now. Names can be stored in a separate field if we add support for them later. Anyway it's more practical to store values separately from names than having to access the fields in a pair.
Bump |
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.
Sorry for the delay!
src/reliability.jl
Outdated
|
||
struct Reliability{T <: Real} | ||
alpha::T | ||
dropped::Vector{Pair{Int, T}} |
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.
I suggest we only store a Vector{T}
of values for now. Names can be stored in a separate field if we add support for them later. Anyway it's more practical to store values separately from names than having to access the fields in a pair.
Co-authored-by: Milan Bouchet-Valat <[email protected]>
Thanks @nalimilan I've implemented the desired tests, converted the |
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.
Thanks. Just a few more comments.
Can you also add a reference to the function in the docs so that it's included in the manual? Maybe a new section under Scalar Statistics?
src/reliability.jl
Outdated
``` | ||
""" | ||
function crombach_alpha(covmatrix::AbstractMatrix{<:Real}) | ||
isposdef(covmatrix) || throw(ArgumentError("Covariance matrix is not positive definite!")) |
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.
What about my second comment?
Co-authored-by: Milan Bouchet-Valat <[email protected]>
Ready for a review. See if the docs implementation is enough (never done it before, but followed from the examples in code) |
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.
See if the docs implementation is enough (never done it before, but followed from the examples in code)
Thanks, looks good.
Co-authored-by: Milan Bouchet-Valat <[email protected]>
@nalimilan see if now is fine. I've replaced all "reliability" to "Cronbach's alpha" |
Looks good for me. |
(I am OOO so I have not checked if the documentation renders properly) |
Thanks! |
Great! My Pleasure! |
This is a minimal implementation. It is based on a covariance matrix.
I created a struct
Reliability
to hold the total reliability score and the calculations for each reliability score if a certain item (i.e. column) was dropped from the covariance matrix.There is a set of test functions and I used the Wikipedia example for a covariance matrix both in the tests and in the docstrinngs.
This is my first PR in a Julia package, so please let me know what I can do improve...
Some worthy mentions:
R's
psych::alpha
has the following output:If we were to include variable names we would have to include some
Tables.jl
orDataFrames.jl
dependency.Also, I am only calculating the "vanilla" Crombach's alpha. The
std.alpha
,6(smc)
,average_r S/N
,var.r
andmed.r
were not implemented.