I tried to look up more information from the original production. Ken Ralston (ILM VFX supervisor) said it's basically a container for Starfleet ships which obviously refers to the top main section.
Bill George describes in the Cinefex
issue for ST VI that he tried to show Earth Spacedock from a new and interesting angle and felt that ships arriving from Earth (i.e. below) should also be taken in "below", hence this shot in ST VI
(notice the four 2001-Space Station V type cylinders at the bottom with rectangular hangar bays).
I think this schematic
is a very good approximation, but IMHO all the areas below the "secondary docking bay" would be where the "living quarters" are. After all the panoramic windows there would give you a greater view of Earth than those in the stem section below and you got plenty, plenty of room there, too.
If Earth Spacedock is an inside-turned-out version of Cloud City from Star Wars
the sphere at the bottom is most definitely a reactor as the one of Cloud City was also equally positioned down below (probably as a means of protection from possible, hazardous radiation).