# Approaches to Parameter Estimation from Model Neurons and Biological Neurons
## 3 Biological Neurons: Estimating Parameters from Guessed Models
### Including Model Error in the Cost Function  
Model error is accounted for by adding a quadratic term in the cost function. This term avoids the strict enforcement of constraints when the model \(\overset{\rightarrow}{F}^{S}\) is guessed and necessarily departs from the true but unknown equations of motion \(\overset{\rightarrow}{F}\):  
\[\frac{dx_{l}}{dt}=F_{l}\left(\overset{\rightarrow}{x}\right)~{}~{}\rightarrow~ {}~{}\frac{dx_{l}}{dt}\approx F_{l}^{S}\left(\overset{\rightarrow}{x}\right) l=1,\ldots,L \tag{2}\]  
The constraint is linearized at each mesh point \(t_{i}\) of the assimilation window for each state variable \(x_{l}\) giving constraints \(x_{l}(t_{i+1})\approx G_{l}^{S}\left(\overset{\rightarrow}{x}(t_{i})\right)\). The function \(G^{S}\) will depend on the interpolation method used, for example: \(G_{l}^{S}\left(\overset{\rightarrow}{x}(t_{i})\right)=x_{l}(t_{i})+\Delta t~{ }F_{l}^{S}\left(\overset{\rightarrow}{x}(t_{i})\right)\). The cost function has a model error term that measures the discrepancies between the \(x_{l}(t_{i+1})\) and \(G_{l}^{S}\left(\overset{\rightarrow}{x}(t_{i})\right)\) across the assimilation window (\(i=0,\ldots,N-1\)) and state variables (\(l=1,\ldots,L\)). To this, one adds the data error term that measures the distance between the membrane voltage \(V_{data}(t_{i})\) in the experimental recording and the corresponding state variable in the model \(x_{1}(t_{i})\) for \(i=0,\ldots,N\):  
\[C\left(\overset{\rightarrow}{x}(0),\overset{\rightarrow}{p}\right)=\frac{1 }{2}\sum_{i=0}^{i=N}\left(V_{data}(t_{i})-x_{1}(t_{i})\right)^{2}+\frac{1}{2} \sum_{l=1}^{L}R_{l}^{-1}\sum_{i=0}^{N-1}\left(x_{l}(t_{i+1})-G_{l}^{S}\left( \overset{\rightarrow}{x}(t_{i})\right)^{2} \tag{3}\]  
This cost function is similar to the one used to infer the initial state of the atmosphere in meteorology [3]. It may also be formally derived from the action in Lagrangian mechanics [6]. A quadratic regularization term \(u^{2}\) may added and treated as an additional state variable to remove the occurrence of positive Lyapunov exponents during convergence [79; 80]. The \(R_{l}\) are the diagonal elements of the covariance matrix of the model error. They establish a tradeoff between ignoring model error (\(R_{l}\rightarrow\infty\)) and giving a greater weight to model error than data error, with the consequence that the model may fail to synchronize to the data (\(R_{l}\to 0\)). The computation of these covariance matrices is an active area of research in data assimilation, which places emphasis on calculating majoration bounds of diagonal matrix elements [4]. This approach has been met with partial success in balancing data and model error in such a way that constraints (Equation (2)) are not enforced too strictly and do not send the model error term to zero in the cost function (Equation (3)). Note that in Equation (3), the covariance matrix of observation error is taken to be a unitary matrix. This is because consecutive measurements of the membrane voltage (or calcium concentration) are taken by the same apparatus which carries the same experimental error, hence, giving the same matrix elements on the diagonal. Measurements are also uncorrelated with one another, giving zero off-diagonal terms in the data error covariance matrix. A simplification to computing the model error covariance matrix \(R\) was proposed by [PERSON] et al. [6; 65]. They applied a majoration to the model error covariance matrix by retaining the error on a single state variable \(x_{\lambda}\), preferably the one that is the most sensitive to model error. The model error on \(x_{\lambda}\) was weighted by a single adjustable hyperparameter \(R_{\lambda}\), which was varied to optimally balance data and model error.