## normErrProb function: Compute error probabilities assuming normal distribution ## Arg 1: Number of non-zero representational elements in underlying form ## Arg 2: Number of non-zero representational elements in target surface representation that are distinct from error ## Arg 3: Number of non-zero representational elements in error surface representation that are distinct from target ## Arg 4: Harmony advantage of target over error ## Arg 5: Standard deviation of randomly distributed noise ## Returns probability of error normErrProb.fnc = function (underlying, uniqueTarget, uniqueError, common, harmonyAdvantage, sdNoise) { if(uniqueTarget+common > 1){ if(common>1){ markNTarget = length(combn(uniqueTarget+common,2,simplify=F)) -length(combn(common,2,simplify=F)) }else markNTarget = length(combn(uniqueTarget+common,2,simplify=F)) }else markNTarget = 0 if(uniqueError+common > 1){ if(common>1){ markNError = length(combn(uniqueError+common,2,simplify=F)) -length(combn(common,2,simplify=F)) }else markNError = length(combn(uniqueError+common,2,simplify=F)) }else markNError = 0 faithNTarget = underlying * uniqueTarget faithNError = underlying * uniqueError return ( pnorm (-harmonyAdvantage,0,sqrt((faithNTarget+4*markNTarget+faithNError+4*markNError)*(sdNoise^2)) ) ) }