Week 3: SEM!

We have another consultation lined up for our third R Club this term: Jocelyn has a few models she wants to run for her dissertation, using SEM. She started the analysis in SPSS Amos, but she’s not that far into it yet and she’s wondering if R would be a better choice. She’ll tell us about her models, and we’ll try to write out some code for them! It will be a great opportunity to play around with SEM in R, for those of you who have been looking for an excuse to do that, and I’m guessing it will also be an instructive conversation about how to articulate theories and ideas as statistical models.

Tue (tomorrow) 3:00-4:20pm, in Straub 008.

See you there!

One comment

  1. Nicole Lawless DesJardins

    I recoded all of the child behavior variables in one fell swoop, and then added them together to create a composite variable that theoretically ranges from 0 – 40 (since there were 40 possible behaviors that could’ve occurred). The code is pasted below (it also includes code to create a call index variable for growth model purposes, which I owe to John).


    pdr2<-read.spss("PDR Wave 2.sav", to.data.frame=T)
    pdr4<-read.spss("PDR Wave 4.sav", to.data.frame=T)

    ## generate a time variable (indexes each call for each family)
    group_by(FAMILY) %>% #do the count by family
    arrange(YEAR,MONTH,DAY) %>% #sort by date
    mutate(callindex=1:n()) #create call index that’s 1:end for each family


    ### create composite score of the kid bex (cols 8:47)


    ## recode all of the kid behavior items into numeric variables in one go
    # ignore difference between “occurred, stressed” and “occurred, not stressed”
    # (if it occurred at all, it gets a 1; if it didn’t occur, it’s a 0)
    # the defaults for as.XX.result are both TRUE; if you leave it that way,
    # it will return character variables.

    {x<-recode(x,"'DID NOT OCCUR'='0'; else = '1'",
    as.factor.result=F, as.numeric.result=T)})


    ## now create the composite (sum) variable


Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>