In television, shows are often not broadcast in the order they were produced. In Love Stinks (2001), Alice, Roz's daughter is about 6 years old. In this episode though, she's back to being a toddler, dressed as a puppy for Frasier's Halloween Party.
When Niles is drinking beer, the beer cans on the table change positions between shots. The number of cans changes, too.
Martin, as Joe DiMaggio, tells Niles, as Martin, that he retired when Frasier and Niles were infants. Frasier, the older brother, is canonically identified as 41 years old in 1993's season 1, meaning he was born in 1951 or 1952. Frasier might have been an infant in 1951 when DiMaggio retired but Niles, the younger brother, certainly was not born yet.
With all the Yankee greats, it would be sheer luck that Roz could tell Martin was Joe DiMaggio without seeing the number on the back of his jersey. He coincidentally was sitting in his chair when she identified him without hesitation. But, it is entirely possible that Martin has commented that DiMaggio is his favorite baseball player and hero in past encounters with Roz. It is seen throughout the series that Roz and Marty share a love of sports. So, a conversation between the two of them about favorite players and childhood idols would certainly be very possible.
NIles in his speech as Martin Crane says his boys never learned about baseball or had a beer and hung out with the boys but yet this is exactly what Frasier did during his time on Cheers as he was friends with Sam Malone a former baseball player and hung out with Woody,Cliff and Norm and even was part of their group when they did things like road trips or played cards.