Relation of the F2 region to stratospheric parameters: Dependence on magnetic activity in two solar cycles