(A) To demonstrate that the theory applies to the case when the computation is nonlinear, we assumed that the postsynaptic neuron computes a sigmoidal function of the weighted sum (specifically the average) of the presynaptic membrane potentials (cf. Equation 5): where and are the threshold and the slope of the sigmoidal nonlinearity, respectively (see inset, which also shows the marginal distribution of the inputs). To demonstrate the need for nonlinear dendritic integration, we compared the optimal response (black, Equation 3, where is defined above, and the posterior is approximated by Equations 20–22) with a response of a linear model (grey), a model with nonlinear soma but linear dendrites (somatic, orange; Equation 31) and the clustered dendrite model with nonlinear dendrites and nonlinear soma (clustered, red). For the somatic nonlinearity, we chose a sigmoidal function to match the form of the required computation and fitted its parameters to training data. For the clustered dendrite model, the dendritic nonlinearities were fitted to the data but the somatic nonlinearity was assumed to be identical to the nonlinearity used for the computation, . We cross-validated the quality of the fits on a separate set of test data. Similar test and training errors confirmed that the parameter optimisation found good, locally near-optimal solutions without significant overfitting (not shown). (B) The error (mean sd, Equation 33) of the clustered dendrite model (red) is similar to the error of the optimal response (black) and is substantially smaller than the error of the models with linear dendritic integration (grey and orange). Moreover, having a global nonlinearity does not provide substantial improvement over the purely linear response, further emphasising the importance of nonlinear dendritic integration. Parameters were Hz, Hz, mV, ms, mV, mV, Hz, mV, ms, , and mV.