Skip to content
This repository has been archived by the owner on Jun 3, 2018. It is now read-only.

Commit

Permalink
Update draw2Sample_README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
YujiSODE committed Mar 16, 2017
1 parent 723629d commit 0d90f28
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions draw2Sample_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ https://github.com/YujiSODE/draw2Sample
>See LICENSE or http://opensource.org/licenses/mit-license.php
______

##Concept
## Concept
![Concept of graphical sampling:draw2Sample_Fig.png](./draw2Sample_Fig.png)
__Figure 1. Concept of graphical sampling.__ _f_ (_x_) is a graph drawn on graphical data (_W_ x _H_ px).

Expand All @@ -19,16 +19,16 @@ and
RGBA color value in a pixel is available in order to recognize the shape of the graph.
The alpha value is used in this program; a pixel where alpha > 0 is regarded as graph.

##Script
## Script
* draw2Sample.js
* \[v1.2+\] pValue.js

##How to generating values following a given distribution
## How to generating values following a given distribution
1. __"Sample (_Sp_)":__ ["Rnd"](#output-data) in the result output of "draw2Sample.js"
2. __Generating target values;__ the target values are obtained with bootstrap Method (Efron,1979) via _Sp_.
3. __\(Optional \[v1.2+\]\) Estimating _p_-value;__ _p_-value is estimated with "pValue.js" via _Sp_.

##How to use
## How to use
* call "draw2Sample()" in a html file with img/canvas tag.
* \(Optional \[v1.2+\]\) call "_pValue()" of "pValue.js", in order to estimate _p_-value; (see [__Estimating _p_-value__](#v12-estimating-p-value) for details of prameters).

Expand All @@ -43,7 +43,7 @@ The alpha value is used in this program; a pixel where alpha > 0 is regarded as
3. __Sampling__
The sampling from the given graph (2.) is run with __"Run sampling" button__, and the result output is shown in __"Result"__.

####_Inputs and buttons_
#### _Inputs and buttons_
* __"Target width":__ the target sampling area, expressed with left side x coordinate (x0) and width (w), shown in red.
* __"Sampling interval";__ it sets how many times the given graph (2.) is sampled in a given target area, starting with x0.
* __"Range of values":__ the true x-coordinate values in the target sampling area, expressed with left side (v0) and right side (v).
Expand All @@ -58,14 +58,14 @@ The alpha value is used in this program; a pixel where alpha > 0 is regarded as
* __"Email address":__ email address used outputting __"Result"__ as email format.
* __"Output as email" button;__ it saves the __"Result"__ as email to given address.

####_Output data_
#### _Output data_
* __dataLog:__ csv formatted values expressed as _n_@_y_ for a _n_-th sampling result: _y_ with top left corner as origin.
* __*x*@*f(x)*:__ csv formatted values expressed as _x_@_f_ (_x_) for a value of _f_ (_x_) at _x_ with bottom left as origin.
* __Rnd:__ csv formatted values estimated as results of a sampling.

______
##\[v1.2+\] Estimating _p_-value
####__"pValue.js"__
## \[v1.2+\] Estimating _p_-value
#### __"pValue.js"__
* Probability estimator with given numerical data and bootstrap Method (Efron,1979) on Firefox.
`_pValue(data,x,sampleSize,simulation)`
`/*`
Expand All @@ -79,26 +79,26 @@ ______
_p_-value is estimated as probability on v-axis: _P_(`x`) = _P_(_v_ >= `x`).
The estimation is based on resampled data with size (`sampleSize`) for n-time (`simulation`) simulations.

####Examples
#### Examples
Script 1: `_pValue('1,2');` the result: `{"p":0.504,"x":1.75,"sampleSize":100,"simulation":10}`
Script 2: `_pValue('1,2,3');` the result: `{"p":0.323,"x":2.5,"sampleSize":100,"simulation":10}`
Script 3: `_pValue('1,2,3',1.1);` the result: `{"p":0.676,"x":1.1,"sampleSize":100,"simulation":10}`
Script 4: `_pValue('1,2,3',2,10,1);` the result: `{"p":0.6,"x":2,"sampleSize":10,"simulation":1}`

______
##Example with the standard normal distribution
###Script used for drawing graph
## Example with the standard normal distribution
### Script used for drawing graph
* stdNormDist100pt.js

###Sampling parameters
### Sampling parameters
`/*Fri_Sep_09_2016_17:01:16_GMT+0900_(JST),Sampling interval:20,Size: W x H = 400 x 400 px*/`

![Sampling example with the standard normal distribution by script:stdNormDist_scriptOutputAll.jpg](./stdNormDist_scriptOutputAll.jpg)
__Figure 2. Sampling example with the standard normal distribution by script.__ Blue and red lines show a graph
of the standard normal distribution by script and a recognized distribution respectively. Vertical lines show where
sampled from blue graph.

###1-sample t-test
### 1-sample t-test
The sampled size by "draw2Sample.js": `<Sample size:2527>`

1. `[Resampled size:100;Given mean:0;Simulation:100times;Significance level:0.025]`
Expand All @@ -108,7 +108,7 @@ The sampled size by "draw2Sample.js": `<Sample size:2527>`
3. `[Resampled size:20;Given mean:0;Simulation:10000times;Significance level:0.025]`
Result: `Rejection rate:0.0146`

###_p_-value estimation
### _p_-value estimation
The sampled size by "draw2Sample.js": `<Sample size:2527>`
_p_-value was estimated as probability on v-axis: _P_(`x`) = _P_(_v_ >= `x`).

Expand All @@ -118,8 +118,8 @@ _p_-value was estimated as probability on v-axis: _P_(`x`) = _P_(_v_ >= `x`).
4. _P_(1.96): `{"p":0.028,"x":1.96,"sampleSize":100,"simulation":10}`

______
##Reference
## Reference
* Efron, B. 1979. Bootstrap Methods: Another Look at the Jackknife. Ann. Statist. vol. 7, no. 1, p. 1-26.

##\[1.2+\] Library list
## \[1.2+\] Library list
* bootstrapEst-2.1/bootstrapMdl.js (Yuji SODE,2016): the MIT License; https://github.com/YujiSODE/bootstrapEst

0 comments on commit 0d90f28

Please sign in to comment.