コード例 #1
0
ファイル: stat_tests.py プロジェクト: sdiehl/rpygtk
    def run(self,*event):

        #I tried for WAY to long to get this to work with the high-level interface
        #but it usually resulted in the output having a very long label that
        #contained all the data in the vector we passed to it, still not sure
        #how to resolve it

        args = rdict()

        args['correct'] = self.parameters['Apply continuity correction'].get()

        args = rsession.arguments_to_string(args)

        s1lab,s1data = self.custom_variables['samples'][0]
        if len(self.custom_variables['samples'])==2:
            s2lab,s2data = self.custom_variables['samples'][1]
            x = self.active_r_object[s1lab]
            y = self.active_r_object[s2lab]
            anova_output = rsession.r('mcnemar.test(x=%s,y=%s%s)' % (x, y, args))
        else:
            info('Please select two samples.')

        name = 'T-Test ' + str(self.active_r_object.label)

        self.parent.render_description(anova_output,label=name)
コード例 #2
0
ファイル: stat_tests.py プロジェクト: sdiehl/rpygtk
    def run(self,*event):

        #I tried for WAY to long to get this to work with the high-level interface
        #but it usually resulted in the output having a very long label that
        #contained all the data in the vector we passed to it, still not sure
        #how to resolve it

        args = rdict()

        args['method'] = self.parameters['Method'].get().lower()[0]
        args['conf.level'] = float( self.parameters['Confidence Level'].get() )
        #R takes the first character as an argument
        args['alternative'] = self.parameters['Alternative Hypothesis'].get().lower()[0]
        args['exact'] = self.parameters['Exact'].get()

        args = rsession.arguments_to_string(args)

        s1lab,s1data = self.custom_variables['samples'][0]
        if len(self.custom_variables['samples'])==2:
            s2lab,s2data = self.custom_variables['samples'][1]
            x = self.active_r_object[s1lab]
            y = self.active_r_object[s2lab]
            anova_output = rsession.r('cor.test(x=%s,y=%s,data=%s,%s)' % (x, y, self.active_r_object.label, args))
        else:
            info('Please select two samples.')

        name = 'Correlation Test ' + str(self.active_r_object.label)

        self.parent.render_description(anova_output,label=name)