rao <- function(x,lambda) { # ************************************************************************* # # FILE: rao.m # # Date Created: Feb 4, 2004 # Author: Mark E. Irwin # # Contents: Calculates the first derivative of the log likelihood for the # AB|ab x AB|ab linkage analysis from Rao, 1973. Uses the # alternative parametrization of lambda = 1 - 2 theta + theta^2. # The functions allows for different data sets to be used, not # just the standard one used in most papers. # # Revision History # Date Name Changes/Reasons # # ************************************************************************* # # Input: # # x: the vector of counts for AB, Ab, aB, and ab phenotypes # lambda: parameter value of interest (= 1 - 2 theta + theta^2) # (the actual data is [125 18 20 34]) # # Output: # # y: derivative of the log likelihood # # ************************************************************************* y <- x[1]/(2+lambda) - (x[2] + x[3])/(1-lambda) + x[4]/lambda y }