1
<?xml version="1.0" encoding="UTF-8"?>
3
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4
* Copyright (C) 2000 - INRIA - Carlos Klimann
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
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">
15
<pubdate>$LastChangedDate$</pubdate>
18
<refname>samplef</refname>
19
<refpurpose> sample with replacement from a population
20
and frequences of his values.
24
<title>Calling Sequence</title>
25
<synopsis>s = samplef(n,X,f,orient)</synopsis>
28
<title>Arguments</title>
33
<para>positive integer (size of sample)</para>
39
<para>matrix. Samples will be extracted from this matrix</para>
45
<para>positive integer matrix with same type than X. It indicates frequences
46
of corresponding values of X.
53
<para>Optional parameter. Admissible values are 1, 2, 'r' or 'c'</para>
59
<para> vector or matrix containing sample</para>
65
<title>Description</title>
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.
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.
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.
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.
99
<title>Examples</title>
100
<programlisting role="example"><![CDATA[
106
s=samplef(15,a,f2,'r')
107
s=samplef(15,a,f3,'c')
110
<refsection role="see also">
111
<title>See Also</title>
112
<simplelist type="inline">
114
<link linkend="sample">sample</link>
117
<link linkend="samwr">samwr</link>