Effective electron-electron and electron-phonon interactions in the Hubbard-Holstein model