~ubuntu-branches/ubuntu/trusty/scilab/trusty

« back to all changes in this revision

Viewing changes to modules/statistics/help/en_US/samplef.xml

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-02 11:02:49 UTC
  • mfrom: (1.4.6)
  • Revision ID: package-import@ubuntu.com-20120802110249-0v5953emkp25geuz
Tags: 5.4.0-beta-2-1~exp1
* New upstream release
* Remove libscilab-java (remove upstream). Use libscilab2-java instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version="1.0" encoding="UTF-8"?>
2
 
<!--
3
 
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4
 
 * Copyright (C) 2000 - INRIA - Carlos Klimann
5
 
 * 
6
 
 * This file must be used under the terms of the CeCILL.
7
 
 * This source file is licensed as described in the file COPYING, which
8
 
 * you should have received as part of this distribution.  The terms
9
 
 * are also available at    
10
 
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11
 
 *
12
 
 -->
13
 
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="samplef">
14
 
  <info>
15
 
    <pubdate>$LastChangedDate$</pubdate>
16
 
  </info>
17
 
  <refnamediv>
18
 
    <refname>samplef</refname>
19
 
    <refpurpose>  sample with replacement from a population
20
 
      and frequences of his values.
21
 
    </refpurpose>
22
 
  </refnamediv>
23
 
  <refsynopsisdiv>
24
 
    <title>Calling Sequence</title>
25
 
    <synopsis>s = samplef(n,X,f,orient)</synopsis>
26
 
  </refsynopsisdiv>
27
 
  <refsection>
28
 
    <title>Arguments</title>
29
 
    <variablelist>
30
 
      <varlistentry>
31
 
        <term>n</term>
32
 
        <listitem>
33
 
          <para>positive integer (size of sample)</para>
34
 
        </listitem>
35
 
      </varlistentry>
36
 
      <varlistentry>
37
 
        <term>X</term>
38
 
        <listitem>
39
 
          <para>matrix. Samples will be extracted from this matrix</para>
40
 
        </listitem>
41
 
      </varlistentry>
42
 
      <varlistentry>
43
 
        <term>f</term>
44
 
        <listitem>
45
 
          <para>positive integer matrix with same type than X. It indicates frequences
46
 
            of corresponding values of X.
47
 
          </para>
48
 
        </listitem>
49
 
      </varlistentry>
50
 
      <varlistentry>
51
 
        <term>orient</term>
52
 
        <listitem>
53
 
          <para>Optional parameter. Admissible values are 1, 2, 'r' or 'c'</para>
54
 
        </listitem>
55
 
      </varlistentry>
56
 
      <varlistentry>
57
 
        <term>s</term>
58
 
        <listitem>
59
 
          <para> vector or matrix containing sample</para>
60
 
        </listitem>
61
 
      </varlistentry>
62
 
    </variablelist>
63
 
  </refsection>
64
 
  <refsection>
65
 
    <title>Description</title>
66
 
    <para>
67
 
      This function gives s, a  vector of length n.  It contains
68
 
      a  sample of  n  extractions, with  replacement, from  the
69
 
      vector  (or  matrix)  X,  each element  counted  with  the
70
 
      frequence given by the corresponding value in vector f.
71
 
    </para>
72
 
    <para>
73
 
      s=samplef(n,X,f)   (or  s=samplef(n,X,f,'*'))   returns  a
74
 
      vector s whose values are a random sample of n values from
75
 
      X,   each  value   with  a   probability  to   be  sampled
76
 
      proportional  to the corresponding  value of  f, extracted
77
 
      with replacement, from X.  f must have same length than X.
78
 
    </para>
79
 
    <para>
80
 
      s=samplef(n,X,f,'r')           (or,          equivalently,
81
 
      s=samplef(n,X,f,1))    returns    a    matrix   of    type
82
 
      size(X,'r')xn.  It contains a random sample of n rows from
83
 
      X, each row with  a probability to be sampled proportional
84
 
      to   the  corresponding   value  of   f,   extracted  with
85
 
      replacement, from the  rows of X. The length  of f must be
86
 
      equal to the number of rows of X.
87
 
    </para>
88
 
    <para>
89
 
      s=samplef(n,X,f,'c')           (or,          equivalently,
90
 
      s=samplef(n,X,f,2))    returns    a    matrix   of    type
91
 
      nxsize(X,'c').  It  contains a random sample  of n columns
92
 
      from  X, each  column  with a  probability  to be  sampled
93
 
      proportional  to the corresponding  value of  f, extracted
94
 
      with replacement, from the columns  of X.  The length of f
95
 
      must be equal to the number of columns of X.
96
 
    </para>
97
 
  </refsection>
98
 
  <refsection>
99
 
    <title>Examples</title>
100
 
    <programlisting role="example"><![CDATA[ 
101
 
a=[3 7 9;22 4 2]
102
 
f1=[10 1 1 1 1 1]
103
 
f2=[1 ; 15]
104
 
f3=[10 1 1]
105
 
s=samplef(15,a,f1)
106
 
s=samplef(15,a,f2,'r')
107
 
s=samplef(15,a,f3,'c')
108
 
 ]]></programlisting>
109
 
  </refsection>
110
 
  <refsection role="see also">
111
 
    <title>See Also</title>
112
 
    <simplelist type="inline">
113
 
      <member>
114
 
        <link linkend="sample">sample</link>
115
 
      </member>
116
 
      <member>
117
 
        <link linkend="samwr">samwr</link>
118
 
      </member>
119
 
    </simplelist>
120
 
  </refsection>
121
 
</refentry>