'urca::svar and model seasonality

I have quarterly data and was wondering how I would include this within the VAR command

I have a variable coding quarters (1 to 4) and created 4 dummy variables to include under season but the model crashes and I get the following message:

"Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : NA/NaN/Inf in 'x'"

How can I fix this?

y1 = ts(dataset$CIGDiff, frequency=4, start=c(dataset[1, "Year"], dataset[1, "Quarter"]))
y2 = ts(dataset$ECDiff, frequency=4, start=c(dataset[1, "Year"], dataset[1, "Quarter"]))

matrixA = diag(2)
matrixA[2,1] = NA 
matrixA[1,2]=0
matrixA

# Build the model
sv = cbind(y1, y2)

dataset = dummy_cols(dataset, select_columns = "Quarter")
quarterdum = cbind(dataset$Quarter_1, dataset$Quarter_2, dataset$Quarter_3, dataset$Quarter_4)
colnames(quarterdum) = cbind("Q1", "Q2", "Q3", "Q4")
Model.seas = vars::VAR(sv, p = 2, type = "const", season = quarterdum, exog = NULL)

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source