As the title says...I have my data in the form :
{{year,month,day,hour,minute,second,variable},{year,month,day,hour2,minute2,second2,variable}, ...}
LinearModelFit[data,x,x]
does not work :P (I am new to Mathematica, so
any pointers will be appreciated)
Thanks
LinearModelFit[data,x,x]
thedata
should be{{time, variable},{time2, variable2},...}
so you need to manipulatedata
initially $\endgroup$TimeSeriesModelFit
in this case, I would useAbsoluteTime[{y,m,d,h,m,s}]
to convert the times. You may then useStandardize[ {absTime1, absTime2, ...}, First, 1&]
to shift the times to start with 0. $\endgroup$LinearModelFit[data,x,x]
won't work because the number of columns in data is greater than the number of regressors (x). If you want to make this work, then you should use something likelmf=LinearModelFit[data, {x1,x2,x3,x4,x5,x6}, {x1,x2,x3,x4,x5,x6}]
. Also note how your regression will contain a constant term. If you don't want that, you should include the option_IncludeConstantBasis_->False
$\endgroup$LinearModelFit[data,x,x]
will report an error when evaluated. Note, that the input data are already date/time components. The fact that you interpret the question as a request for providing - in addition to making the given code work - a way to acquire a date/time time-stamp is something that is not asked. As a side note, in my previous comment I said that theLinearModelFit[data,x,x]
wouldn't work, not that your version wouldn't work. The fact is that usingAbsoluteTime[]
is not relevant in the present context $\endgroup$