#Libraries, imports.
df.memory.mplus<-haven::read_dta("C:/Users/mesan/Documents/Current Projects/MemScoreOthers2025/Cassidy_Belinda_20250916/Output/2025-09-16/cabldata.dta")
#raw data that was fed into Mplus
df.memory.ready<-read.csv("C:/Users/mesan/Documents/Current Projects/MemScoreOthers2025/Cassidy_Belinda_20250916/Output/2025-09-16/recoded_data.out.cabl.csv") #%>%
#filter(site=="cabl")
#converting any -9999from Mplus to NAs
df.memory.ready[df.memory.ready==-9999]<-NA
#model output from Mplus
mp.model<-readModels("C:/Users/mesan/Documents/Current Projects/MemScoreOthers2025/Cassidy_Belinda_20250916/Output/2025-09-16/mem_outfile.out")
#Conversion and MIRT modeling
message("Correlation between Mplus and MIRT factor scores")
## Correlation between Mplus and MIRT factor scores
pt.simple.cor
message("Scatterplot of Mplus and MIRT factor SE")
## Scatterplot of Mplus and MIRT factor SE
pt.simple.cor.se
message("Test information plots of Mplus and MIRT factor score")
## Test information plots of Mplus and MIRT factor score
pt.inf.combine
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
message("Association with Logical Memory Delay by Mplus and MIRT factor score")
## Association with Logical Memory Delay by Mplus and MIRT factor score
pt.logmem.combine
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
message("Associations with tau and amyloid positivity")
## Associations with tau and amyloid positivity
pt.pos.combine