  The purpose of this work is to perform a statistical analysis of the location
of compact groups in the Universe from observational and semi-analytical points
of view. We used the velocity-filtered compact group sample extracted from the
Two Micron All Sky Survey for our analysis. We also used a new sample of galaxy
groups identified in the 2M++ galaxy redshift catalogue as tracers of the
large-scale structure. We defined a procedure to search in redshift space for
compact groups that can be considered embedded in other overdense systems and
applied this criterion to several possible combinations of different compact
and galaxy group subsamples. We also performed similar analyses for simulated
compact and galaxy groups identified in a 2M++ mock galaxy catalogue
constructed from the Millennium Run Simulation I plus a semi-analytical model
of galaxy formation. We observed that only $\sim27\%$ of the compact groups can
be considered to be embedded in larger overdense systems, that is, most of the
compact groups are more likely to be isolated systems. The embedded compact
groups show statistically smaller sizes and brighter surface brightnesses than
non-embedded systems. No evidence was found that embedded compact groups are
more likely to inhabit galaxy groups with a given virial mass or with a
particular dynamical state. We found very similar results when the analysis was
performed using mock compact and galaxy groups. Based on the semi-analytical
studies, we predict that $70\%$ of the embedded compact groups probably are 3D
physically dense systems. Finally, real space information allowed us to reveal
the bimodal behaviour of the distribution of 3D minimum distances between
compact and galaxy groups. The location of compact groups should be carefully
taken into account when comparing properties of galaxies in environments that
are a priori different.
