manually calculate frequencies