mosaicperm.tilings.default_factor_tiles

mosaicperm.tilings.default_factor_tiles(exposures: array, n_obs: int | None = None, batches: list[array] | None = None, max_batchsize: int | None = 10, ngroups: int | None = None, clusters: array | None = None, seed: int = 123) Tiling[source]

Computes default tiling for factor models.

Parameters:
exposuresnp.array

(n_obs, n_subjects, n_factors) array of factor exposures OR (n_subjects, n_factors) array of factor exposures if the exposures do not change with time.

n_obsint

Number of timepoints. Optional unless exposures is 2D.

batchesint

Optional list of np.arrays partitioning {0, 1, …, n_obs-1}. Otherwise will be created automatically (recommended).

max_batchsizeint

Maximum length (in time) of a tile.

ngroupsint

Number of groups to partition the subjects into. Default is the max integer such that each group contains 5 times as many subjects as there are factors.

clustersnp.array

An n_subjects-length array of cluster_ids, so clusters[i] = k implies subject i is in the kth cluster. If clusters is provided, the output will preserve the cluster structure.

seed: int

Random seed.

Returns:
tilesmosaicperm.tilings.Tiling

The default tiling as a Tiling object.

Notes

One of exposures or batches must be provided.