Moving Deviation mdev - not working

Hi,Just recently started using kdb and have a q related to the mdevfunction. I can use mavg without issues to find the mov avg across alist of daily trade volume numbers, but when I try to get mdev I get0n.Eg.,DAILYVOL1002003004001. select 2 mavg DAILYVOL from (select DAILYVOL:sum amounts from tradewhere …)this works fineBut,2. select 2 mdev DAILYVOL from (select DAILYVOL:sum amounts from tradewhere …)doesn’t work … .Any suggestions would be most helpful,Thanks,- Raj.

Are these floating point?

Hi Rohit,Yes, but I was running the mdev on DAILYVOL which was int (cast fromfloating),select 2 mdev DAILYVOL from (select DAILYVOL:sum `int$amounts fromtrade …)Thanks and regards,- Nataraj.On Jan 7, 10:57?pm, Rohit Tripathi <rohit.x.tripa…> wrote:> Are these floating point?>>>>>>>> On Sun, Jan 8, 2012 at 9:13 AM, xbsd <xbs…> wrote:> > Hi,>> > Just recently started using kdb and have a q related to the mdev> > function. I can use mavg without issues to find the mov avg across a> > list of daily trade volume numbers, but when I try to get mdev I get> > 0n.>> > Eg.,>> > DAILYVOL> > 100> > 200> > 300> > 400>> > 1. select 2 mavg DAILYVOL from (select DAILYVOL:sum amounts from trade> > where …)> > this works fine>> > But,> > 2. select 2 mdev DAILYVOL from (select DAILYVOL:sum amounts from trade> > where …)>> > doesn’t work … .>> > Any suggestions would be most helpful,>> > Thanks,>> > - Raj.>> > –> >

Submitted via Google Groups</xbs…></rohit.x.tripa…>

Your aggregating all your amounts with the sum, and you can’t find a 2point moving deviation from the 1 value in your results set..q)tab:(a:til 5;b:5?10 20 30)q)select VOL:sum int$b from tabVOL---110/Doesn't workq)select 2 mdev VOL from (select VOL:sum int$b from tab)VOL—0/Add some aggregation function i.e. (select a by b from tab) so wehave a results set to get the moving deviation onq)select 2 mdev VOL from (select VOL:sum int$b by a from tab)VOL---05055Does that help?Thanks,NickOn Jan 8, 10:20?pm, xbsd <xbs...> wrote:&gt; Hi Rohit,&gt;&gt; Yes, but I was running the mdev on DAILYVOL which was int (cast from&gt; floating),&gt;&gt; select 2 mdev DAILYVOL from (select DAILYVOL:sum int$amounts from> trade …)>> Thanks and regards,>> - Nataraj.>> On Jan 7, 10:57?pm, Rohit Tripathi <rohit.x.tripa…> wrote:>>>>>>>> > Are these floating point?>> > On Sun, Jan 8, 2012 at 9:13 AM, xbsd <xbs…> wrote:> > > Hi,>> > > Just recently started using kdb and have a q related to the mdev> > > function. I can use mavg without issues to find the mov avg across a> > > list of daily trade volume numbers, but when I try to get mdev I get> > > 0n.>> > > Eg.,>> > > DAILYVOL> > > 100> > > 200> > > 300> > > 400>> > > 1. select 2 mavg DAILYVOL from (select DAILYVOL:sum amounts from trade> > > where …)> > > this works fine>> > > But,> > > 2. select 2 mdev DAILYVOL from (select DAILYVOL:sum amounts from trade> > > where …)>> > > doesn’t work … .>> > > Any suggestions would be most helpful,>> > > Thanks,>> > > - Raj.>> > > –> > >

Submitted via Google Groups</xbs…></rohit.x.tripa…></xbs…>