[R] unidentified option(s) in mean.model

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Sat Feb 25 18:32:36 CET 2017


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.)
-- 
Sent from my phone. Please excuse my brevity.

On February 25, 2017 8:50:01 AM PST, Rui Barradas <ruipbarradas at sapo.pt> wrote:
>Hello,
>
>Your minimal reproducible example is not reproducible since we don't 
>have acces to file "EURJPY.m1440.csv" and is far from minimal.
>Anyway, the best I can say is that you are using the attribution 
>operator '<-' to set the values of a function's arguments when you 
>should use '='. Try instead the fllowing.
>
>
>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")
>
>Hope this helps,
>
>Rui Barradas
>
>Em 25-02-2017 16:18, Allan Tanaka escreveu:
>> Hi
>>
>> See attached txt
>>
>>
>> On Saturday, 18 February 2017, 20:47, Rui Barradas
>> <ruipbarradas at sapo.pt> wrote:
>>
>>
>> Helo,
>>
>> No attachment came through. Change the file extension from .R to .txt
>> and resend, there aren't many types of files r-help accepts.
>>
>> Rui Barradas
>>
>> Em 17-02-2017 17:20, Allan Tanaka escreveu:
>>  > So i tried brute force to find best fitted GARCH model for
>> prediction.The code works fine as it runs but at the end of
>processing,
>> there's error like this: There were 50 or more warnings (use
>warnings()
>> to see the first 50).
>>  > So i type warnings(), then the error become:unidentified option(s)
>in
>> mean.model
>>  > Not sure what's gone wrong?
>>  > See attached for R script
>>
>>  > ______________________________________________
>>  > R-help at r-project.org <mailto:R-help at 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
>> <http://www.r-project.org/posting-guide.html>
>>  > and provide commented, minimal, self-contained, reproducible code.
>>
>>  >
>>
>>
>
>______________________________________________
>R-help at 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.



More information about the R-help mailing list