But can we predict the number of stars in a particular type of galaxy based solely on its size? Well, in a very real sense, this would be like trying to come up with a formula to determine the number of hairs on a person’s body based solely upon their weight.
That is to say: a lot of other factors come into play, as well.
A rule-of-thumb approach can perhaps be taken, by selecting a particular galaxy and its stellar complement as a “standard candle” for its type; for instance, using the Milky Way as the standard for spiral galaxies (barred, intermediate, and unbarred), we’d say that for a spiral galaxy of Size 1 (the same size as the Milky Way), the stellar population is about 400 billion stars, or 4.0E+11. A spiral galaxy half the size would have (4.0E+11) ⨉ 0.5 = 2.0E+11 stars (200 billion). A spiral galaxy twice the size of the Milky Way would have 8.0E+11 stars (800 billion).
Checking this against real-world values, however, we find that the Andromeda Galaxy (M31), which at 220,000 light years in diameter is 2.2 times the size of the Milky Way, would be calculated to possess 8.0E+11 stars (800 billion) stars. Yet, “…2006 observations by the Spitzer Space Telescope revealed that Andromeda contains one trillion (1.0E+12) stars” , which is 1.14 times the number we just calculated.
In the ballpark, true, but hardly exact.
In practice, one must either invoke rationale ultimum—The Omega Argument , or—perhaps the safer route—select a known galaxy of the type and size one wishes to simulate, and use the known values for that galaxy.
Galactic Habitable Zones
If such a thing could be shown to exist, it would be similar to a stellar habitable zone; a region within the galaxy, beginning some minimum distance from the center and ending some minimal distance from the outermost edge. Stars orbiting within this GHZ would be protected from the intense radiation and other negative impacts of the dense and rather chaotic center, but also not be lonely wanderers in the sparse regions of the galactic fringes.
In an article of September 2, 2015 in Phys.org, Pratika Dayal writes:
Drawing on our understanding of habitable zones within a galaxy, we proposed that the overall habitability of any galaxy depends on three key astrophysical criteria. One is simply the total number of stars capable of hosting planets, which is roughly related to the size of the galaxy. Another is the total amount of the building blocks of planets and life – such as carbon, oxygen and iron – the so-called astrophysical "metals". Another is the negative influence of supernova explosions, whose powerful (and poisonous) radiation could potentially inhibit the formation and evolution of complex life on nearby planets.
Interestingly, the largest survey of its kind ever undertaken, data from the Sloan Digital Sky Survey observes exactly these three key properties for more than 150,000 galaxies in the nearby universe. This data shows that the largest galaxies have the largest amount of metals. Sifting through this data set we found that giant elliptical galaxies, which have a rounded shape rather than spiral arms like our Milky Way, win the "most-likely-to-be-habitable" title. Indeed, each giant elliptical that is at least twice as big as the Milky Way and has a tenth of its supernova rate could potentially host 10,000 times as many habitable (Earth-like) planets.
Our results, recently published in the Astrophysical Journal Letters, also show that they typically have a low rate of supernova explosions, ensuring that most of these planets remain unmolested by harmful radiation.
Spiral Galaxies: Population Density in Spiral Arms
In either case, it may be that the “thick” of a spiral arm would be a dangerous place . Igniting or merging young stars could periodically bathe nearby planets in deadly doses of high-intensity radiation. Any planets orbiting a star in a more densely populated region would also have an increased chance of being exposed to the deadly effects of nearby supernovae.
In addition, a planet’s own star may undergo a merger with another star, likely ejecting most or all of the planets of either or both stars outward into interstellar space (those that weren’t evaporated or ejected by the incoming star!)
Finally, dense molecular clouds in the region of the arms might force a contraction of stellar winds that can have deleterious effects on a planet’s ecosphere. 
There is another challenge to habitability, related to the way in which stars orbit the center of spiral galaxies. For simplicity, let’s use our own local star as the example.
Amplitude of the Sun's Orbit
Thus, every 35 million years or so (roughly 3.57 times per orbit around the galaxy ) the Sun (and all its planets) pass either "upward" or "downward" through the densest part of the local galactic disk.
There is—again—much debate, but it is possible that during the transition from one side of the galactic plane to the other, encounters with the aforementioned molecular clouds (H II regions) and other hazards of the interstellar medium might have negative impacts on planetary atmospheres and climates, as well as causing disturbances in the Oort cloud which could lead to increased meteor and comet activity.
Research  seems to indicate that the occasions when the Sun traverses the galactic plane are on a similar cycle to that of the mass extinctions observed in the fossil record.
Oscillation in the Eccentricity of the Sun's Orbit
The Galactic Bow Shock
The Off-Kilter Solar System
Globular and open clusters are not good candidates; among galaxies, either barred or unbarred spirals would seem to be the most likely places for habitable star systems, but even within these there are regions which are more suitable and others not so much.
In addition, the results of the complex interactions of the Milankovitch cycles (more on this later) with the galactic cycles sketched above are certainly related to long-term changes in Earth’s climate; there seems to be some relationship to glaciations , and there are some speculations that there may be connections to the occurrences of major extinctions, as well .
3. “It is so because I say it is so.”
4. en.wikipedia.org/wiki/Galactic_habitable_zone - Criticism
7. en.wikipedia.org/wiki/Galactic_habitable_zone - Galactic_morphology
11. 250 million years per orbit ÷ 70 million years per oscillation
19. assets.zombal.com/190ce537/Angle Solar System Galactic Plane.pdf