The best way to obtain an accurate GPS height estimate requires a static pressure measurement on board the aircraft and an accurate atmosphere model, valid at the time of measurement.
Pressure is measured on board, but often converted to pressure altitude.
If you have static pressure in your dataset, use that. If you have pressure altitude, convert it to pressure using the standard atmosphere model (see ICAO doc 7488)
Now that we have pressure, we take the atmosphere model valid at the time of measurement. This could be obtained from, for example, NOAA or ECMWF.
Within the atmosphere model, typically a GRIB2 grid file, you interpolate the position, time and pressure level and obtain the geopotental height.
The interpolatation requires some thought. Linear interpolation will yield inaccurate results for geopotential height, as the variation of geopotential height with pressure is non-linear but logarithmic.
Now that we have the geopotential height, we can convert to geometric height, using the formulas from ICAO DOC 7488.
The resulting geometric height is measured above mean sea level (AMSL). GPS output is typically with give as height above WGS84 ellipsoid (HAE). To convert between AMSL and HAE, you can use EGM2008.