File: distrMode.Rd

package info (click to toggle)
r-cran-modeest 2.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 280 kB
  • sloc: makefile: 2
file content (402 lines) | stat: -rw-r--r-- 12,290 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/distrMode.R
\name{distrMode}
\alias{distrMode}
\alias{betaMode}
\alias{cauchyMode}
\alias{chisqMode}
\alias{dagumMode}
\alias{expMode}
\alias{fMode}
\alias{fiskMode}
\alias{frechetMode}
\alias{gammaMode}
\alias{normMode}
\alias{gevMode}
\alias{ghMode}
\alias{ghtMode}
\alias{gldMode}
\alias{gompertzMode}
\alias{gpdMode}
\alias{gumbelMode}
\alias{hypMode}
\alias{koenkerMode}
\alias{kumarMode}
\alias{laplaceMode}
\alias{logisMode}
\alias{lnormMode}
\alias{lomaxMode}
\alias{maxwellMode}
\alias{mvnormMode}
\alias{nakaMode}
\alias{nigMode}
\alias{paralogisticMode}
\alias{paretoMode}
\alias{rayleighMode}
\alias{stableMode}
\alias{stableMode2}
\alias{tMode}
\alias{unifMode}
\alias{weibullMode}
\alias{yulesMode}
\alias{bernMode}
\alias{binomMode}
\alias{geomMode}
\alias{hyperMode}
\alias{nbinomMode}
\alias{poisMode}
\title{Mode of some continuous and discrete distributions}
\usage{
distrMode(x, ...)

betaMode(shape1, shape2, ncp = 0)

cauchyMode(location = 0, ...)

chisqMode(df, ncp = 0)

dagumMode(scale = 1, shape1.a, shape2.p)

expMode(...)

fMode(df1, df2)

fiskMode(scale = 1, shape1.a)

frechetMode(location = 0, scale = 1, shape = 1, ...)

gammaMode(shape, rate = 1, scale = 1/rate)

normMode(mean = 0, ...)

gevMode(location = 0, scale = 1, shape = 0, ...)

ghMode(alpha = 1, beta = 0, delta = 1, mu = 0, lambda = -1/2)

ghtMode(beta = 0.1, delta = 1, mu = 0, nu = 10)

gldMode(lambda1 = 0, lambda2 = -1, lambda3 = -1/8, lambda4 = -1/8)

gompertzMode(scale = 1, shape)

gpdMode(location = 0, scale = 1, shape = 0)

gumbelMode(location = 0, ...)

hypMode(alpha = 1, beta = 0, delta = 1, mu = 0, pm = c(1, 2, 3, 4))

koenkerMode(location = 0, ...)

kumarMode(shape1, shape2)

laplaceMode(location = 0, ...)

logisMode(location = 0, ...)

lnormMode(meanlog = 0, sdlog = 1)

lomaxMode(...)

maxwellMode(rate)

mvnormMode(mean, ...)

nakaMode(scale = 1, shape)

nigMode(alpha = 1, beta = 0, delta = 1, mu = 0)

paralogisticMode(scale = 1, shape1.a)

paretoMode(scale = 1, ...)

rayleighMode(scale = 1)

stableMode(alpha, beta, gamma = 1, delta = 0, pm = 0, ...)

stableMode2(loc, disp, skew, tail)

tMode(df, ncp)

unifMode(min = 0, max = 1)

weibullMode(shape, scale = 1)

yulesMode(...)

bernMode(prob)

binomMode(size, prob)

geomMode(...)

hyperMode(m, n, k, ...)

nbinomMode(size, prob, mu)

poisMode(lambda)
}
\arguments{
\item{x}{character. The name of the distribution to consider.}

\item{...}{Additional parameters.}

\item{shape1}{non-negative parameters of the Beta distribution.}

\item{shape2}{non-negative parameters of the Beta distribution.}

\item{ncp}{non-centrality parameter.}

\item{location}{location and scale parameters.}

\item{df}{degrees of freedom (non-negative, but can be non-integer).}

\item{scale}{location and scale parameters.}

\item{shape1.a}{shape parameters.}

\item{shape2.p}{shape parameters.}

\item{df1}{degrees of freedom.  \code{Inf} is allowed.}

\item{df2}{degrees of freedom.  \code{Inf} is allowed.}

\item{shape}{the location parameter \eqn{a},
  scale parameter \eqn{b}, and shape parameter \eqn{s}.}

\item{rate}{vector of rates.}

\item{mean}{vector of means.}

\item{alpha}{
        shape parameter \code{alpha};
        skewness parameter \code{beta}, \code{abs(beta)} is in the 
        range (0, alpha);
        scale parameter \code{delta}, \code{delta} must be zero or 
        positive; 
        location parameter \code{mu}, by default 0.
        These is the meaning of the parameters in the first 
        parameterization \code{pm=1} which is the default 
        parameterization selection.
        In the second parameterization, \code{pm=2} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{zeta} and \code{rho}.
        In the third parameterization, \code{pm=3} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{xi} and \code{chi}.
        In the fourth parameterization, \code{pm=4} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{a.bar} and \code{b.bar}.
        }

\item{beta}{
        shape parameter \code{alpha};
        skewness parameter \code{beta}, \code{abs(beta)} is in the 
        range (0, alpha);
        scale parameter \code{delta}, \code{delta} must be zero or 
        positive; 
        location parameter \code{mu}, by default 0.
        These is the meaning of the parameters in the first 
        parameterization \code{pm=1} which is the default 
        parameterization selection.
        In the second parameterization, \code{pm=2} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{zeta} and \code{rho}.
        In the third parameterization, \code{pm=3} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{xi} and \code{chi}.
        In the fourth parameterization, \code{pm=4} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{a.bar} and \code{b.bar}.
        }

\item{delta}{
        shape parameter \code{alpha};
        skewness parameter \code{beta}, \code{abs(beta)} is in the 
        range (0, alpha);
        scale parameter \code{delta}, \code{delta} must be zero or 
        positive; 
        location parameter \code{mu}, by default 0.
        These is the meaning of the parameters in the first 
        parameterization \code{pm=1} which is the default 
        parameterization selection.
        In the second parameterization, \code{pm=2} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{zeta} and \code{rho}.
        In the third parameterization, \code{pm=3} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{xi} and \code{chi}.
        In the fourth parameterization, \code{pm=4} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{a.bar} and \code{b.bar}.
        }

\item{mu}{
        shape parameter \code{alpha};
        skewness parameter \code{beta}, \code{abs(beta)} is in the 
        range (0, alpha);
        scale parameter \code{delta}, \code{delta} must be zero or 
        positive; 
        location parameter \code{mu}, by default 0.
        These is the meaning of the parameters in the first 
        parameterization \code{pm=1} which is the default 
        parameterization selection.
        In the second parameterization, \code{pm=2} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{zeta} and \code{rho}.
        In the third parameterization, \code{pm=3} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{xi} and \code{chi}.
        In the fourth parameterization, \code{pm=4} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{a.bar} and \code{b.bar}.
        }

\item{lambda}{
        shape parameter \code{alpha};
        skewness parameter \code{beta}, \code{abs(beta)} is in the 
        range (0, alpha);
        scale parameter \code{delta}, \code{delta} must be zero or 
        positive; 
        location parameter \code{mu}, by default 0.
        These is the meaning of the parameters in the first 
        parameterization \code{pm=1} which is the default 
        parameterization selection.
        In the second parameterization, \code{pm=2} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{zeta} and \code{rho}.
        In the third parameterization, \code{pm=3} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{xi} and \code{chi}.
        In the fourth parameterization, \code{pm=4} \code{alpha}
        and \code{beta} take the meaning of the shape parameters
        (usually named) \code{a.bar} and \code{b.bar}.
        }

\item{nu}{
        a numeric value, the number of degrees of freedom.
        Note, \code{alpha} takes the limit of \code{abs(beta)}, 
        and \code{lambda=-nu/2}.
        }

\item{lambda1}{
    are numeric values where
    \code{lambda1} is the location parameter,
    \code{lambda2} is the location parameter,
    \code{lambda3} is the first shape parameter, and
    \code{lambda4} is the second shape parameter.
  }

\item{lambda2}{
    are numeric values where
    \code{lambda1} is the location parameter,
    \code{lambda2} is the location parameter,
    \code{lambda3} is the first shape parameter, and
    \code{lambda4} is the second shape parameter.
  }

\item{lambda3}{
    are numeric values where
    \code{lambda1} is the location parameter,
    \code{lambda2} is the location parameter,
    \code{lambda3} is the first shape parameter, and
    \code{lambda4} is the second shape parameter.
  }

\item{lambda4}{
    are numeric values where
    \code{lambda1} is the location parameter,
    \code{lambda2} is the location parameter,
    \code{lambda3} is the first shape parameter, and
    \code{lambda4} is the second shape parameter.
  }

\item{pm}{
        an integer value between \code{1} and \code{4} for the 
        selection of the parameterization. The default takes the
        first parameterization.       
        }

\item{meanlog}{mean and standard deviation of the distribution
    on the log scale with default values of \code{0} and \code{1} respectively.}

\item{sdlog}{mean and standard deviation of the distribution
    on the log scale with default values of \code{0} and \code{1} respectively.}

\item{gamma}{
    value of the index parameter \code{alpha} in the interval= \eqn{(0, 2]};
    skewness parameter \code{beta}, in the range \eqn{[-1, 1]};
    scale parameter \code{gamma}; and location (or \sQuote{shift})
    parameter \code{delta}.
  }

\item{loc}{vector of (real) location parameters.}

\item{disp}{vector of (positive) dispersion parameters.}

\item{skew}{vector of skewness parameters (in [-1,1]).}

\item{tail}{vector of parameters (in [1,2]) related to the tail thickness.}

\item{min}{lower and upper limits of the distribution.  Must be finite.}

\item{max}{lower and upper limits of the distribution.  Must be finite.}

\item{prob}{Probability of success on each trial.}

\item{size}{number of trials (zero or more).}

\item{m}{the number of white balls in the urn.}

\item{n}{number of observations. If \code{length(n) > 1}, the length
    is taken to be the number required.}

\item{k}{the number of balls drawn from the urn.}
}
\value{
A numeric value is returned, the (true) mode of the distribution.
}
\description{
These functions return the mode of the main probability 
distributions implemented in R.
}
\note{
Some functions like \code{normMode} or \code{cauchyMode}, which relate 
to symmetric distributions, are trivial, but are implemented for the sake of 
exhaustivity.
}
\examples{
## Beta distribution
curve(dbeta(x, shape1 = 2, shape2 = 3.1), 
      xlim = c(0,1), ylab = "Beta density")
M <- betaMode(shape1 = 2, shape2 = 3.1)
abline(v = M, col = 2)
mlv("beta", shape1 = 2, shape2 = 3.1)

## Lognormal distribution
curve(stats::dlnorm(x, meanlog = 3, sdlog = 1.1), 
      xlim = c(0, 10), ylab = "Lognormal density")
M <- lnormMode(meanlog = 3, sdlog = 1.1)
abline(v = M, col = 2)
mlv("lnorm", meanlog = 3, sdlog = 1.1)

curve(VGAM::dpareto(x, scale = 1, shape = 1), xlim = c(0, 10))
abline(v = paretoMode(scale = 1), col = 2)

## Poisson distribution
poisMode(lambda = 6)
poisMode(lambda = 6.1)
mlv("poisson", lambda = 6.1)

}
\seealso{
\code{\link[modeest]{mlv}} for the estimation of the mode; 
the documentation of the related distributions 
\code{\link[stats]{Beta}}, \code{\link[stats]{GammaDist}}, etc.
}
\author{
\code{\link[fBasics]{ghMode}} and \code{\link[fBasics]{ghtMode}} are from 
package \pkg{fBasics}; 
\code{\link[fBasics]{hypMode}} was written by David Scott; 
\code{\link[fBasics]{gldMode}}, \code{\link[fBasics]{nigMode}} and 
\code{\link[stabledist]{stableMode}} were written by Diethelm Wuertz.
}