According to the Kubo formulas we employ the (3+1)-d parton cascade, Boltzmann approach of multiparton scatterings (BAMPS), to calculate the anisotropic transport coefficients (shear viscosity and electric conductivity) for an ultrarelativistic Boltzmann gas in the presence of a magnetic field. The results are compared with those recently obtained by using the Grads approximation. We find good agreements between both results, which confirms the general use of the derived Kubo formulas for calculating the anisotropic transport coefficients of quark-gluon plasma in a magnetic field.