gitee.com/quant1x/num@v0.3.2/ztable_test.go (about)

     1  package num
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  func TestFindZScore(t *testing.T) {
     9  	fmt.Println(FindZScore(0.975))
    10  	fmt.Println(FindZScore(0.90))
    11  	fmt.Println(FindZScore(0.95))
    12  	fmt.Println(FindZScore(0.8621))
    13  	fmt.Println(FindZScore(0.5))
    14  	fmt.Println("------------------------------------------------------------")
    15  	fmt.Println(FindPercent(1.6448551507250881))
    16  	fmt.Println(FindPercent(1.6448))
    17  	fmt.Println(FindPercent(1.644))
    18  	fmt.Println(FindPercent(1.64))
    19  	fmt.Println("------------------------------------------------------------")
    20  	fmt.Println(FindPercent(1.959966356818851))
    21  	fmt.Println(FindPercent(1.9599))
    22  	fmt.Println(FindPercent(1.959))
    23  	fmt.Println(FindPercent(1.95))
    24  	fmt.Println(FindPercent(1.00))
    25  	fmt.Println("------------------------------------------------------------")
    26  }
    27  
    28  func TestPercentToZscore(t *testing.T) {
    29  	fmt.Println(ConfidenceIntervalToZscore(0.975))
    30  	fmt.Println(0.9000, ConfidenceIntervalToZscore(0.9000))
    31  	fmt.Println(ConfidenceIntervalToZscore(0.95))
    32  	fmt.Println(ConfidenceIntervalToZscore(0.85))
    33  	fmt.Println(ConfidenceIntervalToZscore(0.5000))
    34  	fmt.Println("------------------------------------------------------------")
    35  	fmt.Println(ZscoreToConfidenceInterval(1.6448551507250881))
    36  	fmt.Println(ZscoreToConfidenceInterval(1.6448))
    37  	fmt.Println(ZscoreToConfidenceInterval(1.644))
    38  	fmt.Println(ZscoreToConfidenceInterval(1.64))
    39  	fmt.Println("------------------------------------------------------------")
    40  	fmt.Println(ZscoreToConfidenceInterval(1.959966356818851))
    41  	fmt.Println(ZscoreToConfidenceInterval(1.9599))
    42  	fmt.Println(ZscoreToConfidenceInterval(1.959))
    43  	fmt.Println(ZscoreToConfidenceInterval(1.95))
    44  	fmt.Println(1.2816 == 1.2815524)
    45  	fmt.Println(1.2816, ZscoreToConfidenceInterval(1.2816))
    46  	fmt.Println(ZscoreToConfidenceInterval(1.09))
    47  	fmt.Println(ZscoreToConfidenceInterval(1.00))
    48  	fmt.Println(ZscoreToConfidenceInterval(0))
    49  	fmt.Println("------------------------------------------------------------")
    50  }