Other users have already given answers from the definition perspective. Here, I have given an example of Afferent Coupling (Ca) and Efferent Coupling (Ce) for package-level granularity.
Suppose, package1 has 3 classes (i.e., A, B, C) and package2 has 2 classes (i.e., P, Q). For package1, class A has 2 out-going edges, class B has 1 out-going edge, and class C has 1 in-coming edge. Similarly, for package2, class P has 2 in-coming edges, and class Q has 1 in-coming and 1 out-going edge. [see the figure].
To calculate the Ca for a package, count the number of classes out of the package that has dependencies on it. You can proceed one by one for all classes of that package and then, take the union of dependent classes.
To calculate the Ce for a package, count the number of classes dependent on other packages inside the analyzed package. Count for all classes of that package and then, take the union.
So, the calculation will be as follows--
package1
Ca = {} union {} union {Q}
= {Q}
= 1
Ce = {P, Q} union {P} union {}
= {P, Q,}
= 2
package2
Ca = {A, B} union {A}
= {A, B}
= 2
Ce = {} union {C}
= {C}
= 1
Afferent Coupling and Efferent Coupling are used to calculate the Instability (I) of a package also. Instability is the ratio between Efferent Coupling (Ce) and the total package coupling (Ce + Ca). The formula is
I = Ce / (Ce + Ca)
The value of instability is between 0 to 1. The value towards 1 means unstable package (i.e., prone to change) and the value towards 0 means stable package.
For this example,
Instability for package1 = 2/(1+2) = 0.67
and,
Instability for package2 = 1/(2+1) = 0.33
So, we can conclude that package1 is more unstable than package2 by measuring the afferent and efferent coupling.
For additional info you may check this paper also.