# set the working directory #note that forward slashes are used in file paths in R wd <- "C:/Users/Nisha/Dropbox/aMNLFA/Camtasia" setwd(wd) # installing and loading aMNLFA #install.packages("aMNLFA") library("aMNLFA") #read data file in to an object called "df" #make sure that you have formatted data according to the instructions in the appendix #if data are located in a different directory than wd, specify path df <- read.table("mr.dat",header=TRUE) #look at the first 5 rows of data to make sure it read in properly head(df) # creating aMNLFA object (ob) ob <-aMNLFA.object(path = wd, mrdata = df, indicators = c("AU2","AU3","AU4","AU5","AU6", "AU7","AU8","AC1","AC2","AC3","AC4","AC5"), catindicators = c("AU2","AU3","AU4","AU5","AU6", "AU7","AU8","AC1","AC2","AC3","AC4","AC5"), time = "CNGRADE", meanimpact = c("CNGRADE","BLAEFF","MALEFF","S14","S15","S16","S18","S19","LOWED","HIGHED", "COHORT","GRA_2","BLA_GRA","MAL_GRA", "LOW_GRA","HIG_GRA") , varimpact = c("MALEFF","S14","S15","S16","S18","S19"), measinvar = c("CNGRADE","BLAEFF","MALEFF","S14","S15","S16","S18","S19","LOWED","HIGHED", "COHORT","GRA_2","BLA_GRA","MAL_GRA", "LOW_GRA","HIG_GRA") , factors = c("COHORT","PARED","RACEETH","GENDER","SCHOOL"), ID = "ID", thresholds = FALSE) #look at ob ob # make item plots aMNLFA.itemplots(ob) # draw calibration sample aMNLFA.sample(ob) #srdata should appear in your wd #make Mplus input files for initial models aMNLFA.initial(ob) #run models manually or by running this line: runModels(replaceOutfile = "modifiedDate") #read in output from individual models and prepare simultaneous input file aMNLFA.simultaneous(ob) #run model manually or by running this line: runModels(replaceOutfile = "modifiedDate") # read data from the simultaneous model and make the final model with multiple testing corrections aMNLFA.final(ob) #run the model manually or by running this line: runModels(replaceOutfile = "modifiedDate") #read in final model results and create Mplus input file for generating scores in the full sample aMNLFA.scores(ob) #run the scoring model manually or by running this line: runModels(replaceOutfile = "modifiedDate") #generate descriptive plots for MNLFA scores aMNLFA.scoreplots(ob)