Commit e0d14c46 authored by Holger Brandl's avatar Holger Brandl

updated notes

parent 2ce12bb1
......@@ -99,7 +99,6 @@ Confidence around proportions
Formula:
> If the samples size n and population proportion p satisfy the condition that np ≥ 5 and n(1 − p) ≥ 5, than the end points of the interval estimate at (1 − α) confidence level is defined in terms of the sample proportion as follows.
![](.example_images/prop_ci.png)
CI math is detailed out under http://www.statisticslectures.com/topics/ciproportions/
......
......@@ -31,7 +31,6 @@ prop.test(x=c(19,15), n=c(34,34), correct=FALSE)
## also works for single proportion
#prop.test(x=c(19), n=c(34), correct=FALSE)
#prop.test(x=c(19,15,20), n=c(34,34,34), correct=FALSE)
```
Also see <http://stat.ethz.ch/R-manual/R-devel/library/stats/html/prop.test.html>
......
import java.io.File
val kotlin.Boolean.int
get() = if (this) 1 else 0
fun main(args: Array<String>) {
//val mdFile = File(args[0])
val mdFile = File("/Users/brandl/Dropbox/projects/datautils/R/rnblight/example.md")
//
//var chunkCounter = 0
//var isInChunk = false
//val filtMd = mdFile.readLines().groupBy{ line->
//
// if(line.startsWith("```")) {
// chunkCounter++
// isInChunk = !isInChunk
// }
//
// chunkCounter
//}.filterNot { (_, group) ->
// group.filterNot{it.startsWith("```")}.all { it.startsWith("## ") }
//}
//
//File("result.md").writeText( filtMd.flatMap { it.value }.joinToString("\n"))
fun <T : Number> List<T>.cumSum(removeNA: Boolean = false): Iterable<Double> {
return drop(1).fold(listOf(first().toDouble()), { list, curVal -> list + (list.last().toDouble() + curVal.toDouble()) })
}
val lines = mdFile.readLines().take(50)
lines.map { it.startsWith("```").int }
lines.map { it.startsWith("```").int }.windowed(2) { (a, b) -> if (a > b) a else b }
lines.map { it.startsWith("```").int }.cumSum().zipWithNext { a, b -> a }
}
import java.io.File
//val mdFile = File(args[0])
val mdFile = File("/Users/brandl/Dropbox/projects/datautils/R/rnblight/example.md")
//
//var chunkCounter = 0
//var isInChunk = false
//val filtMd = mdFile.readLines().groupBy{ line->
//
// if(line.startsWith("```")) {
// chunkCounter++
// isInChunk = !isInChunk
// }
//
// chunkCounter
//}.filterNot { (_, group) ->
// group.filterNot{it.startsWith("```")}.all { it.startsWith("## ") }
//}
//
//File("result.md").writeText( filtMd.flatMap { it.value }.joinToString("\n"))
val Boolean.int
get() = if (this) 1 else 0
fun <T : Number> List<T>.cumSum(removeNA: Boolean = false): Iterable<Double> {
return drop(1).fold(listOf(first().toDouble()), { list, curVal -> list + (list.last().toDouble() + curVal.toDouble()) })
}
val lines = mdFile.readLines().take(50)
lines.map { it.startsWith("```").int }
lines.map { it.startsWith("```").int }.windowed(2){ (a,b) -> if(a>b) a else b}
lines.map { it.startsWith("```").int }.cumSum().zipWithNext{ a,b -> a}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment