Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1308974
  • 博文数量: 268
  • 博客积分: 10698
  • 博客等级: 上将
  • 技术积分: 2867
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-14 22:21
文章分类

全部博文(268)

文章存档

2012年(19)

2011年(13)

2010年(29)

2009年(26)

2008年(99)

2007年(82)

我的朋友

分类: Python/Ruby

2011-08-26 21:35:31

Perl 的统计学模块名字叫:Statistics::Descriptive
下载:
$ emerge dev-perl/Statistics-Descriptive
有一个这方面的pdf教程,名叫: Journal of Statistical Software,作者:Giovanni Baiocchi,杜伦大学
程序示例,计算方差,网上抄的:
  1. #!/usr/bin/perl

  2. use strict;
  3. use Statistics::Descriptive;

  4. open(FH, "$ARGV[0]") or die "No file specified\n";
  5. my @temp=<FH>;
  6. close FH;

  7. my $stat = Statistics::Descriptive::Full->new();
  8. $stat->add_data(\@temp);
  9. my $mean = $stat->mean();
  10. my $variance = $stat->variance();
  11. my $num = $stat->count();

  12. print "Number of Values = $num\n",
  13.       "Mean = $mean\n",
  14.       "Variance = $variance\n";

阅读(3030) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~