lm_per {PerRegMod} | R Documentation |
lm_per() function gives the least squares estimation of parameters, intercept \mu_s
, slope \boldsymbol{\beta}_s
, and standard deviation \sigma_s
, of a periodic coefficients regression model using LSE_Reg_per and sd_estimation_for_each_s functions.
\widehat{\boldsymbol{\vartheta}}=\left(X^{'}X\right)^{-1}X^{'} Y
where X=
\left[\begin{array}{ccccccccccc}
&\mathbf{X}^1_{1}&0&\ldots & 0& &\mathbf{X}^p_{1}&0&\ldots & 0 \\
& 0&\mathbf{X}^1_{2} &\ldots &0 & &0&\mathbf{X}^p_{2} &\ldots &0\\
\textbf{I}_{S}\otimes \mathbf{1}_{m} &0&0& \ddots&\vdots&\ldots&0& 0&\ddots&\vdots \\
& 0 &0&0 &\mathbf{X}^1_{S}& &0 &0&0 &\mathbf{X}^p_{S}
\end{array}\right]\
,
\mathbf{X}^j_{s}=\left(x^j_{s},...,x^j_{s+(m-1)S}\right)^{'}
,
Y=(\mathbf{Y}_1^{'},...,\mathbf{Y}_S^{'})^{'}
, \mathbf{Y}_{s} =(y_{s},...,y_{(m-1)S+s})^{'}
,
\mathbf{\epsilon}=(\mathbf{\epsilon}_{1}^{'},...,\mathbf{\epsilon}_{S}^{'})^{'}
,
\mathbf{\epsilon}_{s} =(\varepsilon_{s},...,\varepsilon_{(m-1)S+s})^{'}
, \mathbf{1}_{m}
is a vector of ones of dimension m
, \textbf{I}_{S}
is the identity matrix of dimension S
, \otimes
denotes the Kronecker product, and \boldsymbol{\vartheta} =\left(\boldsymbol{\mu}^{'} ,{\boldsymbol{\beta}}^{'}\right)^{'}
with \boldsymbol{\mu}=(\mu_1,...,\mu_S)^{'}
and \boldsymbol{\beta}=(\beta^1_{1},...,\beta^1_{S};...;\beta^p_{1},...,\beta^p_{S})^{'}
.
lm_per(x,y,s)
x |
A list of independent variables with dimension |
y |
A response variable. |
s |
A period of the regression model. |
Residuals |
the residuals, that is response minus fitted values |
Coefficients |
a named vector of coefficients |
Root mean square error |
The root mean square error |
set.seed(6)
n=400
s=4
x1=rnorm(n,0,1.5)
x2=rnorm(n,0,0.9)
x3=rnorm(n,0,2)
x4=rnorm(n,0,1.9)
y=rnorm(n,0,2.5)
x=list(x1,x2,x3,x4)
lm_per(x,y,s)