Electric and magnetic losses and gains in determining the sign of refractive index