Renaming a series using the function auto.arima

Hi everyone, I'm new to this package and am having some difficulties renaming. I want to take numerous time series and run the auto.arima function with a loop. Thankfully my loop works, but because of the loop, the series names in the output is off. Here's my code:

for (i in n){ = auto.arima(na.omit(data[, (i+1)]), ic = "bic")

and here's a sample of part of the output:
Series: na.omit(data[, (i + 1)])
ARIMA(1,0,0) with non-zero mean

ar1 mean
0.5380 0.955
s.e. 0.0642 0.028

sigma^2 estimated as 0.02982: log likelihood=59.54
AIC=-113.08 AICc=-112.94 BIC=-103.6

How do I change Series: na.omit(data[, (i + 1)]) to Series: Correct name? Thank you in advance for your help!

You can change the name of the series by replacing the $series value.$series <- "your series name"

Awesome, thank you very much! :slight_smile:

I'm sorry to bug you again, but if you're available, I'd love to steal your help for one more thing :slight_smile: so I followed your advance and the series are renamed, which is awesome, but for some reason it's only renaming properly when I hard code the names. Since I'm running this through a loop I'm hoping to just use a list and go through the names in that list. Here's what I have for my code:
for (i in n) { = auto.arima(na.omit(data[, (i+1)]), ic = "bic")$series = tree_site[i]
where tree_site[1] should say Series: BCK_RW, but instead the output is giving me
Series: 12
ARIMA(2,0,0) with non-zero mean

ar1 ar2 mean
0.4874 0.1520 0.9672
s.e. 0.0492 0.0494 0.0390

I think that I have the tree_site[i] list correct since it works for renaming my other plots. Any suggestions on how to rename the series with my loop? Thanks :slight_smile:

Please create a minimally reproducible example.
Without access to tree_site I can't tell you why this is happening.

Hi mitchelloharawild,
I was actually able to get it working :slight_smile: thank you so much though for all your help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.