# Help with the Price equation

The Price equation describes mathematically the evolution of a population of units from one generation to the next.

$\bar{w}\Delta \bar{z}$ = $Cov (w_i,z_i)$+$E(w_i\Delta z_i)$

I would like to know how to actually employ the equation to some data. Perhaps a simple online "walk-through" type guide of the Price equation would help. It should simply show the calculation of the Price equation using numbers from an example population. For example, I'd like to see how the Price equation is applied to the following scenario:

A population, $P$, of 5 individuals reproduces to produce population $P'$.

The trait value of the $i^{th}$ individual is $z_{i}$ where $z_1$, $z_2$ and $z_3$ all = 1 and where $z_4$ and $z_5$ both = 2 and $\bar{z}$ = 1.4.

Absolute fitness is $w_i$ for the $i^{th}$ individual where $w_1$, $w_2$ and $w_3$ all = 1, and $w_4$ and $w_5$ both = 5.

Relative fitnesses, $\omega_i$, are $\omega_{z=1}$ = 0.077, and $\omega_{z=2}$ = 0.385.

Thus the population $P'$ has $n$ = 13, with 3 individuals where $z$ = 1 and 10 individuals where $z$ = 2 and $\bar{z}'$ = 1.769.

$\Delta z$ is the transmission bias and is equal to 0 in this case (perfect transmission of the trait score $z$)

The value $\Delta \bar{z}$ = $Cov (w,z)/ \bar{w}$ = ....

Here's an R script to create the above information:

# Define two trait values:
z1 = 1
z2 = 2

# Define two fitness values:
w1 = 1
w2 = 5

# Set number of units possesing each trait in P population:
n1 = 3
n2 = 2

# Create data
df = data.frame(c(rep(z1,n1),rep(z2,n2)),c(rep(w1,n1),rep(w2,n2)))
colnames(df) = c("z","w")

df$omega = df$w / sum(df$w) n_P = length(df$z)
n_O = sum(df$w) z_P_bar = mean(df$z)