Skip to content
Prev 350526 / 398503 Next

LM() and time in R

Hello guys, 
thanks for your quick reply 
I will try and specific my problem 

I have over 300.000 observations for different petrol pumps in all of Denmark fra 1. november 2014 - 31 january 2015
for example I have: 

petrol pump number:  "1111" /  date: 1. november 2014 / time: 08:14:22 / price: 10.55 /day /   zipcode: 2000
petrol pump number:  "1111" /  date: 1. november 2014 / time: 08:29:00 / price: 10.52 / day / zipcode: 2000
petrol pump number: "3456" / date: 1. november 2014 / time: 08:19:21 / price: 10.88 / day/  zipcode: 2100


And then put the zip codes into dummy categories like X1: zipcode (1000-2000)=1 all others 0 and so on.

My regression model then look like 

lm(price, x1 + x2 + x3 ...  ) but the "Multiple R-squared" is really low, 0.01217 

So instead I would like to check if the time "hh:mm:ss" have an effect on the price. I know how to tell R about the date by as.Date() , but not with the time, how can I do that? 


Or do you guys maybe a third idea about what should make a regression about to improve the model?

Cheers 
Livia :) 

________________________________________
Fra: Boris Steipe [boris.steipe at utoronto.ca]
Sendt: 29. april 2015 20:25
Til: Livia Maria Vestergaard
Cc: r-help mailing list
Emne: Re: [R] LM() and time in R

Have a look at the help page for the function ts()
(type ?ts  at the R prompt).  Other than that, you haven't provided nearly enough information for us to diagnose your issue.

Please see here for some hints on how to ask questions productively:
http://adv-r.had.co.nz/Reproducibility.html
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
Cheers

B.
On Apr 29, 2015, at 6:26 AM, Livia Maria Vestergaard <lvest09 at student.sdu.dk> wrote: