You're right, Jude, there are no built-in commands to calculate those, however, I just uploaded a subroutine that will do all those. Check out the 2nd post in this thread on subroutines.
That subroutine expects you to have a table loaded with the values you want to average, etc.
Have you already figured out how to collect such a sample? Will this change over time? Do you necessarily need something that fancy? Perhaps a simple condition of "Within Limits?" would work?
Any/all you could share about the details might help us give you more options and better answers.
You may also be interested in this thread on moving averages (includes a video!) especially if you can use the built-in totalizing functions available on your I/O unit.
p.s. If you need some fancier stats done, check out this OptoNews item where one of our OptoFriends as coded a variety of other functions.