I believe that X$estimate is a vector of length three. You should verify that. If it is, you can't assign it to a single position in the array, such as Results[j,i,z]. You can either assign each element of X$estimate to one element of Results or assign X$estimate to three elements of Results.

To do them one at a time, use a loop.

```
for(z in 1:3) {
Results[j, i, z ] <- X$estimate[z]
}
```

To assign three elements at once, leave the last index of Results blank.

```
Results[j,i, ] <- X$estimate
```

Here is an example of the second method.

```
Results <- array(NA, dim = c(3,3,3),
dimnames = list(Start = c("2021-01-05", "2021-04-05", "2021-05-05"),
End = c("2021-05-15", "2021-06-19", "2021-07-17"),
Param = c("x1", "x2", "x3")))
Results
#> , , Param = x1
#>
#> End
#> Start 2021-05-15 2021-06-19 2021-07-17
#> 2021-01-05 NA NA NA
#> 2021-04-05 NA NA NA
#> 2021-05-05 NA NA NA
#>
#> , , Param = x2
#>
#> End
#> Start 2021-05-15 2021-06-19 2021-07-17
#> 2021-01-05 NA NA NA
#> 2021-04-05 NA NA NA
#> 2021-05-05 NA NA NA
#>
#> , , Param = x3
#>
#> End
#> Start 2021-05-15 2021-06-19 2021-07-17
#> 2021-01-05 NA NA NA
#> 2021-04-05 NA NA NA
#> 2021-05-05 NA NA NA
Results[1,1, ] <- c(-31,25,197)
Results
#> , , Param = x1
#>
#> End
#> Start 2021-05-15 2021-06-19 2021-07-17
#> 2021-01-05 -31 NA NA
#> 2021-04-05 NA NA NA
#> 2021-05-05 NA NA NA
#>
#> , , Param = x2
#>
#> End
#> Start 2021-05-15 2021-06-19 2021-07-17
#> 2021-01-05 25 NA NA
#> 2021-04-05 NA NA NA
#> 2021-05-05 NA NA NA
#>
#> , , Param = x3
#>
#> End
#> Start 2021-05-15 2021-06-19 2021-07-17
#> 2021-01-05 197 NA NA
#> 2021-04-05 NA NA NA
#> 2021-05-05 NA NA NA
```

^{Created on 2024-08-01 with reprex v2.0.2}