# Re: [ferret_users] Statistics / student-t distribution

```Hi all,
```
Ferret does include an external function, student_t_cutoff, which may provide some of what you're looking for:
```
yes?  sh func student*
STUDENT_T_CUTOFF(P,nf)
Return student-t cutoff
P: Confidence Limit
nf: nf (Number in sample)

```
Other statistics capabilities would be straitforward to write as external functions. Our current development, PyFerret, builds Ferret as a Python module. This will in effect make mathematical and statistical functions from Python libraries available as Ferret functions.
```
Ansley

On 3/21/2012 8:31 AM, Paulo B. Oliveira wrote:
```
```One way is to use a statistical package to do the job. I ended up
learning some R (http://www.r-project.org/) basics (the choice was
driven by its popularity among my colleagues).
When combined with 'littler' ( http://code.google.com/p/littler/ ) you
can use spawn in ferret to get the simple statistics.

For example, to get student-t 0.95 quantile with df-degrees of freedmon
from ferret:
yes? def sym df 100
yes? let qt95 = `spawn("r -e 'cat(qt((0.95),df=(\$df)))'")`
!->  DEFINE VARIABLE qt95 = 1.66023

If a long data series has to be passed on to R, it will be necessary to
write an R script, eventually using the RNetCDF
( http://cran.r-project.org/web/packages/RNetCDF/index.html )
ncdf ( http://cran.r-project.org/web/packages/ncdf/index.html ) or
ncdf4 (http://cran.r-project.org/web/packages/ncdf4/index.html )
packages.

Regards,

Paulo
----------------------------------------------------
On Mon, 2012-03-19 at 09:02 +0100, Hein Zelle wrote:
```
```Neil Swart wrote:

```
```I wondering how other Ferreters compute their statistics, and if
anyone has a TINV script or similar already written?
```
```I have not done this yet, but for an upcoming job I'll need to
determine similar bounds (quantiles) from an ensemble distribution.
I can do this based on the std deviation, assuming a gaussian
distribution, but that doesn't always hold.

I'll be very interested to hear if it's possible to do this using
external functions or with different tricks.

Kind regards,
Hein Zelle

```
```
```
```
```