-
Notifications
You must be signed in to change notification settings - Fork 1
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
Find a way to reorganize the nodes in an semPath output #4
Comments
Just found out that qgraph already support using labels to specify the matrix for layout: http://sachaepskamp.com/qgraph/features/1.2.2#Grid_layout Therefore, no need to write a function for this if the model is a path model that does not have a lot of variables. However, it would still be useful to write a function to easily specify the position of a CFA or SEM model with a lot of indicators. |
I am still thinking about how to implement this. The target users are those willing to use code to generate easily reproducible SEM diagrams. The target users are not those like drawing diagrams using programs like Amos and don't like to use code. That said, being user friendly to this group of target users, in terms of writing or generating code, is still important. Approach A: Specify the latent variables layout as in path models.
Then just indicate the direction of the indicators for each latent, usually just "up", "right", "down", and "left," and the function will try to calculate the exact position. This will generate a typical SEM diagrams in psychology.
Approach B: Use a shinyapp to specify the exact position. Start the app (call the function) with the semPath call and the data. The app will show the semPath call and the diagram, probably with sliders for each node. The users use the slider to specify the x- and y-positions of each node manually. The required layout, a k-by-2 matrix with the x- and y-positions for the nodes will be generated. Users can copy and paste it and use it as the value for the layout argument. We can also add a few buttons to allow to automatically align the x or y position of selected nodes (e.g., make all indicators of a latent to have the same x-position).
Approach C: Combing A and B. Use Approach A to generate the starting layout, and use Approach B to adjust the generated layout. This is not really a third approach. If we decided to do both A and B, then C is subsequently available. |
The functions for both CFA models and SEM models have been drafted. I will create a new branch and commit the functions soon. |
Will use this branch: |
set_cfa_position and set_sem_position have been added and tested. They have been merged to the devel and master branches, and the cfa_sem branch has been deleted. Vignettes will be written for them later. |
This can be done manually using a layout matrix. However, it will be helpful to have function to do this in a user-friendly way.
One possible approach is to read the content of an semPath output and output the layout in a meaningful format. Users can then customize the layout using labels instead of numbers as in the layout argument.
Do this in its own branch:
https://github.com/sfcheung/semptools/tree/cfa_sem
The text was updated successfully, but these errors were encountered: