t_stats 2.0.0

t_stats #

Build status

This package provides a single class which computes things like standard deviation and margin of error. It should be useful whenever you have a list of numerical values and you want to:

  • show simple stats like mean, min and max, or
  • find out the confidence interval (at the standard 95% confidence level), or
  • confirm relationship to other measurements.

Library usage #

A simple usage example:

var myStat = new Statistic.from(myMeasurements, name: "My scores");
// Prints the most basic stats.

var otherStat = new Statistic.from(otherMeasurements);
// Prints true only if stats are different with statistical significance.

Executable usage #

You can install the simple binary by running the following in the command line:

pub global activate t_stats

Now you can use t_stats as a command line tool. Assuming there's a numbers.txt file that contains a line-delimited list of numbers, you can run:

$ t_stats --pretty < numbers.txt
    2.11  ±   2.48 MoE /   3.22 SD

This takes full advantage of POSIX pipes, so you can have things like:

$ <some_complicated_unix_command> | t_stats --pretty
    9.88  ±  12.21 MoE /  23.75 SD

If you don't provide the --pretty argument, the tool will print out the output of Statistic.toTSV() (less human-readable, but much more useful for comparing multiple sets of measurements).

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

2.0.0 #

  • Upgrade to Dart 2
  • Use BigInt (found in dart:core) instead of package:bignum. This affects return values as well (factorial) so we're bumping major semver of this package to 2.0.

1.1.2 #

  • Upgrade to latest
  • Make the dependency to bignum a runtime dependency (instead of a dev dependency)

0.0.1 #

  • Initial version, created by Stagehand


// Copyright (c) 2016, Filip Hracek. All rights reserved. Use of this source
// code is governed by a BSD-style license that can be found in the LICENSE
// file.

import 'dart:math';

import 'package:t_stats/t_stats.dart';

void main() {
  final stats =
      new Statistic.from([1, 1, 1, 10, 1, 5, 1, 100], name: "My scores");

  final stats2 =
      new Statistic.from([24, 14, 20, 24, 21, 21, 19, 29], name: "Your scores");

  final stats3 =
      new Statistic.from(new Iterable.generate(2000, (n) => n).toList());

  final random = new Random();
  final stats4 = new Statistic.from(
      new Iterable.generate(2000, (_) => random.nextInt(100)).toList());


Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate t_stats

2. Use it

The package has the following executables:

$ t_stats

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  t_stats: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:t_stats/t_stats.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/src/median_confidence.dart. (-25 points)

Analysis of lib/src/median_confidence.dart reported 97 hints, including:

line 5 col 46: Avoid const keyword.

line 6 col 6: Avoid const keyword.

line 7 col 6: Avoid const keyword.

line 8 col 6: Avoid const keyword.

line 9 col 6: Avoid const keyword.

Fix lib/t_stats.dart. (-2.96 points)

Analysis of lib/t_stats.dart reported 6 hints, including:

line 62 col 33: Use = to separate a named parameter from its default value.

line 73 col 31: Unnecessary new keyword.

line 75 col 37: Unnecessary new keyword.

line 79 col 13: Unnecessary new keyword.

line 82 col 13: Unnecessary new keyword.

Fix lib/src/t_distribution.dart. (-2.48 points)

Analysis of lib/src/t_distribution.dart reported 5 hints:

line 7 col 30: Avoid const keyword.

line 107 col 5: DO use curly braces for all flow control structures.

line 109 col 5: DO use curly braces for all flow control structures.

line 111 col 5: DO use curly braces for all flow control structures.

line 113 col 5: DO use curly braces for all flow control structures.

Fix lib/src/factorial.dart. (-1.49 points)

Analysis of lib/src/factorial.dart reported 3 hints:

line 9 col 11: Unnecessary new keyword.

line 21 col 14: Unnecessary new keyword.

line 24 col 14: Unnecessary new keyword.

Fix bin/t_stats.dart. (-1 points)

Analysis of bin/t_stats.dart reported 2 hints:

line 9 col 24: Unnecessary new keyword.

line 45 col 17: Unnecessary new keyword.

Maintenance suggestions

Package is getting outdated. (-55.89 points)

The package was last published 81 weeks ago.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.23.0 <3.0.0
quiver ^2.0.0 2.1.2+1
Transitive dependencies
matcher 0.12.6
meta 1.1.8
path 1.6.4
stack_trace 1.9.3
Dev dependencies
test ^1.3.0