Re: [R] aggregating data with quality control

2024-08-31 Thread avi.e.gross
Stefano, I see you already have an answer that works for you. Sometimes you want to step back and see if some modification makes a problem easier to solve. I often simply switch to using tools in the tidyverse such as dplyr for parts of the job albeit much of the same can be done using functio

Re: [R] Prediction from Arima model

2024-08-31 Thread Rui Barradas
Às 18:54 de 31/08/2024, Christofer Bogaso escreveu: Hi, I have run following code to obtain one step ahead confidence interval from am arima model library(forecast) set.seed(100) forecast(Arima(rnorm(100), order = c(1,0,1), xreg = rt(100, 1)), h = 1, xreg = 10) However this appear to provide

Re: [R] Prediction from Arima model

2024-08-31 Thread Christofer Bogaso
Yes, very helpful. Also, my second question was how can I extract the prediction standard error? On Sun, Sep 1, 2024 at 1:00 AM Mark Leeds wrote: > > Chris: As David mentioned, if you have "new" data, then the interval has to > be a prediction > interval because the difference between a CI and

Re: [R] Prediction from Arima model

2024-08-31 Thread Mark Leeds
Chris: As David mentioned, if you have "new" data, then the interval has to be a prediction interval because the difference between a CI and a PI is that the PI is constructed for data that hasn't been seen yet. The CI is constructed for data that's already there. I hope this helps. On Sat, Aug 3

Re: [R] Prediction from Arima model

2024-08-31 Thread Christofer Bogaso
I want to obtain confidence interval for a new data as well as estimate of SE for the new data On Sat, Aug 31, 2024 at 11:58 PM David Winsemius wrote: > > > Sent from my iPhone > > > On Aug 31, 2024, at 10:55 AM, Christofer Bogaso > > wrote: > > > > Hi, > > > > I have run following code to obt

Re: [R] Prediction from Arima model

2024-08-31 Thread David Winsemius via R-help
Sent from my iPhone > On Aug 31, 2024, at 10:55 AM, Christofer Bogaso > wrote: > > Hi, > > I have run following code to obtain one step ahead confidence interval > from am arima model > > library(forecast) > > set.seed(100) > > forecast(Arima(rnorm(100), order = c(1,0,1), xreg = rt(100,

[R] Prediction from Arima model

2024-08-31 Thread Christofer Bogaso
Hi, I have run following code to obtain one step ahead confidence interval from am arima model library(forecast) set.seed(100) forecast(Arima(rnorm(100), order = c(1,0,1), xreg = rt(100, 1)), h = 1, xreg = 10) However this appear to provide the Prediction interval, however I wanted to get the

Re: [R] aggregating data with quality control

2024-08-31 Thread Stefano Sofia
Thank you for all your suggestions. Ivan's hint has been very easy to implement, a good solution indeed. Thank you again Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Co

Re: [R] aggregating data with quality control

2024-08-31 Thread Rui Barradas
Às 12:15 de 31/08/2024, Stefano Sofia escreveu: Dear R-list users, I deal with semi-hourly data from automatic meteorological stations. They have to pass a manual validation; suppose that status = "C" stands for correct and status = "D" for discarded. Here a simple example with "Snow height"

Re: [R] aggregating data with quality control

2024-08-31 Thread Ivan Krylov via R-help
В Sat, 31 Aug 2024 11:15:10 + Stefano Sofia пишет: > Evaluating the daily mean indipendently from the status is very easy: > > aggregate(mydf$hs, by=list(format(mydf$data_POSIX, "%Y"), > format(mydf$data_POSIX, "%m"), format(mydf$data_POSIX, "%d")), > my.mean) > > > Things become more comp

[R] aggregating data with quality control

2024-08-31 Thread Stefano Sofia
Dear R-list users, I deal with semi-hourly data from automatic meteorological stations. They have to pass a manual validation; suppose that status = "C" stands for correct and status = "D" for discarded. Here a simple example with "Snow height" (HS): mydf <- data.frame(data_POSIX=seq(as.POSIX