thanks,
One problem that I noticed is that in your example, you show that time is the within subjects factor, but in your reality you seem to treat the group as the within subjects factor.

the f-value that you get for time seems to come from dividing MStime by MSerror. This should really be MStime / MSsubjects if this is the variable with repeated measures. You also get the f value for group by MSgroup / MSsubjects. The group variable should not have repeated measures, so basically, the two should be reversed. I'm not sure, but I think that the error is consistent with itself int he rest of your code, so In order to get the correct results from this function you need to switch the organize your two factors opposite of the way that the you did it in the example.