The transthoracic electrical impedance signal originates from the cardiac and respiratory functions. In impedance pneumography (IP) the lung function is assessed and the cardiac impedance signal, cardiogenic oscillations (CGOs), is considered an additive noise in the measured signal. In order to accurately determine pulmonary flow parameters from the signal, the CGO needs to be attenuated without distorting the respiratory part of the signal. We assessed the suitability of a filtering technique, originally described by Schuessler et al (1998 Ann. Biomed. Eng. 26 260-7) for an esophageal pressure signal, for CGO attenuation in the IP signal. The technique is based on ensemble averaging the CGO events using the electrocardiogram (ECG) R-wave as the trigger signal. Lung volume is known to affect the CGO waveforms. Therefore we modified the filtering method to produce a lung volume-dependent parametric model of the CGO waveform. A simultaneous recording of ECG, IP and pneumotachograph (PNT) was conducted on 41 healthy, sitting adults. The performance of the proposed method was compared to a low-pass filter and a Savitzky-Golay filter in terms of CGO attenuation and respiratory signal distortion. The method was found to be excellent, exhibiting CGO attenuation of 35.0±12.5 dB (mean±SD) and minimal distortion of the respiratory part of the impedance signal.