lscov
存在已知协方差情况下的最小二乘解
语法
说明
示例
输入参数
输出参量
算法
当 m
×n
矩阵 A
和 m
×m
矩阵 C
在广义最小二乘问题中满秩时,这些标准公式表示在 m
大于或等于 n
时 lscov
的输出。
x = inv(A'*inv(C)*A)*A'*inv(C)*b mse = (b - A*x)'*inv(C)*(b - A*x)./(m-n) S = inv(A'*inv(C)*A)*mse stdx = sqrt(diag(S))
当 m
小于 n
时,均方误差为 0。
对于加权最小二乘法,当用 diag(1./w)
代替 C
时,标准公式适用。对于普通最小二乘法,用单位矩阵代替 C
。
lscov
函数使用的方法比标准公式更快也更稳定,而且适用于处理秩亏情况。例如,lscov
计算乔列斯基分解 C = R'*R
,然后改用 mldivide
中用于 A\b
求解最小二乘问题的相同算法求解最小二乘问题 (R'\A)*x = (R'\b)
。
参考
[1] Paige, Christopher C. "Computer Solution and Perturbation Analysis of Generalized Linear Least Squares Problems." Mathematics of Computation 33, no. 145 (1979): 171–83. https://doi.org/10.2307/2006034.
[2] Golub, Gene H., and Charles F. Van Loan. Matrix Computations. Baltimore, MD: Johns Hopkins University Press, 1996.
[3] Goodall, Colin R. "Computation using the QR decomposition." Handbook of Statistics 9 (1993): 467–508. https://doi.org/10.1016/S0169-7161(05)80137-3.
[4] Strang, Gilbert. Introduction to Applied Mathematics. Wellesley, MA: Wellesley-Cambridge Press, 1986.
扩展功能
版本历史记录
在 R2006a 之前推出