MCPcopy Index your code
hub / github.com/statsmodels/statsmodels / f

Function f

examples/python/variance_components.py:91–101  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

89
90
91def f(x):
92 n = x.shape[0]
93 g2 = x.group2
94 u = g2.unique()
95 u.sort()
96 uv = {v: k for k, v in enumerate(u)}
97 mat = np.zeros((n, len(u)))
98 for i in range(n):
99 mat[i, uv[g2.iloc[i]]] = 1
100 colnames = ["%d" % z for z in u]
101 return mat, colnames
102
103
104# Then we set up the variance components using the VCSpec class.

Callers 1

Calls 1

sortMethod · 0.80

Tested by

no test coverage detected