The sinusoidal roughness effect is investigated using a direct numerical simulation (DNS) of a spatially developing turbulent boundary layer (TBL) over three-dimensional sinusoidal roughness. The validity of Townsend's outer-layer similarity hypothesis is assessed based on comparisons of mean and second-order flow statistics, with a DNS of smooth-wall TBL data set at a similar Reynolds number. The total, Reynolds and dispersive stress tensors are calculated using the double-averaging procedure. The mean and second-order statistical similarities in the outer layer between rough-wall and smooth-wall TBLs are generally observed. The transport between total, turbulent and dispersive kinetic energy is investigated utilising triple-decomposed kinetic energy transports equations. The transport behaviour of turbulent kinetic energy (TKE) is significantly affected by the local mean shear induced by the surface roughness. However, the TKE transport shows good collapse with the smooth-wall case in the outer region of the flow. On the other hand, the transport of dispersive kinetic energy, including local production, redistribution and dissipation, are confined within the roughness sublayer. The intercomponent transfer between TKE and dispersive kinetic energy is quantified from the triple-decomposed kinetic energy transport equations. The intercomponent energy transfer is associated with the local spatial gradients of the turbulent momentum fluxes generated near the roughness canopy.