I am trying to run the enclosed .I get some error messages. could someone tell me what is wrong in the code ? Or is there something else i need to do first?
Cheers
**
Screenshots are hard to read and not very useful, please post formatted code instead or ideally a minimal REPRoducible EXample (reprex) illustrating your issue.
Thank you for your info How do I create a log with name ' souvenirtimeseries'?
cheers
What is the source of your data?
*it is an excel sheet i have with sales
the excel sheet has list on sheet 1:
a 10.37661961
b 0.02996319
s1 0.80952063
s2 0.60576477
s3 0.01103238
s4 0.24160551
s5 0.35933517
s6 0.18076683
s7 0.07788605
s8 0.10147055
s9 0.09649353
s10 0.05197826
s11 0.41793637
s12 1.18088423
i also have a picture of two files that has data.but i have not connected that to anything in Rstudio. Is that required? is that the so called log file?
source file690x402
cheers
What you are showing are the results (coefficients) of applying the HoltWinters()
function on some time series data, but that is not the original data and there is no "log file", in your code you are calculating the natural logarithm (log
) of souvenirtimeseries
, whatever that is.
H i ,
I have created a file Usage1.csv in the workdirectory.
So far I have the following code
load raw data
Usage < read.csv("Usage1.csv", header = TRUE)
table(Usage$No1)
install.packages("ggplot2")
install.packages(stringr)
library(ggplot2)
HoltWinters exponential smoothing with alpha,trend (beta) and gamma( mulitplicative seasonal components.)
Smoothing parameters:
alpha: 0.413418
beta : 0
gamma: 0.9561275
my data looks as follows:
is my code correct?
I need it to read the file Usage1.csv in the workdirectory.
then, it should calculate a rolling alpha,beta and gamma per average of every 5 observations and provide me a forecast of the sales + its alpha,beta and gamma.for the forecasted sales
I am not sure if Studio can do all this.
cheers
Yes, it can, but it seems like you are trying to take too much of a shortcut, I would strongly recommend you to work in your basic R skills before going any further. Here you have some resources
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
Please read the guides and follow the forum's good practices.
here's the code
logsouvenirtimeseries < log(souvenirtimeseries)
souvenirtimeseriesforecasts < HoltWinters(logsouvenirtimeseries)
souvenirtimeseriesforecasts
HoltWinters exponential smoothing with trend and additive seasonal component.
Smoothing parameters:
alpha: 0.413418
beta : 0
gamma: 0.9561275
Coefficients:
[,1]
a 10.37661961
b 0.02996319
s1 0.80952063
s2 0.60576477
s3 0.01103238
s4 0.24160551
s5 0.35933517
s6 0.18076683
s7 0.07788605
s8 0.10147055
s9 0.09649353
s10 0.05197826
s11 0.41793637
s12 1.18088423
would it be possible to help me providing the correct code +format so i can run it in r without getting all these error messages? A copy and paste example? That would be very helpful
Hi, i feel such a beginner
I keep on getting error messages.I understand the codeI think, but not the contents;when i post in R , and after C+I :i get:
logsouvenirtimeseries < log(souvenirtimeseries)
Error: object 'souvenirtimeseries' not found
souvenirtimeseriesforecasts < HoltWinters(logsouvenirtimeseries)
Error in as.ts(x) : object 'logsouvenirtimeseries' not found
souvenirtimeseriesforecasts
Error: object 'souvenirtimeseriesforecasts' not found
HoltWinters exponential smoothing with trend and additive seasonal component.
Error: unexpected symbol in "HoltWinters exponential"
Smoothing parameters:
Error: unexpected symbol in "Smoothing parameters"
alpha: 0.413418
Error in alpha:0.413418 : NA/NaN argument
beta : 0
Error in beta:0 : NA/NaN argument
gamma: 0.9561275
Error in gamma:0.9561275 : NA/NaN argument
Coefficients:

[,1]
Error: unexpected '[' in:
"Coefficients:
["
a 10.37661961
Error: unexpected numeric constant in "a 10.37661961"
b 0.02996319
Error: unexpected numeric constant in "b 0.02996319"
s1 0.80952063
Error: object 's1' not found
s2 0.60576477
Error: object 's2' not found
s3 0.01103238
Error: unexpected numeric constant in "s3 0.01103238"
s4 0.24160551
Error: object 's4' not found
s5 0.35933517
Error: object 's5' not found
s6 0.18076683
Error: object 's6' not found
s7 0.07788605
Error: unexpected numeric constant in "s7 0.07788605"
s8 0.10147055
Error: unexpected numeric constant in "s8 0.10147055"
s9 0.09649353
Error: unexpected numeric constant in "s9 0.09649353"
s10 0.05197826
Error: unexpected numeric constant in "s10 0.05197826"
s11 0.41793637
Error: unexpected numeric constant in "s11 0.41793637"
s12 1.18088423
Error: unexpected numeric constant in "s12 1.18088423"
The error messages are descriptive.
here is the first one for you :
logsouvenirtimeseries < log(souvenirtimeseries)
Error: object 'souvenirtimeseries' not found
From this its clear that on this line you attemtped to take the log()
of a variable that did not exist souvernirtimeseries
.
You should review your code, and understand how souvenirtimeseries
is to be assigned (created), before you start to use it to make other variables.