CSPATIALREG Procedure

Linear Regression Models

You can also fit a linear regression model in PROC CSPATIALREG. In this case, let y Subscript i denote the observation that is associated with the spatial unit bold s Subscript i for i equals 1 comma 2 comma ellipsis comma n, and let bold x Subscript i be a p times 1 vector that denotes values of p regressors recorded at unit bold s Subscript i.

You can describe the linear regression model in vector form as

bold y equals bold upper X bold-italic beta plus bold-italic epsilon

where bold y equals left-parenthesis y 1 comma y 2 comma ellipsis comma y Subscript n Baseline right-parenthesis prime, bold-italic epsilon equals left-parenthesis epsilon 1 comma epsilon 2 comma ellipsis comma epsilon Subscript n Baseline right-parenthesis prime with epsilon Subscript i Baseline tilde Overscript normal i normal i normal d Endscripts upper N left-parenthesis 0 comma sigma squared right-parenthesis, and bold upper X is an n times p matrix where each row consists of bold x prime Subscript i.

The log-likelihood function for the linear regression model is

script upper L equals minus StartFraction n Over 2 EndFraction ln left-parenthesis 2 pi sigma squared right-parenthesis minus StartFraction left-parenthesis bold y minus bold upper X bold-italic beta right-parenthesis prime left-parenthesis bold y minus bold upper X bold-italic beta right-parenthesis Over 2 sigma squared EndFraction

For the linear regression model, the gradients are

StartFraction partial-differential script upper L Over partial-differential bold-italic beta EndFraction equals StartFraction bold upper X prime left-parenthesis bold y minus bold upper X bold-italic beta right-parenthesis Over sigma squared EndFraction
StartFraction partial-differential script upper L Over partial-differential sigma squared EndFraction equals minus StartFraction n Over 2 sigma squared EndFraction plus StartFraction left-parenthesis bold y minus bold upper X bold-italic beta right-parenthesis prime left-parenthesis bold y minus bold upper X bold-italic beta right-parenthesis Over 2 sigma Superscript 4 Baseline EndFraction

The Hessians take the following forms:

StartFraction partial-differential squared script upper L Over partial-differential bold-italic beta partial-differential bold-italic beta prime EndFraction equals minus StartFraction bold upper X prime bold upper X Over sigma squared EndFraction
StartFraction partial-differential squared script upper L Over partial-differential bold-italic beta partial-differential sigma squared EndFraction equals minus StartFraction bold upper X prime left-parenthesis bold y minus bold upper X bold-italic beta right-parenthesis Over sigma Superscript 4 Baseline EndFraction
StartFraction partial-differential squared script upper L Over partial-differential sigma Superscript 4 Baseline EndFraction equals StartFraction n Over 2 sigma Superscript 4 Baseline EndFraction minus StartFraction left-parenthesis bold y minus bold upper X bold-italic beta right-parenthesis prime left-parenthesis bold y minus bold upper X bold-italic beta right-parenthesis Over sigma Superscript 6 Baseline EndFraction
Last updated: July 09, 2026