Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Milena Przheska <milena.przheska@cosmicdevelopment.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: duplicated datetime variable differs from original datetime variable it was derived from |
Date | Tue, 12 Nov 2013 13:14:04 +0100 |
Actually, I'm using time to account for autocorrelation between events. The syntax is mixed positive ib(2).vertical || id:R.vertical, residuals(ar 1, t(time1)) covariance(exchangeable) On Tue, Nov 12, 2013 at 1:07 PM, William Buchanan <william@williambuchanan.net> wrote: > Can you send the syntax that is generating the error? Are you using time to > identify level 2 or higher units? Have you been able to replicate your > problem with any publicly available datasets so that other listserv members > can have a better idea of what you problem is? > > HTH, > Billy > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Milena Przheska > Sent: Tuesday, November 12, 2013 6:01 AM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: duplicated datetime variable differs from original datetime > variable it was derived from > > The problem is that my time1 variable is double, and yet, when using > it in the model, it gives that error message > > On Tue, Nov 12, 2013 at 12:54 PM, Nick Cox <njcoxstata@gmail.com> wrote: >> Same answer. Use a -double-. >> >> Nick >> njcoxstata@gmail.com >> >> >> On 12 November 2013 11:51, Milena Przheska >> <milena.przheska@cosmicdevelopment.com> wrote: >>> When I try to fit a mixed effects model with the time1 variable as >>> defined above, I get an error message "time variable must be >>> integer-valued". >>> >>> I do need the time variable to be by the second, otherwise I will have >>> duplicate values for the time variable. >>> >>> If you have any suggestions, I would very much appreciate it. >>> >>> Thank you, >>> Milena >>> >>> On Tue, Nov 12, 2013 at 12:41 PM, Nick Cox <njcoxstata@gmail.com> wrote: >>>> Phil has the answer in one. Unfortunately, you do have to keep >>>> remembering that a date-time to Stata is just an integer, usually >>>> large, giving time in milliseconds. >>>> >>>> . di %14.0f clock("07jun2012 03:11:48", "DMYhms") >>>> 1654657908000 >>>> >>>> Numbers that big have to be stored as -double-s. >>>> Nick >>>> njcoxstata@gmail.com >>>> >>>> >>>> On 12 November 2013 11:33, Phil Clayton <philclayton@internode.on.net> > wrote: >>>>> Dates with times need to be stored in double precision. Try: >>>>> gen double time1=time >>>>> >>>>> See -help datetime- >>>>> >>>>> Phil >>>>> >>>>> On 12 Nov 2013, at 10:25 pm, Milena Przheska > <milena.przheska@cosmicdevelopment.com> wrote: >>>>> >>>>>> Dear Statalist members, >>>>>> >>>>>> When duplicating a time variable by typing >>>>>> >>>>>> gen time1 =time >>>>>> >>>>>> the new variable time1 is off by several seconds from the variable > time, so >>>>>> >>>>>> time >>>>>> 06jun2012 22:44:51 >>>>>> 06jun2012 22:44:54 >>>>>> 06jun2012 22:44:56 >>>>>> 07jun2012 01:39:58 >>>>>> 07jun2012 01:40:05 >>>>>> 07jun2012 01:40:45 >>>>>> 07jun2012 03:09:48 >>>>>> 07jun2012 03:09:48 >>>>>> 07jun2012 03:11:06 >>>>>> >>>>>> becomes >>>>>> >>>>>> time1 >>>>>> 06jun2012 22:45:17 >>>>>> 06jun2012 22:45:17 >>>>>> 06jun2012 22:45:17 >>>>>> 07jun2012 01:40:03 >>>>>> 07jun2012 01:40:03 >>>>>> 07jun2012 01:40:03 >>>>>> 07jun2012 03:09:37 >>>>>> 07jun2012 03:09:37 >>>>>> 07jun2012 03:11:48 >>>>>> >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/