How is power factor calculated?

We calculate power factor off of real power (P) and apparent power (S). Where pf = P/S. Real power is calculated from the product of the Instantaneous Voltage and Current. Apparent power is calculated from the product of the RMS values for Voltage and Current.