• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
no edit summary
Line 10: Line 10:  
         return string.format("%." .. f .. "f", 100 * (1 - (1 - a / b) ^ n))
 
         return string.format("%." .. f .. "f", 100 * (1 - (1 - a / b) ^ n))
 
     else
 
     else
         return "undefined"
+
         return "nil"
 
     end
 
     end
 
end
 
end
Line 21: Line 21:  
         return string.format("%.f", math.log(1 - q / 100) / math.log(1 - a / b))
 
         return string.format("%.f", math.log(1 - q / 100) / math.log(1 - a / b))
 
     else
 
     else
         return "undefined"
+
         return "nil"
 
     end
 
     end
 +
end
 +
 +
function Stat.error_(a, b, pc)
 +
    pc = pc or 1.96
 +
    local p = a / b
 +
    local se = math.sqrt(p * (1 - p) / b)
 +
    return 100 * (pc * se + 0.5 / b)
 
end
 
end
   Line 31: Line 38:  
     local pc = frame.args["percentile"] and tonumber(frame.args["percentile"]) or 1.96
 
     local pc = frame.args["percentile"] and tonumber(frame.args["percentile"]) or 1.96
 
     if a and b and f and pc then
 
     if a and b and f and pc then
        local p = a / b
+
         return string.format("%." .. f .. "f", Stat.error_(a, b, pc))
        local se = math.sqrt(p * (1 - p) / b)
  −
         return string.format("%." .. f .. "f", 100 * (pc * se + 0.5 / b))
   
     else
 
     else
         return "undefined"
+
         return "nil"
 
     end
 
     end
 
end
 
end
Line 46: Line 51:  
         return string.format("%.f", ( 1 / ( ( 1 - ( a / b ) ) ^ ( sh ) ) ) )
 
         return string.format("%.f", ( 1 / ( ( 1 - ( a / b ) ) ^ ( sh ) ) ) )
 
     else
 
     else
         return "undefined"
+
         return "nil"
 
     end
 
     end
 
end
 
end
 
return Stat
 
return Stat
cssedit, gkautomate
6,941

edits

Navigation menu