## normSD function: Compute standard deviation of normally distributed noise ## 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: Error rate ## Returns standard deviation of noise function normErrSD.fnc = function (underlying, uniqueTarget, uniqueError, common, harmonyAdvantage, errRate) { 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 w = qnorm (errRate) return (sqrt( (-harmonyAdvantage / (w*sqrt ( (faithNTarget+4*markNTarget+faithNError+4*markNError))))^2)) }