[size=9.000000pt]Write a function in R that for a given values of parameters and given data matrix computes the value of the log-likelihood function for an AutoRegressive model with [size=9.000000pt]p [size=9.000000pt]lags:
yt =μ+α1yt−1 +···+αpyt−p +εt εt|yt−1 ~N 0,σ2
Write the function so that its only arguments are:
a (p + 2) vector containing some values of parameters:
(μ,α1,...,αp,σ2), and
a (T + p) × 1 matrix containing a time series of interest.
The output is a scalar containing the value of the log-likelihood function