Skip to content
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

IP-SC #171

Open
ampiccinin opened this issue Feb 23, 2017 · 4 comments
Open

IP-SC #171

ampiccinin opened this issue Feb 23, 2017 · 4 comments

Comments

@ampiccinin
Copy link
Member

@andkov - at the risk of taking you off track, is there a quick way for me to view the IP-SC (and IC-SP) correlations? thanks!!

@andkov
Copy link
Member

andkov commented Feb 23, 2017

@ampiccinin ,
yes there is.

source("http://www.statmodel.com/mplus-R/mplus.R") # load

path_gh5 <- "./studies/eas/physical-cognitive/without-errors/gait-2016-11-30/b1_female_aehplus_walking_fluency_gait_bostonnaming.gh5"
testit::assert("File does not exist",file.exists(path_gh5))
# view options: https://www.statmodel.com/mplus-R/GH5_R.shtml

mplus.list.variables(path_gh5) # variables in the gh5 file
mplus.view.plots(path_gh5)  # available graphs for this type of gh5 file
# histograms
mplus.plot.histogram(path_gh5, "SP") # slope of process A
mplus.plot.histogram(path_gh5, "SC") # slope of process B
# scatterplots
mplus.plot.scatterplot(path_gh5, "IP", "IC") # intercepts
mplus.plot.scatterplot(path_gh5, "SP", "SC") # slopes
mplus.plot.scatterplot(path_gh5, "IP", "SP") # physical
mplus.plot.scatterplot(path_gh5, "IC", "SC") # cognitive

fscrores <- mplus.get.data(path_gh5, "SC")
summary(fscrores)

gives you a basic view of the data and factor score scatter plots. Is that what you need? Or you meant to view the value of the estimated parameter?

@andkov
Copy link
Member

andkov commented Feb 23, 2017

@ampiccinin ,
to view the table of the estimated parameters use the MplusAutomation package:

library(MplusAutomation)
library(tidyverse)
path_out <- "./studies/eas/physical-cognitive/without-errors/gait-2016-11-30/b1_female_aehplus_walking_fluency_gait_bostonnaming.out"
model_result <- MplusAutomation::readModels(path_out)
# print all estimated parameters
model_result$parameters$unstandardized 
# print selected paramter
model_result$parameters$unstandardized %>% 
  dplyr::filter(
    paramHeader == "IP.WITH",
    param       == "IC"
  )

@ampiccinin
Copy link
Member Author

@andkov - Can I not see them in the Dynamic summary table? I just can't seem to find it...

@andkov
Copy link
Member

andkov commented Feb 23, 2017

Oh, I see.

No, these are not in this dynamic table. Each model is represented by ~230 indices, so we had to make cuts to keep it manageable. We used to have a table that contained EVERYTHING, but it was my impression it wasn't very popular, because it contained too much. Perhaps, this is a good time to think of a more elegant, yet thorough display that would allow for explorations you've described. I have something in mind.

In the meanwhile, you can access the raw catalog either as a csv or running the following script after loading the Portland repo project into your Rstudio:

rm(list=ls(all=TRUE)) #Clear the memory of variables from previous run. This is not called by knitr, because it's above the first chunk.
# input groups of column names for
source("./scripts/mplus/model-components.R") # organizes variable names
library(tidyverse) # load packages
path_input <- "./data/shared/pc-2-catalog-augmented.csv" # point to the catalog
catalog <- readr::read_csv(path_input) # import catalog
print(model_components) # view groups of variables available
# subset columns
ds <- catalog %>% 
  dplyr::filter(
    study_name   %in% c("map")
  , model_number %in% c("b1")
  , subgroup     %in% c("female","male")
  , model_type   %in% c("a","aehplus")
  , process_a    %in% c("fev")
  , process_b    %in% c("bnt")
  ) %>% 
  dplyr::select_(
    .dots = c(model_components[["id"]],"ab_tau_11_est","ab_tau_00_est")
  )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants