powered by
Computes the proportion of mismatches between two binary or factor vectors of equal length.
hamming_distance(beta_star, beta_init)
Scalar in [0,1] giving the fraction of differing positions.
Target vector (true value).
Initial/candidate vector.
hamming_distance(c(1, 0, 1, 0), c(1, 1, 1, 0)) # 0.25
Run the code above in your browser using DataLab