You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sample codes to fit the standard normal distribution
#normalDist_sample_regLines.tcl
#test codes for "regLines.tcl"
source ./regLines.tcl;
#normal distribution
proc F {X} {
set X [expr {double($X)}];
set pi 3.141592653589793;
return [expr {exp(-($X**2)/2)/sqrt(2*$pi)}];
};
set x {};set y {};
set I [format %.4f -4.0];
set dI [format %.4f 0.025];
while {$I<(4.0+$dI)} {
lappend x $I;
lappend y [format %.4f [F $I]];
set I [format %.4f [expr {$I+$dI}]];
};
#input data range: 1.0
::regLines::reglines $x $y "reglinesSample[clock seconds]";
#estimating p-value
set i 0;set j 0;
set v0 0.0;set v 0.0;
while {$i<10} {
while {$j<1000} {
set r [format %.4f [expr {linesVar()}]];
set v0 [expr {$r<1.96?$v0:$v0+1}];
incr j 1;
};
set v [format %.4f [expr {$v+($v0/1000)}]];
incr i 1;
};
set p [expr {$v/10}];
puts stdout "P(x>=1.96):$p";
No description provided.
The text was updated successfully, but these errors were encountered: