The nervous system must integrate information arriving via peripheral sensory pathways with internal factors that regulate circuit function, cognitive state, and behaviour. This thesis introduces new methodology for modelling such latent internal factors in calcium imaging data, for characterising how they give rise to structured patterns of neural activity, and for understanding their role in neural development. We construct two statistical models that bridge factor analysis methods for neural spike train data with statistical signal processing algorithms for calcium imaging data. We apply our techniques to calcium imaging of zebrafish optic tectum and mouse visual cortex, demonstrating their ability to decompose large scale optical recordings of neural activity into low dimensional factors that encode sensory stimulation, spontaneous activity, and modulation of multiplicative excitability. We then use computational modelling to explore how such latent structure could arise via synaptic plasticity in denervated neural circuits, identifying a Hebbian learning rule that allows neural circuits to self-organise into a highly modular state where assemblies of neurons activate spontaneously. Together, this thesis work provides practical open source tools for probabilistic modelling of optical imaging data, and insight into the mechanisms underlying the development of structured neural activity. i I would like to thank my teachers and mentors at the University of Auckland, especially Patrick Girard, André Nies, Cristian Calude, and Jeremy Seligman. You all were an inspiration to me during my formative undergraduate years. Finally, my most heartfelt thanks go to my family for their unending enthusiasm in my seemingly unending academic pursuits. vi