How convert parameter in value

ggplot2
rstudio

#1

hi, i have this code:

HoltWinters(dataset$um,beta=FALSE, gamma=FALSE, l.start=10)
n=(2/0.0749)-1
n
# EMA
ema <- EMA(dataset$um, n =n, wilder = FALSE, ratio = NULL)
dataset$EXPMEDIA=coredata(ema)

But i need run the code to take value of alpha (0.0749). How i can take alpha automatically?

Thank you !


#2

Hi Rafael,

What packages are you using? From looking at your code, as is, the output of your HoltWinters() function isn’t being kept as any sort of object. It’s not something I know much about, but according to this piece, “Using R for Time Series Analysis”:

The HoltWinters() function returns a list variable, that contains several named elements.

It might be looking at that chapter (above), since it seems to contain lots of helpful info (again, not my area of expertise).

As far as EMA goes, again, I’m not sure which package you’re using, and, as for alpha, it would depend on whether or not the EMA function takes that as an argument.

If you take a look at the thread (below) from StackOverflow and/or @jennybryan’s reprex slide deck (or the reprex tidyverse docs), you’ll find useful tips on what to include in order to make your question more easily answerable.

Hopefully we can help you get it sorted! :+1: