Hello,
You're right, but the equal sign outside the function call wasn't my
doing. I should have noticed that the OP had used
spec = ugarchspec(...) and '<-' inside the function call to assign
values to the function's arguments, but I heven't, so I just corrected
the '<-'.
Rui Barradas
Em 25-02-2017 17:32, Jeff Newmiller escreveu:
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.)
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.