问题
I am reformulating this question because it seems that the information that I provided before is not that clear.
I'm new using R so I'm not able yet to identify the most common and simple errors.
So I'm following a tutorial to perform a McDonald Omega analysis to estimate reliability on a psychometric test, here is the link just to make you sure about source of the information that I'm using:
http://personality-project.org/r/psych/HowTo/omega.pdf
To run that analyisis, we work with the "psych" package. The package includes the function omegaSem, wich should result in a report of the resulting group factor loads for the variables involved.
The issue appears when I try to make the analysis, the result is that one of the arguments is actualy a not found object. Here's the code:
> omegaSem(r9,n.obs=240,lavaan=TRUE)
Error in is.data.frame(m) : object 'r9' not found
> omegaSem(9,n.obs=240,lavaan=TRUE)
Error: $ operator is invalid for atomic vectors
So the parameter that seems to be lost is the m one. Wich on the help page is defined:
m: A correlation matrix, or a data.frame/matrix of data, or (if Phi) is specified, an oblique factor pattern matrix
Well, I dont understand how this argument needs to be setted to run the code succesfully. I'm doing everything like is advised in the tutorial and i dont have the same outcome.
Here I'm thinking if maybe I have to define this matrix so I can refer to that in the omegaSem statement. I don't fully understand how this matrix works in relation to my data and to this analysis.
Any idea of what I'm missing here?
I've verified all the requirement to perform the analysis, like confirm the installation of all needed packages. Since last friday I'm trying to search for other questions here and today I just searched on google for examples and other documentation to solve this but I have nothing. Then, I searched for the help page of the package and realized that the m parameter or argument is not being properly setted. And I don't sure about how can I use it or write it properly.
Please, let me know if you need any other code piece, procedure or details about the work I'm doing to understand this issue or to track a different cause of the problem. I will answer you soon.
Because of my low expertise working on R, I don't refuse the fact that maybe this is a simply syntax error that I'm not aware about.
My expectations is to have the correct output, and to understand how this function and its arguments and parameters works , including the matrix detail.
I would highly appreciate any help! Thank you so much. Cheers, Danilo. Psychologist
------------------------------TENTATIVE ANSWER----------------------------------
After reading some documentation I decided to e-mail Dr. William, the author of the psych package, and he concluded that there was a lack of information in the guide. So the solution is that you have to assign that r9 variable or anyone to an actual database, so in order to perform that omegaSem() function you have to assign that variable correctly. For example:
r9 <- Thurstone
Thurstone is a database that comes with the psych package, so after that, you are able to get the expected output
You can also set:
r9 <- my.data
to assign that variable to any database defined in my.data
In conclusion, the r9 <- Thurstone statement was missing in the documentation
来源:https://stackoverflow.com/questions/57661750/one-of-the-omegasem-function-arguments-is-an-object-not-found