Hello,

I want to build a graphic looking like that one:

Therefore I used ARIMA to model the Data. Attached you will find the code I am currently working with. But I don't know how to assign the values to the matrix and how to plot the p-values afterwards. It as well tells me:

"Error in ljung_mat[i, ] <- print(c(i, box$p.value)) :

Number of elements to be replaced is not a multiple of the replacement length "

Thank you for your help.

Kind regards

Luke

```
n2 = length(train)
ljung_mat <- matrix(0, nrow=(n2), ncol=1)
for(i in 1:n2)
{
box<-(Box.test(finalarima$residuals, lag=i, type="Ljung-Box"))
ljung_mat[I,] <- print(c(i, box$p.value))
}
```