Answers:
在线性回归中,用于估计的最大化似然估计(MLE)解决方案具有以下闭合形式的解决方案(假设A是具有完整列秩的矩阵):
这被理解为“找到使目标函数最小化的,。关于代表这样的线性回归的目标函数的好处是,我们可以把一切都在矩阵符号,解决了X林的手。正如Alex R.所提到的,实际上,我们通常不直接考虑(A T A )− 1,因为它在计算上效率低下,并且A经常不符合完整等级标准。相反,我们转向Moore-Penrose伪逆。计算上求解伪逆的细节可能涉及Cholesky分解或奇异值分解。
或者,用于估计逻辑回归中系数的MLE解决方案是:
其中(假设每个数据样本按行存储):
是向量,表示回归系数
是一个矢量表示样品/行中的数据矩阵
是一个标量,以及对应于标签样品
是数据样本数/数据矩阵的行数。
再次,这被理解为“找到使目标函数最小的 ”。
如果你愿意,你可以把它更进了一步,并表示X日志在矩阵符号如下:
but you don't gain anything from doing this. Logistic regression does not have a closed form solution and does not gain the same benefits as linear regression does by representing it in matrix notation. To solve for estimation techniques such as gradient descent and the Newton-Raphson method are used. Through using some of these techniques (i.e. Newton-Raphson), is approximated and is represented in matrix notation (see link provided by Alex R.).
@joceratops answer focuses on the optimization problem of maximum likelihood for estimation. This is indeed a flexible approach that is amenable to many types of problems. For estimating most models, including linear and logistic regression models, there is another general approach that is based on the method of moments estimation.
The linear regression estimator can also be formulated as the root to the estimating equation:
In this regard is seen as the value which retrieves an average residual of 0. It needn't rely on any underlying probability model to have this interpretation. It is, however, interesting to go about deriving the score equations for a normal likelihood, you will see indeed that they take exactly the form displayed above. Maximizing the likelihood of regular exponential family for a linear model (e.g. linear or logistic regression) is equivalent to obtaining solutions to their score equations.
Where has expected value . In GLM estimation, is said to be the inverse of a link function. In normal likelihood equations, is the identity function, and in logistic regression is the logit function. A more general approach would be to require which allows for model misspecification.
Additionally, it is interesting to note that for regular exponential families, which is called a mean-variance relationship. Indeed for logistic regression, the mean variance relationship is such that the mean is related to the variance by . This suggests an interpretation of a model misspecified GLM as being one which gives a 0 average Pearson residual. This further suggests a generalization to allow non-proportional functional mean derivatives and mean-variance relationships.
A generalized estimating equation approach would specify linear models in the following way:
With a matrix of variances based on the fitted value (mean) given by . This approach to estimation allows one to pick a link function and mean variance relationship as with GLMs.
In logistic regression would be the inverse logit, and would be given by . The solutions to this estimating equation, obtained by Newton-Raphson, will yield the obtained from logistic regression. However a somewhat broader class of models is estimable under a similar framework. For instance, the link function can be taken to be the log of the linear predictor so that the regression coefficients are relative risks and not odds ratios. Which--given the well documented pitfalls of interpreting ORs as RRs--behooves me to ask why anyone fits logistic regression models at all anymore.