Open main menu
Home
Random
Nearby
Log in
Settings
About Kancolle Wiki
Disclaimers
Kancolle Wiki
Search
Changes
← Older edit
Newer edit →
Module:Stat
(view source)
Revision as of 18:58, 9 November 2017
57 bytes added
,
7 years ago
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
7,064
edits