Skip to content
Prev 367371 / 398502 Next

unidentified option(s) in mean.model

That was confusing.  One equals sign is used to assign values (actual arguments) to function inputs (formal arguments).

The assignment operator `<-` is used to assign values to variables in the current working environment. Due to popular demand, the single equals sign can ALSO be used for that purpose, but only outside the calling parenthesis for a function call.

I recognise that some people think this is a good argument for always using the single equals, but they are DIFFERENT operations in R, and pretending they are the same by using the same symbol in both situations just misleads people further, so at least be clear where each operator belongs when explaining the difference:

spec <- ugarchspec(variance.model = list(model = "sGARCH",garchOrder=c(1,1)),
                    mean.model = list(
                      armaOrder = c(final.order[1], final.order[3]), 
arfima = FALSE, include.mean = TRUE),
                    distribution.model = "sged")

and then let people decide whether to use the less precise notation after they understand what is happening.

I find it more confusing to parse

f = function( x ) x^2
x = 1
x = x
f( x = x )

than

f <- function( x ) x^2
x <- 1
x <- x
f( x = x )

(The x = x is just as useless as x <- x is outside the parameter list, but serves an important purpose when inside the parameter list.)