Tool for generating random variables that follows given frequency distibution using linear regressions in given intervals.
GitHub: https://github.com/YujiSODE/regLines
Wiki: https://github.com/YujiSODE/regLines/wiki
Copyright (c) 2018 Yuji SODE <yuji.sode@gmail.com>
This software is released under the MIT License.
See LICENSE or http://opensource.org/licenses/mit-license.php
::regLines::reglines X Y ?name?;
it outputs tcl script file that defines additional math functions (lines(x)
, linesPDF(x)
and linesVar()
) and returns generated filename
$X
and$Y
: numerical lists for x-axis and y-axis$name
: a text used in order to generate filename of output file, and numbers are default value.
generated filename has a form of"${name}_regL.tcl"
Two expressions are available for linear regressions.
-
dx
data ranges are defined asv0 v1 ... vn
wherev0
andvn
are the maximum and minimum values.
vi=v(i-1)+dx
and0<i<n
. -
x0 x1 ... xn
data ranges are defined asx0 x1 ... xn
.
It requires Tcl/Tk 8.6+.
regLines.tcl
lines(x)
: function that returns estimated sample distributionlinesPDF(x)
: function that returns a value of probability density function estimated from the sample distributionlinesVar()
: function that returns a random variable following PDF$x
: a numerical value
- linesvar_toTcl.tcl (Yuji SODE, 2018): the MIT License
- linesvar_toJavaScript.tcl (Yuji SODE, 2018): the MIT License
- lSum/lSum.tcl (Yuji SODE, 2018): https://gist.github.com/YujiSODE/1f9a4e2729212691972b196a76ba9bd0