similar to: Time-series moving average question

Displaying 20 results from an estimated 100 matches similar to: "Time-series moving average question"

2018 Jun 01
2
Time-series moving average question
My guess would be that if you inspect the output from ma(dat3[1:28], order=3) you will find some NAs in it. And then forecast() doesn't like NAs. But I can't check, because I can't find the ma() and forecast() functions. I assume they come from some package you installed; it would be helpful to say which package. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000
2018 Jun 01
0
Time-series moving average question
Hi Don, wow, you are so right. I picked that piece up from the bloggers tutorial and since I am R naive yet, I thought it was all one step moving_average = forecast(ma(tdat[1:31], order=2), h=5) Truly, I usually print and check at every step I can, as painful as it is sometimes. Great lesson for this novice usR. So the first and last values are NA in each case? Do you know why? Should I replace
2018 Jun 01
2
Time-series moving average question
You are right that there are no NAs in the practice data. But there are NAs in the moving average data. To see this, break your work into two separate steps, like this: tnr.ma <- ma(dat3[1:28], order=3) TNR_moving_average <- forecast(tnr.ma, h=8) I think you will find that the warning comes from the second step. Print tnr.ma and you will see some NAs. -Don -- Don MacQueen Lawrence
2017 Oct 02
2
Default value of the option initial in the ses function in the forecast package.
Dear All, I am trying to use the function ses from the forecast package. >From its help I have : Usage: ses(y, h = 10, level = c(80, 95), fan = FALSE, initial = c("optimal", "simple"), alpha = NULL, lambda = NULL, biasadj = FALSE, x = y, ...) My query is that if I do not mention the initial value will its default value be "optimal". A MWE would be
2017 Oct 02
0
Default value of the option initial in the ses function in the forecast package.
The first one, i.e. "optimal"; check help for match.arg() for the idiom. -pd > On 2 Oct 2017, at 11:48 , Ashim Kapoor <ashimkapoor at gmail.com> wrote: > > Dear All, > > I am trying to use the function ses from the forecast package. > > From its help I have : > > Usage: > > ses(y, h = 10, level = c(80, 95), fan = FALSE, initial =
2018 May 15
0
Forecasting tutorial "Basic Forecasting"
Instead of Tsp = c(2016, 2018, 12) try Tsp = c(2016, 2018.25, 12) Hence, you can specify the object as structure(c(5973156.76, 5159011.2, 6695766.64, 6365359, 6495218.53, 7226302.39, 6835272.7, 7383501.57, 6962748.19, 7623278.72, 7274994.33, 7919421.8, 7360740.81, 7436693.35, 8545765.55, 7337269.76, 8180585.44, 8376635.05, 7758261.24, 10374641.22, 8000314.11, 9114958.9, 9805149.15,
2018 Jun 01
0
Time-series moving average question
Hello Don, thank you for your response. I appreciate your help. I am using the forecast package, originally I found it following a forecasting example on bloggers.com https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/ And subsequently located the complete pdf https://cran.r-project.org/web/packages/forecast/forecast.pdf Since I created this practice data using the
2010 Jul 14
1
Write value to PHP webpage
I have a series of animals that are being radio-tracked. I have written some code that goes through each animal and calculates the total distance that each animal is traveling. I will need to run these data on a regular basis and want to write the result to a .php webpage file so that the page updates automatically when I re-run the code. I thought I'd be able to use the
2018 May 15
3
Forecasting tutorial "Basic Forecasting"
Hi. I am trying to follow this forecasting tutorial at: https://www.r-bloggers.com/basic-forecasting/ Using my own data, I cannot get past the first step, lots of laughs. dat3 <- structure(c(5973156.76, 5159011.20, 6695766.64, 6365359.00, 6495218.53, 7226302.39, 6835272.70, 7383501.57, 6962748.19, 7623278.72, 7274994.33 ,7919421.80, 7360740.81, 7436693.35,
2005 Jan 06
1
GLMM and crossed effects
Hi again. Perhaps a simple question this time.... I am analysing data with a dependent variable of insect counts, a fixed effect of site and two random effects, day, which is the same set of 10 days for each site, and then transect, which is nested within site (5 each). I am trying to fit the cross classified model using GLMM in lme4. I have, for potential use, created a second coding
2011 Oct 21
4
plotting average effects.
hi... i am a phd student using r. i am having difficulty plotting average effects. admittedly, i am not really understanding what each of the commands mean so when i get the error i am not sure where the issue is. here is my code... i will include the points at which there are errors.... > dat2 <- dat3 <- dat > dat2$popc100 <- dat2$popc100 + 1000 >
2011 Feb 02
0
How column names/row names are preserved in matrix calculation?
Can somebody tell me that, if I do some arithmetic calculation over 2 matrices then how the column names and row names are preserved? It seems that, for multiplication, column names and row names of the 2nd matrix are preserved and for additional, there seems not having any explicit rule: > set.seed(1) > dat1 <- matrix(rnorm(25), 5); colnames(dat1) = rownames(dat1) =
2011 Feb 28
0
Gamma mixture models with flexmix
I've been trying with no success to model mixtures of Gamma distributions using the package flexmix (see examples below). Can anyone help me get it to model better? Thanks very much. -Ben ## ## Please help me get flexmix to correctly model mixtures of ## Gamma distributions. See examples below. ## library('flexmix') ## ## Plot a histogram of dat and the Gamma mixture model given
2013 Sep 10
0
Looping an lapply linear regression function
Hi, Try: dat2<- read.csv("BOlValues.csv",header=TRUE,sep="\t",row.names=1) dim(dat2) #[1] 20 28 indx2<-expand.grid(names(dat2),names(dat2),stringsAsFactors=FALSE) nrow(indx2) #[1] 784 indx2New<- indx2[indx2[,1]!=indx2[,2],] nrow(indx2New) #[1] 756 res2<-sapply(seq_len(nrow(indx2New)),function(i) {x1<- indx2New[i,];
2013 Sep 27
0
Best and Worst values
Ira, obj_name<- load("arun.RData") Pred1<- get(obj_name[1]) Actual1<- get(obj_name[2]) dat2<- data.frame(S1=rep(Pred1[,1],ncol(Pred1)-1),variable=rep(colnames(Pred1)[-1],each=nrow(Pred1)),Predict=unlist(Pred1[,-1],use.names=FALSE),Actual=unlist(Actual1[,-1],use.names=FALSE),stringsAsFactors=FALSE) dat2New<- dat2[!(is.na(dat2$Predict)|is.na(dat2$Actual)),] ?dat3<-
2013 Apr 12
1
Removing rows that are duplicates but column values are in reversed order
Hi, From your example data, dat1<- read.table(text=" id1?? id2?? value a????? b?????? 10 c????? d??????? 11 b???? a???????? 10 c????? e???????? 12 ",sep="",header=TRUE,stringsAsFactors=FALSE) #it is easier to get the output you wanted dat1[!duplicated(dat1$value),] #? id1 id2 value #1?? a?? b??? 10 #2?? c?? d??? 11 #4?? c?? e??? 12 But, if you have cases like the one
2012 Nov 13
4
for loop
HI, You can do this in many ways: dat1<-read.table(text=" med1,med2,med3???? ?1,0,1?????? 0,1,1??? 2,0,0 ",sep=",",header=TRUE)?? #1st method library(reshape) dat2<-melt(dat1) dat3<-aggregate(dat2$value,by=list(dat2$variable),sum) ?colnames(dat3)<-c("name","sum(n11)") ?dat3 #? name sum(n11) #1 med1??????? 3 #2 med2??????? 1 #3 med3??????? 2
2004 May 10
1
Explaining Survival difference between Stata and R
Dear Everybody: I'm doing my usual "how does that work in R" thing with some Stata projects. I find a gross gap between the Stata and R in Cox PH models, and I hope you can give me some pointers about what goes wrong. I'm getting signals from R/Survival that the model just can't be estimated, but Stata spits out numbers just fine. I wonder if I should specify initial
2013 Sep 09
0
Duplicated genes
Hi, May be you can try this: dat1New<-? dat1[!(duplicated(dat1$gene)|duplicated(dat1$gene,fromLast=TRUE)),] dat2<-dat1[duplicated(dat1$gene)|duplicated(dat1$gene,fromLast=TRUE),] ?lst1<-split(dat2,dat2$gene) dat3<-unsplit(lapply(lst1,function(x) {x1<- sum(apply(x[,6:32],2,function(y) y[1]>=y[2]));x2<- sum(apply(x[,6:32],2, function(y) y[1]<=y[2])); if(x1>x2) x[1,] else
2012 Mar 10
3
function input as variable name (deparse/quote/paste) ??
Hi all Say I have a function: myname=function(dat,x=5,y=6){ res<<-x+y-dat } for various input such as myname(dat1) myname(dat2) myname(dat3) myname(dat4) myname(dat5) how should I modify the 'res' line, to have new informative variable name correspondingly, such as dat1.res dat2.res dat3.res dat4.res dat5.res stored in the workspace. This is only an example of a complex