Trouble using for loop for SARIMA

Hi, I apologize in advance, most of my programming skills are self-taught, if there are any weird errors.

My goal with this code was to basically create a for-loop that iterates over every column in my data frame separately with the data frame so that by the end I have a independent output for each column.

But so far I have been unable to generate any output with my function neither plots or anything else.
I used the StateSpaceModels.jl as my example, but the best output I got so far was SARIMA (generic function with 1 method)

I now humble ask if there is any way I can fix this?

begin
	function SARIMA(tsf::DataFrame, p::Int, d::Int, q::Int)
 	forecasts = Array{Float64, 3}(tsf.cols(2:22), 3)
  	for i = tsf.cols(2:22)
		# SARIMA
		steps_ahead = 30
    		model_sarima = SARIMA(tsf[i], order = (0,1,1), seasonal_order = (0, 1, 1, 4))
		fit!(model_sarima)
		forec_sarima = forecast(model_sarima, steps_ahead)
	
		# Exponential Smoothing
		model_ets = ExponentialSmoothing(tsf[i], trend = true, seasonal = 12)
		fit!(model_ets)
		forec_ets = forecast(model_ets, steps_ahead)
	
		# Naive model
		model_naive = SeasonalNaive(tsf[i], 12)
		fit!(model_naive)
		forec_naive = forecast(model_naive, steps_ahead)
				
		plt_sarima = plot(model_sarima, forec_sarima, layout =(22,1),title = "SARIMA", label = "")
		plt_ets = plot!(forec_ets, layout =(22,1), title = "Exponential smoothing", label = "")
		plt_naive = plot!(forec_naive, layout =(22,1), title = "Seasonal Naive", label = "")
		println(plt_naive)
		end
	end
end	

Hi @Agnes_H, happy to see that you are using StateSpaceModels.

I think that you should put something like this on the loop. Also, you should not name your function with the same name as a function exported by the package that you are using, in this case SARIMA.

    # Yout time series
    time_series = tsf[:, i]
    # SARIMA
    steps_ahead = 30
    model_sarima = SARIMA(time_series, order = (0,1,1), seasonal_order = (0, 1, 1, 4))
    fit!(model_sarima)
    forec_sarima = forecast(model_sarima, steps_ahead)

    # Exponential Smoothing
    model_ets = ExponentialSmoothing(time_series, trend = true, seasonal = 12)
    fit!(model_ets)
    forec_ets = forecast(model_ets, steps_ahead)

    # Naive model
    model_naive = SeasonalNaive(time_series, 12)
    fit!(model_naive)
    forec_naive = forecast(model_naive, steps_ahead)
            
    plt_sarima = plot(model_sarima, forec_sarima, layout =(22,1),title = "SARIMA", label = "")
    plt_ets = plot!(model_ets, forec_ets, layout =(22,1), title = "Exponential smoothing", label = "")
    plt_naive = plot!(model_ets, forec_naive, layout =(22,1), title = "Seasonal Naive", label = "")