Using the mirror equation:
\[
\frac{1}{f} = \frac{1}{u} + \frac{1}{v}
\]
where \( u = -18 \, {cm} \) (object distance, negative for real object), and \( v = 4 \, {cm} \) (image distance, positive indicating virtual image).
Solving for the focal length \( f \):
\[
\frac{1}{f} = \frac{1}{-18} + \frac{1}{4} = -\frac{1}{18} + \frac{1}{4} = \frac{-1+4.5}{18} = \frac{3.5}{18} = \frac{7}{36}
\]
\[
f = \frac{36}{7} \approx 5.14 \, {cm}
\]
Since the image distance is positive and less than the object distance, the mirror is convex, and the image formed is virtual.