예제 #1
0
def main():
  # (MANOVA?) GLM general linear model with within subject comparisons of interest, gender, diff
  f = open('manova-proreaddiff.txt','w+')
  
  # VARIABLES
  nameList = ['vo', 'gc','ac','sk', 'pp', 'kt', 'kc','de', 'cv','fp','fa','ya','na', 'nv','nc','in','nt','tg','di','nd']
  labelList= ['vocab','generalcomp','factuncertainty','seperating','confuseprevious','lacktopicknow','lackcontentknow','toodetailed','cantverbalize','forgetparagraph','forgetall','positiveaffect','negativeaffect','nervous','noconcentrate','interviewerprocedure','notalki', 'toogeneral','distractor','nodifficulties']
  proquestions = ['1','2','3']
  suffix = ['im','ii','bm','bi']
  
  stratdiff = "d"
  promain= "p"
  mathread = "r"
  GLMtext = makeGLMtext()  
  
  f.write("DATASET COPY  proCopy WINDOW=FRONT.\nDATASET ACTIVATE proCopy.\n"
  for i in range(len(nameList)):
  
    #RECODE AND COMPUTE
    nameListi = nameList[i]
    labelListi = labelList[i]    
    recodeline = GLMfunctions.makeRecodeLine(suffix,proquestions,promain,mathread,stratdiff,nameListi)
    computelines = GLMfunctions.makeComputeLines(suffix,proquestions,promain,mathread,stratdiff,nameListi,labelListi)
  
    s = recodeline+computelines
    
    f.write(s)
  
    # GLM
    text = "GLM " + labelListi+"im "+ labelListi+"ii "+ labelListi+"bm "+ labelListi+"bi "+"BY sex"
    f.write(text)
    f.write(GLMtext)
    f.write('\n')

  
  # GROUPED
  
  readdiff1 = ["vocab", "generalcomp", "lackcontentknow"]
  readdiff2 = ["toodetailed", "forgetall"]
  readdiff3 = ["negativeaffect", "toogeneral"]
  
  GLMfunctions.printCompute(readdiff1,"readdiff1",suffix,GLMtext,f)
  GLMfunctions.printCompute(readdiff2,"readdiff2",suffix,GLMtext,f)
  GLMfunctions.printCompute(readdiff3,"readdiff3",suffix,GLMtext,f)
  
  # Recall vs encoding vs comprehension monitoring   
  recall = ['cantverbalize','forgetparagraph','forgetall','nervous','noconcentrate','notalki', 'toogeneral','distractor'] 
  encoding = ['vocab','generalcomp','factuncertainty','seperating','confuseprevious','lacktopicknow','lackcontentknow','toodetailed','positiveaffect','negativeaffect'] 
  compmonitor = [] 
   
  # Rehearsal vs elaboration vs organizational vs comprehension monitoring vs affective/motivational 
  rehearsal = ['cantverbalize','forgetparagraph','forgetall'] 
  elaboration = ['lacktopicknow','lackcontentknow','positiveaffect','negativeaffect'] 
  organizational = ['vocab','generalcomp','factuncertainty','seperating','confuseprevious','toodetailed','toogeneral'] 
  compmonitor2 = ['notalki'] 
  affectivemot = ['nervous','noconcentrate','distractor'] 
   
  #Basic vs complex for rehearsal, elaboration, organizational 
  rehearsalb = ['cantverbalize','forgetparagraph','forgetall'] 
  elaborationb = [] 
  organizationalb = ['vocab','generalcomp','confuseprevious','toodetailed','toogeneral'] 
  rehearsalc = [] 
  elaborationc = ['lacktopicknow','lackcontentknow','positiveaffect','negativeaffect'] 
  organizationalc = ['factuncertainty','seperating'] 
   
  selection = ['confuseprevious','toodetailed','positiveaffect','negativeaffect'] 
  acquisition = ['vocab','generalcomp'] 
  construction = ['factuncertainty'] 
  integration = ['seperating','lacktopicknow','lackcontentknow'] 
   
   
   
  allgroups = [recall,encoding,compmonitor,rehearsal, elaboration, organizational, compmonitor2, affectivemot, rehearsalb, elaborationb, organizationalb, rehearsalc, elaborationc, organizationalc, selection, acquisition, construction, integration] 
  allgroupsname = ['recall','encoding','compmonitor','rehearsal', 'elaboration', 'organizational', 'compmonitor2', 'affectivemot', 'rehearsalb', 'elaborationb', 'organizationalb', 'rehearsalc', 'elaborationc', 'organizationalc', 'selection', 'acquisition', 'construction', 'integration'] 
   
  for k in range(len(allgroups)):
    for j in range(len(suffix)):
      f.write("compute " + allgroupsname[k] + suffix[j] +" = (")
      for i in range(len(allgroups[k])):
        if i != 0:
          f.write("+")
        f.write(allgroups[k][i]+suffix[j])
      f.write(")/" + str(len(allgroups[k])) + ".\n")
  
    f.write("\n\nGLM") 
  
    for j in range(len(suffix)):
      f.write(" "+ allgroupsname[k]+suffix[j])
    f.write(" BY sex") 
    f.write(GLMtext + "\n") 
 

main()
  
예제 #2
0
def main():

    # (MANOVA?) GLM general linear model with within subject comparisons of interest, gender, diff
    f = open('manova-promathstrat.txt', 'w+')

    # VARIABLES
    nameList = [
        'pa', 'ss', 'ky', 'kc', 'kn', 'nm', 'el', 'un', 'es', 're', 'rc', 'rn',
        'sp', 'vi', 'sk', 'pe', 'pk', 'r1', 'gu'
    ]
    labelList = [
        'parts', 'sentence', 'keywords', 'keywordscontext', 'keywordsnumbers',
        'numbers', 'eliminatekeys', 'usesallnum', 'estimate', 'reasonable',
        'rereadscomp', 'rereadsnum', 'paraphrase', 'visualize', 'sketch',
        'personalexp', 'priorknow', 'readthrough1st', 'guess'
    ]
    proquestions = ['1', '2', '3']
    suffix = ['im', 'ii', 'bm', 'bi']

    stratdiff = "s"
    promain = "p"
    mathread = "m"
    GLMtext = GLMfunctions.makeGLMtext()

    f.write("DATASET COPY  proCopy WINDOW=FRONT.\nDATASET ACTIVATE proCopy.\n")
    for i in range(len(nameList)):
        #RECODE AND COMPUTE
        nameListi = nameList[i]
        labelListi = labelList[i]
        recodeline = GLMfunctions.makeRecodeLine(suffix, proquestions, promain,
                                                 mathread, stratdiff,
                                                 nameListi)
        computelines = GLMfunctions.makeComputeLines(suffix, proquestions,
                                                     promain, mathread,
                                                     stratdiff, nameListi,
                                                     labelListi)

        s = recodeline + computelines

        f.write(s)

        # GLM
        text = "GLM " + labelListi + "im " + labelListi + "ii " + labelListi + "bm " + labelListi + "bi " + "BY sex"
        f.write(text)
        f.write(GLMtext)
        f.write('\n')

    # GROUPED

    mathstrat1 = ["sentence", "usesallnum"]
    mathstrat3 = ["paraphrase", "visualize"]
    mathstrat5 = ["eliminateskeys", "rereadsnum"]

    GLMfunctions.printCompute(mathstrat1, "mathstrat1", suffix, GLMtext, f)
    GLMfunctions.printCompute(mathstrat3, "mathstrat3", suffix, GLMtext, f)
    GLMfunctions.printCompute(mathstrat5, "mathstrat5", suffix, GLMtext, f)

    # Rehearsal vs elaboration vs organizational vs comprehension monitoring vs affective/motivational
    rehearsal = []
    elaboration = [
        'paraphrase', 'visualize', 'sketch', 'personalexp', 'priorknow'
    ]
    organizational = [
        'parts', 'sentence', 'keywords', 'keywordscontext', 'keywordsnumbers',
        'numbers', 'eliminatekeys', 'usesallnum'
    ]
    compmonitor2 = [
        'estimate', 'reasonable', 'rereadscomp', 'rereadsnum', 'readthrough1st'
    ]
    affectivemot = []

    #Basic vs complex for rehearsal, elaboration, organizational
    rehearsalb = []
    elaborationb = ['visualize', 'sketch']
    organizationalb = ['numbers', 'eliminatekeys', 'usesallnum']
    affectivemotb = []
    rehearsalc = []
    elaborationc = ['paraphrase', 'personalexp', 'priorknow']
    organizationalc = [
        'parts', 'sentence', 'keywords', 'keywordscontext', 'keywordsnumbers'
    ]

    allgroups = [
        rehearsal, elaboration, organizational, compmonitor2, affectivemot,
        rehearsalb, elaborationb, organizationalb, rehearsalc, elaborationc,
        organizationalc
    ]
    allgroupsname = [
        'rehearsal', 'elaboration', 'organizational', 'compmonitor2',
        'affectivemot', 'rehearsalb', 'elaborationb', 'organizationalb',
        'rehearsalc', 'elaborationc', 'organizationalc'
    ]

    for k in range(len(allgroups)):
        for j in range(len(suffix)):
            f.write("compute " + allgroupsname[k] + suffix[j] + " = (")
            for i in range(len(allgroups[k])):
                if i != 0:
                    f.write("+")
                f.write(allgroups[k][i] + suffix[j])
            f.write(")/" + str(len(allgroups[k])) + ".\n")

        f.write("\n\nGLM")

        for j in range(len(suffix)):
            f.write(" " + allgroupsname[k] + suffix[j])
        f.write(" BY sex")
        f.write(GLMtext + "\n")
예제 #3
0
def main():
  
  #(MANOVA?) GLM general linear model with within subject comparisons of interest, gender, diff
  
  # VARIABLES
  nameList = ['pp', 'gp','tb','bt', 't1', 'tl', 'ni','dn', 'cv','td','pe','kn','uv', 'rp','ya','na']
  labelList= ['point2point', 'gist2point', 'top2bottom', 'bottom2top', 'firstthing', 'lastthing', 'novelinfo', 'datesnumnames', 'concurrentverb', 'duringdistractor', 'personalexp', 'generalknowledge', 'visualizations', 'repitition','mainidea', 'keytopicword']
  proquestions = ['1','2','3']
  suffix = ['im','ii','bm','bi']
 
  stratdiff = "s"
  promain= "p"
  mathread = "r"
  GLMtext = GLMfunctions.makeGLMtext()  
  
  f.write("DATASET COPY  proCopy WINDOW=FRONT.\nDATASET ACTIVATE proCopy.\n"
  for i in range(0,2):
    ## SELECT HIGH INTEREST ## 
    filtersign = ["~=","="]
    if mathread == "m":
      spint = "mathspint"
    elif mathread == "r":
      spint = "readspint"
    
    filterText = """USE ALL. \nCOMPUTE filter_$=("""+spint+filtersign[i]+ "2"+"""). \nVARIABLE LABELS filter_$ '""" + spint+filtersign[i]+ "2" +"""(FILTER)'. \nVALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. \nFORMATS filter_$ (f1.0). \nFILTER BY filter_$. \nEXECUTE.\n\n"""
  
    f.write(filterText)
  
    for i in range(len(nameList)):
    
     #RECODE AND COMPUTE
      nameListi = nameList[i]
      labelListi = labelList[i]    
      recodeline = GLMfunctions.makeRecodeLine(suffix,proquestions,promain,mathread,stratdiff,nameListi)
      computelines = GLMfunctions.makeComputeLines(suffix,proquestions,promain,mathread,stratdiff,nameListi,labelListi)
    
      s = recodeline+computelines
      
      f.write(s)
    
      # GLM
      text = "GLM " + labelListi+"im "+ labelListi+"ii "+ labelListi+"bm "+ labelListi+"bi "+"BY sex"
      f.write(text)
      f.write(GLMtext)
      f.write('\n')

    
    # GROUPED
    
    readstrat1 = ["point2point", "top2bottom"]
  
    GLMfunctions.printCompute(readstrat1,"readstrat1",suffix,GLMtext,f)
  
    recall = ['point2point', 'gist2point', 'top2bottom', 'bottom2top', 'firstthing', 'lastthing'] 
    encoding = ['novelinfo', 'datesnumnames','personalexp','generalknowledge','visualizations','mainidea','keytopicword'] 
    compmonitor = ['concurrentverb','duringdistractor','repitition'] 
     
    # Rehearsal vs elaboration vs organizational vs comprehension monitoring vs affective/motivational 
    rehearsal = ['duringdistractor', 'repitition'] 
    elaboration = ['novelinfo','datesnumnames','personalexp','generalknowledge','visualizations'] 
    organizational = ['point2point', 'gist2point', 'top2bottom', 'bottom2top', 'firstthing', 'lastthing','mainidea','keytopicword'] 
    compmonitor2 = ['concurrentverb'] 
    affectivemot = [] 
     
    #Basic vs complex for rehearsal, elaboration, organizational 
    rehearsalb = ['repitition'] 
    elaborationb = ['novelinfo','datesnumnames','personalexp','generalknowledge','visualizations'] 
    organizationalb = ['point2point', 'top2bottom', 'bottom2top', 'firstthing', 'lastthing'] 
    rehearsalc = ['duringdistractor'] 
    elaborationc = [] 
    organizationalc = ['gist2point','mainidea','keytopicword'] 
     
    selection = ['novelinfo','datesnumnames'] 
    acquisition = [] 
    construction = ['visualizations','mainidea','keytopicword'] 
    integration = ['personalexp','generalknowledge'] 
        
     
    allgroups = [recall,encoding,compmonitor,rehearsal, elaboration, organizational, compmonitor2, affectivemot, rehearsalb, elaborationb, organizationalb, rehearsalc, elaborationc, organizationalc, selection, acquisition, construction, integration] 
    allgroupsname = ['recall','encoding','compmonitor','rehearsal', 'elaboration', 'organizational', 'compmonitor2', 'affectivemot', 'rehearsalb', 'elaborationb', 'organizationalb', 'rehearsalc', 'elaborationc', 'organizationalc', 'selection', 'acquisition', 'construction', 'integration'] 
     
    for k in range(len(allgroups)):
      for j in range(len(suffix)):
        f.write("compute " + allgroupsname[k] + suffix[j] +" = (")
        for i in range(len(allgroups[k])):
          if i != 0:
            f.write("+")
          f.write(allgroups[k][i]+suffix[j])
        f.write(")/" + str(len(allgroups[k])) + ".\n")
    
      f.write("\n\nGLM") 
    
      for j in range(len(suffix)):
        f.write(" "+ allgroupsname[k]+suffix[j])
      f.write(" BY sex") 
      f.write(GLMtext + "\n") 
    ## REMOVE FILTER ##
    
    f.write("""FILTER OFF.\nUSE ALL.\nEXECUTE.\n\n""")
main()
  
예제 #4
0
def main():

    # (MANOVA?) GLM general linear model with within subject comparisons of interest, gender, diff

    # VARIABLES
    nameList = [
        'su', 'sp', 'cd', 'cp', 'ck', 'cv', 'ex', 'td', 'lk', 'ua', 'qu', 'pa',
        'na', 'ct'
    ]
    labelList = [
        'setup', 'partialsetup', 'comprehension', 'comprehensionparts',
        'keywordcomprehension', 'vocabcomprehension', 'extramissinginfo',
        'toodetailed', 'lackknowledge', 'unreasonable', 'questiondifficulty',
        'positiveaffect', 'negativeaffect', 'concentration'
    ]
    proquestions = ['1', '2', '3']
    suffix = ['im', 'ii', 'bm', 'bi']

    stratdiff = "d"
    promain = "p"
    mathread = "m"
    GLMtext = GLMfunctions.makeGLMtext()

    for i in range(1, 3):
        ## SELECT HIGH INTEREST ##

        if mathread == "r":
            high = [1, 2]
            low = [4, 5]
        elif mathread == "m":
            high = [1, 4]
            low = [2, 5]
        if i == 1:
            filterText = """USE ALL. \nCOMPUTE filter_$=(cell = """ + str(
                high[0]
            ) + "| " + """cell = """ + str(
                high[1]
            ) + """). \nVARIABLE LABELS filter_$ 'cell = """ + str(
                high[0]
            ) + " | " + str(
                high[1]
            ) + """(FILTER)'. \nVALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. \nFORMATS filter_$ (f1.0). \nFILTER BY filter_$. \nEXECUTE.\n\n"""
        elif i == 2:
            filterText = """USE ALL. \nCOMPUTE filter_$=(cell = """ + str(
                low[0]
            ) + "| " + """cell = """ + str(
                low[1]
            ) + """). \nVARIABLE LABELS filter_$ 'cell = """ + str(
                low[0]
            ) + " | " + str(
                low[1]
            ) + """(FILTER)'. \nVALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. \nFORMATS filter_$ (f1.0). \nFILTER BY filter_$. \nEXECUTE.\n\n"""

        f.write(
            "DATASET COPY  proCopy WINDOW=FRONT.\nDATASET ACTIVATE proCopy.\n")

        f.write(filterText)

        for i in range(len(nameList)):
            #RECODE AND COMPUTE
            nameListi = nameList[i]
            labelListi = labelList[i]
            recodeline = GLMfunctions.makeRecodeLine(suffix, proquestions,
                                                     promain, mathread,
                                                     stratdiff, nameListi)
            computelines = GLMfunctions.makeComputeLines(
                suffix, proquestions, promain, mathread, stratdiff, nameListi,
                labelListi)

            s = recodeline + computelines

            f.write(s)

            # GLM
            text = "GLM " + labelListi + "im " + labelListi + "ii " + labelListi + "bm " + labelListi + "bi " + "BY sex"
            f.write(text)
            f.write(GLMtext)
            f.write('\n')

        # GROUPED

        mathdiff1 = [
            "setup", "comprehension", "extramissinginfo", "toodetailed",
            "partialsetup", "negativeaffect", "questiondifficulty"
        ]
        mathdiff2 = [
            "vocabcomprehension", "lackknowledge", "comprehensionparts"
        ]

        GLMfunctions.printCompute(mathdiff1, "mathdiff1", suffix, GLMtext, f)
        GLMfunctions.printCompute(mathdiff2, "mathdiff2", suffix, GLMtext, f)

        # Rehearsal vs elaboration vs organizational vs comprehension monitoring vs affective/motivational
        rehearsal = [
            'keywordcomprehension', 'vocabcomprehension', 'questiondifficulty'
        ]
        elaboration = [
            'comprehension', 'comprehensionparts', 'lackknowledge',
            'positiveaffect', 'negativeaffect'
        ]
        organizational = ['setup', 'partialsetup', 'toodetailed']
        compmonitor2 = ['extramissinginfo', 'unreasonable']
        affectivemot = ['concentration']

        #Basic vs complex for rehearsal, elaboration, organizational
        rehearsalb = [
            'keywordcomprehension', 'vocabcomprehension', 'questiondifficulty'
        ]
        elaborationb = ['lackknowledge']
        organizationalb = ['setup', 'partialsetup', 'toodetailed']
        affectivemotb = []
        rehearsalc = []
        elaborationc = [
            'comprehension', 'comprehensionparts', 'positiveaffect',
            'negativeaffect'
        ]
        organizationalc = []

        allgroups = [
            rehearsal, elaboration, organizational, compmonitor2, affectivemot,
            rehearsalb, elaborationb, organizationalb, rehearsalc,
            elaborationc, organizationalc
        ]
        allgroupsname = [
            'rehearsal', 'elaboration', 'organizational', 'compmonitor2',
            'affectivemot', 'rehearsalb', 'elaborationb', 'organizationalb',
            'rehearsalc', 'elaborationc', 'organizationalc'
        ]

        for k in range(len(allgroups)):
            for j in range(len(suffix)):
                f.write("compute " + allgroupsname[k] + suffix[j] + " = (")
                for i in range(len(allgroups[k])):
                    if i != 0:
                        f.write("+")
                    f.write(allgroups[k][i] + suffix[j])
                f.write(")/" + str(len(allgroups[k])) + ".\n")

            f.write("\n\nGLM")

            for j in range(len(suffix)):
                f.write(" " + allgroupsname[k] + suffix[j])
            f.write(" BY sex")
            f.write(GLMtext + "\n")

        ## REMOVE FILTER ##

        f.write("""FILTER OFF.\nUSE ALL.\nEXECUTE.\n\n""")
예제 #5
0
def main():

  #(MANOVA?) GLM general linear model with within subject comparisons of interest, gender, diff

  f = open('manova-proreadstrat.txt','w+')

  # VARIABLES
  nameList = ['ptp', 'gtp','ttb','btt', 'th1', 'fin', 'nov','dnn', 'ver','tid','pex','pkn','eye', 'agn','ide','ktw']
  labelList= ['point2point', 'gist2point', 'top2bottom', 'bottom2top', 'firstthing', 'lastthing', 'novelinfo', 'datesnumnames', 'concurrentverb', 'duringdistractor', 'personalexp', 'generalknowledge', 'visualizations', 'repitition','mainidea', 'keytopicword']
  proquestions = ['1','2','3']
  suffix = ['im','ii','bm','bi']
 
  stratdiff = "s"
  promain= "p"
  mathread = "r"
  GLMtext = GLMfunctions.makeGLMtext()  
  
  f.write("DATASET COPY  proCopy WINDOW=FRONT.\nDATASET ACTIVATE proCopy.\n"
  for i in range(len(nameList)):
  
    #RECODE AND COMPUTE
    nameListi = nameList[i]
    labelListi = labelList[i]    
    recodeline = GLMfunctions.makeRecodeLine(suffix,proquestions,promain,mathread,stratdiff,nameListi)
    computelines = GLMfunctions.makeComputeLines(suffix,proquestions,promain,mathread,stratdiff,nameListi,labelListi)
  
    s = recodeline+computelines
    
    f.write(s)
  
    # GLM
    text = "GLM " + labelListi+"im "+ labelListi+"ii "+ labelListi+"bm "+ labelListi+"bi "+"BY sex"
    f.write(text)
    f.write(GLMtext)
    f.write('\n')
  
  # GROUPED
  
  readstrat1 = ["point2point", "top2bottom"]

  GLMfunctions.printCompute(readstrat1,"readstrat1",suffix,GLMtext,f)

  recall = ['point2point', 'gist2point', 'top2bottom', 'bottom2top', 'firstthing', 'lastthing'] 
  encoding = ['novelinfo', 'datesnumnames','personalexp','generalknowledge','visualizations','mainidea','keytopicword'] 
  compmonitor = ['concurrentverb','duringdistractor','repitition'] 
   
  # Rehearsal vs elaboration vs organizational vs comprehension monitoring vs affective/motivational 
  rehearsal = ['duringdistractor', 'repitition'] 
  elaboration = ['novelinfo','datesnumnames','personalexp','generalknowledge','visualizations'] 
  organizational = ['point2point', 'gist2point', 'top2bottom', 'bottom2top', 'firstthing', 'lastthing','mainidea','keytopicword'] 
  compmonitor2 = ['concurrentverb'] 
  affectivemot = [] 
   
  #Basic vs complex for rehearsal, elaboration, organizational 
  rehearsalb = ['repitition'] 
  elaborationb = ['novelinfo','datesnumnames','personalexp','generalknowledge','visualizations'] 
  organizationalb = ['point2point', 'top2bottom', 'bottom2top', 'firstthing', 'lastthing'] 
  affectivemotb = [] 
  rehearsalc = ['duringdistractor'] 
  elaborationc = [] 
  organizationalc = ['gist2point','mainidea','keytopicword'] 
   
  selection = ['novelinfo','datesnumnames'] 
  acquisition = [] 
  construction = ['visualizations','mainidea','keytopicword'] 
  integration = ['personalexp','generalknowledge'] 
      
   
  allgroups = [recall,encoding,compmonitor,rehearsal, elaboration, organizational, compmonitor2, affectivemot, rehearsalb, elaborationb, organizationalb, rehearsalc, elaborationc, organizationalc, selection, acquisition, construction, integration] 
  allgroupsname = ['recall','encoding','compmonitor','rehearsal', 'elaboration', 'organizational', 'compmonitor2', 'affectivemot', 'rehearsalb', 'elaborationb', 'organizationalb', 'rehearsalc', 'elaborationc', 'organizationalc', 'selection', 'acquisition', 'construction', 'integration'] 
   
  for k in range(len(allgroups)):
    for j in range(len(suffix)):
      f.write("compute " + allgroupsname[k] + suffix[j] +" = (")
      for i in range(len(allgroups[k])):
        if i != 0:
          f.write("+")
        f.write(allgroups[k][i]+suffix[j])
      f.write(")/" + str(len(allgroups[k])) + ".\n")
  
    f.write("\n\nGLM") 
  
    for j in range(len(suffix)):
      f.write(" "+ allgroupsname[k]+suffix[j])
    f.write(" BY sex") 
    f.write(GLMtext + "\n") 
 


main()
  
예제 #6
0
def main():

    # (MANOVA?) GLM general linear model with within subject comparisons of interest, gender, diff

    f = open('manova-promathdiff.txt', 'w+')

    # VARIABLES
    nameList = [
        'su', 'sp', 'cd', 'cp', 'ck', 'cv', 'ex', 'td', 'lk', 'ua', 'qu', 'pa',
        'na', 'ct'
    ]
    labelList = [
        'setup', 'partialsetup', 'comprehension', 'comprehensionparts',
        'keywordcomprehension', 'vocabcomprehension', 'extramissinginfo',
        'toodetailed', 'lackknowledge', 'unreasonable', 'questiondifficulty',
        'positiveaffect', 'negativeaffect', 'concentration'
    ]
    proquestions = ['1', '2', '3']
    suffix = ['im', 'ii', 'bm', 'bi']

    stratdiff = "d"
    promain = "p"
    mathread = "m"
    GLMtext = GLMfunctions.makeGLMtext()

    f.write("DATASET COPY  proCopy WINDOW=FRONT.\nDATASET ACTIVATE proCopy.\n")

    for i in range(len(nameList)):
        #RECODE AND COMPUTE
        nameListi = nameList[i]
        labelListi = labelList[i]
        recodeline = GLMfunctions.makeRecodeLine(suffix, proquestions, promain,
                                                 mathread, stratdiff,
                                                 nameListi)
        computelines = GLMfunctions.makeComputeLines(suffix, proquestions,
                                                     promain, mathread,
                                                     stratdiff, nameListi,
                                                     labelListi)

        s = recodeline + computelines

        f.write(s)

        # GLM
        text = "GLM " + labelListi + "im " + labelListi + "ii " + labelListi + "bm " + labelListi + "bi " + "BY sex"
        f.write(text)
        f.write(GLMtext)
        f.write('\n')

    # GROUPED

    mathdiff1 = [
        "setup", "comprehension", "extramissinginfo", "toodetailed",
        "partialsetup", "negativeaffect", "questiondifficulty"
    ]
    mathdiff2 = ["vocabcomprehension", "lackknowledge", "comprehensionparts"]

    GLMfunctions.printCompute(mathdiff1, "mathdiff1", suffix, GLMtext, f)
    GLMfunctions.printCompute(mathdiff2, "mathdiff2", suffix, GLMtext, f)

    # Rehearsal vs elaboration vs organizational vs comprehension monitoring vs affective/motivational
    rehearsal = [
        'keywordcomprehension', 'vocabcomprehension', 'questiondifficulty'
    ]
    elaboration = [
        'comprehension', 'comprehensionparts', 'lackknowledge',
        'positiveaffect', 'negativeaffect'
    ]
    organizational = ['setup', 'partialsetup', 'toodetailed']
    compmonitor2 = ['extramissinginfo', 'unreasonable']
    affectivemot = ['concentration']

    #Basic vs complex for rehearsal, elaboration, organizational
    rehearsalb = [
        'keywordcomprehension', 'vocabcomprehension', 'questiondifficulty'
    ]
    elaborationb = ['lackknowledge']
    organizationalb = ['setup', 'partialsetup', 'toodetailed']
    affectivemotb = []
    rehearsalc = []
    elaborationc = [
        'comprehension', 'comprehensionparts', 'positiveaffect',
        'negativeaffect'
    ]
    organizationalc = []

    allgroups = [
        rehearsal, elaboration, organizational, compmonitor2, affectivemot,
        rehearsalb, elaborationb, organizationalb, rehearsalc, elaborationc,
        organizationalc
    ]
    allgroupsname = [
        'rehearsal', 'elaboration', 'organizational', 'compmonitor2',
        'affectivemot', 'rehearsalb', 'elaborationb', 'organizationalb',
        'rehearsalc', 'elaborationc', 'organizationalc'
    ]

    for k in range(len(allgroups)):
        for j in range(len(suffix)):
            f.write("compute " + allgroupsname[k] + suffix[j] + " = (")
            for i in range(len(allgroups[k])):
                if i != 0:
                    f.write("+")
                f.write(allgroups[k][i] + suffix[j])
            f.write(")/" + str(len(allgroups[k])) + ".\n")

        f.write("\n\nGLM")

        for j in range(len(suffix)):
            f.write(" " + allgroupsname[k] + suffix[j])
        f.write(" BY sex")
        f.write(GLMtext + "\n")