def impute_data(self): ''' compute what we can for each study from what has been given in the table''' # note that we rely on the variable names corresponding to what # the meta_py_r routine expects. var_names = self.get_column_header_strs() for row_index, group_name in enumerate(self.cur_groups): # assemble the fields in a dictionary; pass off to meta_py_r cur_dict = {} for var_index, var_name in enumerate(var_names): var_value = self._get_float(row_index, var_index) if var_value is not None: cur_dict[var_name] = var_value # now pass off what we have for this study to the # imputation routine alpha = self.conf_level_to_alpha() results_from_r = meta_py_r.impute_cont_data(cur_dict, alpha) print "Raw results from R (imputation): %s" % results_from_r print results_from_r print "Results from r succeeded?:", results_from_r["succeeded"] if results_from_r["succeeded"]: computed_vals = results_from_r["output"] # and then iterate over the columns again, # populating the table with any available # computed fields print "Computed vals:",computed_vals for var_index, var_name in enumerate(var_names): self._set_val(row_index, var_index, computed_vals[var_name]) self._copy_raw_data_from_table_to_ma_unit() else: print("Why didn't it succeed?: '%s'" % results_from_r["comment"])
def _impute_data(self): """ compute what we can for each study from what has been given """ # note that we rely on the variable names corresponding to what # the meta_py_r routine expects. var_names = self.get_column_header_strs() for row_index, group_name in enumerate(self.cur_groups): # assemble the fields in a dictionary; pass off to meta_py_r cur_dict = {} for var_index, var_name in enumerate(var_names): var_value = self._get_float(row_index, var_index) if var_value is not None: cur_dict[var_name] = var_value # now pass off what we have for this study to the # imputation routine computed_vals = meta_py_r.impute_cont_data(cur_dict)
def impute_data(self): ''' compute what we can for each study from what has been given in the table''' # note that we rely on the variable names corresponding to what # the meta_py_r routine expects. var_names = self.get_column_header_strs() for row_index, group_name in enumerate(self.cur_groups): # assemble the fields in a dictionary; pass off to meta_py_r cur_dict = {} for var_index, var_name in enumerate(var_names): var_value = self._get_float(row_index, var_index) if var_value is not None: cur_dict[var_name] = var_value # now pass off what we have for this study to the # imputation routine alpha = self.conf_level_to_alpha() results_from_r = meta_py_r.impute_cont_data(cur_dict, alpha) print "Raw results from R (imputation): %s" % results_from_r print results_from_r print "Results from r succeeded?:", results_from_r["succeeded"] if results_from_r["succeeded"]: computed_vals = results_from_r["output"] # and then iterate over the columns again, # populating the table with any available # computed fields print "Computed vals:", computed_vals for var_index, var_name in enumerate(var_names): self._set_val(row_index, var_index, computed_vals[var_name]) self._copy_raw_data_from_table_to_ma_unit() else: try: print("Why didn't it succeed?: '%s'" % results_from_r["comment"]) except KeyError: pass