Re: [R] Problems with "predict" function ii

2018-01-31 Thread Rui Barradas
Hello, First of all, your question is about 'predict' but you include graphic instructions that have nothing to do with it. They do not hurt, but the reproducible example should also be minimal. Second, whenever you use RNG's, you should start it with set.seed(). Now, I have edited your

Re: [R] Problems with "predict" function ii

2018-01-31 Thread PIKAL Petr
] On Behalf Of WRAY NICHOLAS via R-help Sent: Wednesday, January 31, 2018 6:20 PM To: r-help <r-help@r-project.org> Subject: [R] Problems with "predict" function ii I have realised that I should have used "detach" before attaching another dataframe, but even when I do this

Re: [R] Problems with "predict" function

2018-01-31 Thread Simmering, Jacob E
Your messages about masking come from attaching your data set to the R session. In general, that is bad practice as it leads to confusing code. It is typically better to use the “data” argument in things like lm() to accomplish this task. As near as I can tell, your second set of predictions

Re: [R] Problems with "predict" function ii

2018-01-31 Thread Jeff Newmiller
This is the kind of thing that leads experienced R users to avoid attach for data analysis. Read "The R Inferno". Use the "data" argument to lm, and the "newdata" argument to predict.lm. -- Sent from my phone. Please excuse my brevity. On January 31, 2018 9:20:10 AM PST, WRAY NICHOLAS via

[R] Problems with "predict" function ii

2018-01-31 Thread WRAY NICHOLAS via R-help
I have realised that I should have used "detach" before attaching another dataframe, but even when I do this it's still giving me lots of lines, rather than just one: My code: m<-runif(1,0,1) m mres<-m*(seq(1,12)) mres ssd<-rexp(1,1) ssd devs<-rep(0,length(mres)) for(i in

[R] Problems with "predict" function

2018-01-31 Thread WRAY NICHOLAS via R-help
Hello, I am synthesising some sales data over a twelve month period, and then trying to use the "predict" function, firstly to generate a thirteenth month forecast with upper and lower 95% confidence limits. So far so good But what I then want to do is add the upper sales value at the 95th