def fill_beta_from_beta_alt(self,submodels=None):
     if submodels==None:
         submodels = arange(self.get_nsubmodels())
     for name in self.other_measures_alt.keys():
         if not name in self.other_measures.keys():
             self.initialize_arrays_of_other_measures([name])
     index = create_combination_indices(tuple([self.nequations(), self.size()] + list(self.get_other_ndim())))
     for k in submodels:
         for l in range(index.shape[0]):
             if index[l].size > 2:
                 tidx = tuple(index[l][0:2].tolist() + [k] + index[l][2:].tolist())
                 tidx_alt = tuple([index[l][0], self.coefmap[tidx], k] + index[l][2:].tolist())
             else:
                 tidx = tuple(index[l][0:2].tolist() + [k])
                 tidx_alt = tuple([index[l][0], self.coefmap[tidx], k])
             if self.coefmap[tidx] >= 0:
                 self.beta[tidx] = self.beta_alt[tidx_alt]
                 self.beta_se[tidx] = self.beta_se_alt[tidx_alt]
                 for m in self.other_measures_alt.keys():
                     self.other_measures[m][tidx] = self.other_measures_alt[m][tidx_alt]
             else:
                 self.beta[tidx] = 0.0
                 self.beta_se[tidx] = 0.0
                 for m in self.other_measures_alt.keys():
                     self.other_measures[m][tidx] = 0.0
 def create_beta_alt(self):
     """Transform beta and beta_se into beta_alt and beta_se_alt."""
     ncoef = self.get_coefficient_names().size
     nsub = self.get_nsubmodels()
     neqs = self.nequations()
     shape = tuple([neqs, ncoef, nsub] + list(self.get_other_ndim()))
     self.beta_alt = zeros(shape, dtype=float32)
     self.beta_se_alt = zeros(shape, dtype=float32)
     self.coefmap_alt = resize(array([-2], dtype="int32"), (ncoef, nsub))
     index = create_combination_indices(tuple([neqs, self.size(), nsub] + list(self.get_other_ndim())))
     for i in range(index.shape[0]):
         tindex = tuple(index[i].tolist())
         if self.coefmap[tindex] >= 0:
             self.beta_alt[tuple([tindex[0], self.coefmap[tindex]] + list(tindex[2:]))] = self.beta[tindex]
             self.beta_se_alt[tuple([tindex[0], self.coefmap[tindex]] + list(tindex[2:]))] = self.beta_se[tindex]
             self.coefmap_alt[self.coefmap[tindex], tindex[2]] = tindex[1]
 def fill_values(self):
     values = self.coefficients.get_values()
     se =  self.coefficients.get_standard_errors()
     others = {}
     for key in self.other_measures.keys():
         others[key] = self.coefficients.get_measure(key)
     shape = self.getshape()
     # create combinations of all indices
     index = create_combination_indices(shape)
         
     for i in range(index.shape[0]):
         tindex = tuple(index[i].tolist())
         if self.coefmap[tindex] < 0:
             self.beta[tindex] = 0.0
             self.beta_se[tindex] = 0.0
             for key in self.other_measures.keys():
                 self.other_measures[key][tindex] = 0.0
         else:
             self.beta[tindex] = values[self.coefmap[tindex]]
             self.beta_se[tindex] = se[self.coefmap[tindex]]
             for key in self.other_measures.keys():
                 self.other_measures[key][tindex] = others[key][self.coefmap[tindex]]