We present an analytical model for the I-V characteristics of AlGaN/GaN and AlInN/GaN high electron mobility transistors (HEMT). Our study focuses on the influence of a GaN capping layer, and of thermal and self-heating effects. Spontaneous and piezoelectric polarizations at Al (Ga,In)N/GaN and GaN/Al(Ga,In)N interfaces have been incorporated in the analysis. Our model permits to fit several published data. Our results indicate that the GaN cap layer reduces the sheet density of the two-dimensional electron gas (2DEG), leading to a decrease of the drain current, and that n+-doped GaN cap layer provides a higher sheet density than undoped one. In n+GaN/AlInN/GaN HEMTs, the sheet carrier concentration is higher than in n+GaN/AlGaN/GaN HEMTs, due to the higher spontaneous polarization charge and conduction band discontinuity at the substrate/barrier layer interface.