# Score (statistics)

In statistics, the score (or informant) is the gradient of the log-likelihood function with respect to the parameter vector. Evaluated at a particular point of the parameter vector, the score indicates the steepness of the log-likelihood function and thereby the sensitivity to infinitesimal changes to the parameter values. If the log-likelihood function is continuous over the parameter space, the score will vanish at a local maximum or minimum; this fact is used in maximum likelihood estimation to find the parameter values that maximize the likelihood function.

Since the score is a function of the observations that are subject to sampling error, it lends itself to a test statistic known as score test in which the parameter is held at a particular value. Further, the ratio of two likelihood functions evaluated at two distinct parameter values can be understood as a definite integral of the score function.

## Definition

The score is the gradient (the vector of partial derivatives) of $\log {\mathcal {L}}(\theta )$ , the natural logarithm of the likelihood function, with respect to an m-dimensional parameter vector $\theta$ .

$s(\theta )\equiv {\frac {\partial \log {\mathcal {L}}(\theta )}{\partial \theta }}$ Thus differentiation yields a $(1\times m)$ row vector, and indicates the sensitivity of the likelihood (its derivative normalized by its value).

In older literature,[citation needed] "linear score" may refer to the score with respect to infinitesimal translation of a given density. This convention arises from a time when the primary parameter of interest was the mean or median of a distribution. In this case, the likelihood of an observation is given by a density of the form ${\mathcal {L}}(\theta ;X)=f(X+\theta )$ . The "linear score" is then defined as

$s_{\rm {linear}}={\frac {\partial }{\partial X}}\log f(X)$ ## Properties

### Mean

While the score is a function of $\theta$ , it also depends on the observations $\mathbf {x} =(x_{1},x_{2},\ldots x_{T})$ at which the likelihood function is evaluated, and in view of the random character of sampling one may take its expected value over the sample space. Under certain regularity conditions on the density functions of the random variables, the expected value of the score, evaluated at the true parameter value $\theta$ , is zero. To see this rewrite the likelihood function ${\mathcal {L}}$ as a probability density function ${\mathcal {L}}(\theta ;x)=f(x;\theta )$ , and denote the sample space ${\mathcal {X}}$ . Then:

{\begin{aligned}\operatorname {E} (s\mid \theta )&=\int _{\mathcal {X}}f(x;\theta ){\frac {\partial }{\partial \theta }}\log {\mathcal {L}}(\theta ;x)\,dx\\[6pt]&=\int _{\mathcal {X}}f(x;\theta ){\frac {1}{f(x;\theta )}}{\frac {\partial f(x;\theta )}{\partial \theta }}\,dx=\int _{\mathcal {X}}{\frac {\partial f(x;\theta )}{\partial \theta }}\,dx\end{aligned}} The assumed regularity conditions allow the interchange of derivative and integral (see Leibniz integral rule), hence the above expression may be rewritten as

${\frac {\partial }{\partial \theta }}\int _{\mathcal {X}}f(x;\theta )\,dx={\frac {\partial }{\partial \theta }}1=0.$ It is worth restating the above result in words: the expected value of the score is zero. Thus, if one were to repeatedly sample from some distribution, and repeatedly calculate the score, then the mean value of the scores would tend to zero asymptotically.

### Variance

The variance of the score, $\operatorname {Var} (s(\theta ))=\operatorname {E} (s(\theta )s(\theta )^{\mathsf {T}})$ can be derived from the above expression for the expected value.

{\begin{aligned}0&={\frac {\partial }{\partial \theta ^{\mathsf {T}}}}\operatorname {E} (s\mid \theta )\\[6pt]&={\frac {\partial }{\partial \theta ^{\mathsf {T}}}}\int _{\mathcal {X}}{\frac {\partial \log {\mathcal {L}}(\theta ;X)}{\partial \theta }}f(x;\theta )\,dx\\[6pt]&=\int _{\mathcal {X}}{\frac {\partial }{\partial \theta ^{\mathsf {T}}}}\left\{{\frac {\partial \log {\mathcal {L}}(\theta ;X)}{\partial \theta }}f(x;\theta )\right\}\,dx\\[6pt]&=\int _{\mathcal {X}}\left\{{\frac {\partial ^{2}\log {\mathcal {L}}(\theta ;X)}{\partial \theta \partial \theta ^{\mathsf {T}}}}f(x;\theta )+{\frac {\partial \log {\mathcal {L}}(\theta ;X)}{\partial \theta }}{\frac {\partial f(x;\theta )}{\partial \theta ^{\mathsf {T}}}}\right\}\,dx\\[6pt]&=\int _{\mathcal {X}}{\frac {\partial ^{2}\log {\mathcal {L}}(\theta ;X)}{\partial \theta \partial \theta ^{\mathsf {T}}}}f(x;\theta )\,dx+\int _{\mathcal {X}}{\frac {\partial \log {\mathcal {L}}(\theta ;X)}{\partial \theta }}{\frac {\partial {\mathcal {L}}(\theta ;X)}{\partial \theta ^{\mathsf {T}}}}\,dx\\[6pt]&=\int _{\mathcal {X}}{\frac {\partial ^{2}\log {\mathcal {L}}(\theta ;X)}{\partial \theta \partial \theta ^{\mathsf {T}}}}f(x;\theta )\,dx+\int _{\mathcal {X}}{\frac {\partial \log {\mathcal {L}}(\theta ;X)}{\partial \theta }}{\frac {\partial \log {\mathcal {L}}(\theta ;X)}{\partial \theta ^{\mathsf {T}}}}f(x;\theta )\,dx\\[6pt]&=\operatorname {E} \left({\frac {\partial ^{2}\log {\mathcal {L}}(\theta ;X)}{\partial \theta \partial \theta ^{\mathsf {T}}}}\right)+\operatorname {E} \left({\frac {\partial \log {\mathcal {L}}(\theta ;X)}{\partial \theta }}\left[{\frac {\partial \log {\mathcal {L}}(\theta ;X)}{\partial \theta }}\right]^{\mathsf {T}}\right)\end{aligned}} Hence the variance of the score is equal to the negative expected value of the Hessian matrix of the log-likelihood.

$\operatorname {E} (s(\theta )s(\theta )^{\mathsf {T}})=-\operatorname {E} \left({\frac {\partial ^{2}\log {\mathcal {L}}}{\partial \theta \partial \theta ^{\mathsf {T}}}}\right)$ The latter is known as the Fisher information and is written ${\mathcal {I}}(\theta )$ . Note that the Fisher information is not a function of any particular observation, as the random variable $X$ has been averaged out. This concept of information is useful when comparing two methods of observation of some random process.

## Examples

### Bernoulli process

Consider observing the first n trials of a Bernoulli process, and seeing that A of them are successes and the remaining B are failures, where the probability of success is θ.

Then the likelihood ${\mathcal {L}}$ is

${\mathcal {L}}(\theta ;A,B)={\frac {(A+B)!}{A!B!}}\theta ^{A}(1-\theta )^{B},$ so the score s is

$s={\frac {1}{\mathcal {L}}}{\frac {\partial {\mathcal {L}}}{\partial \theta }}={\frac {A}{\theta }}-{\frac {B}{1-\theta }}.$ We can now verify that the expectation of the score is zero. Noting that the expectation of A is and the expectation of B is n(1 − θ) [recall that A and B are random variables], we can see that the expectation of s is

$E(s)={\frac {n\theta }{\theta }}-{\frac {n(1-\theta )}{1-\theta }}=n-n=0.$ We can also check the variance of $s$ . We know that A + B = n (so Bn − A) and the variance of A is (1 − θ) so the variance of s is

{\begin{aligned}\operatorname {var} (s)&=\operatorname {var} \left({\frac {A}{\theta }}-{\frac {n-A}{1-\theta }}\right)=\operatorname {var} \left(A\left({\frac {1}{\theta }}+{\frac {1}{1-\theta }}\right)\right)\\&=\left({\frac {1}{\theta }}+{\frac {1}{1-\theta }}\right)^{2}\operatorname {var} (A)={\frac {n}{\theta (1-\theta )}}.\end{aligned}} ### Binary outcome model

For models with binary outcomes (Y = 1 or 0), the model can be scored with the logarithm of predictions

$S=Y\log(p)+(1-Y)(\log(1-p))$ where p is the probability in the model to be estimated and S is the score.

## Applications

### Scoring algorithm

The scoring algorithm is an iterative method for numerically determining the maximum likelihood estimator.

### Score test

Note that $s$ is a function of $\theta$ and the observation $\mathbf {x} =(x_{1},x_{2},\ldots x_{T})$ , so that, in general, it is not a statistic. However, in certain applications, such as the score test, the score is evaluated at a specific value of $\theta$ (such as a null-hypothesis value), in which case the result is a statistic. Intuitively, if the restricted estimator is near the maximum of the likelihood function, the score should not differ from zero by more than sampling error. In 1948, C. R. Rao first proved that the square of the score divided by the information matrix follows an asymptotic χ2-distribution under the null hypothesis.

Further note that the likelihood-ratio test is given by

$-2\left[\log {\mathcal {L}}(\theta _{0})-\log {\mathcal {L}}({\hat {\theta }})\right]=2\int _{\theta _{0}}^{\hat {\theta }}{\frac {d\,\log {\mathcal {L}}(\theta )}{d\theta }}\,d\theta =2\int _{\theta _{0}}^{\hat {\theta }}s(\theta )\,d\theta$ which means that the likelihood-ratio test can be understood as the area under the score function between $\theta _{0}$ and ${\hat {\theta }}$ .