On Mon, 10 Sep 2007, Sigbert Klinke wrote:
> Hi,
>
> > sapply(formals("readBin"), mode)
> con what n sizesignedendian
> "name""name" "numeric" "logical" "logical""call"
>
> returns for the mode of size logical. But in the documentation is said
> that size s
On 9/10/2007 10:26 AM, Sigbert Klinke wrote:
> Hi,
>
> > sapply(formals("readBin"), mode)
> con what n sizesignedendian
>"name""name" "numeric" "logical" "logical""call"
>
> returns for the mode of size logical. But in the documentation is said
> that
Hi,
> sapply(formals("readBin"), mode)
con what n sizesignedendian
"name""name" "numeric" "logical" "logical""call"
returns for the mode of size logical. But in the documentation is said
that size should be integer. Does anyone know why the mode is log
That'll work, provided x is discrete or categorical.
Otherwise, the mode is not a well defined concept, as has been
discussed on this list several times. I just got 17 hits for a search
-> "R site search" -> "finding the mode of a distribution from data"
from "www.r-project.org". T
I was looking up how to find the mode of a data set in R and found some
solutions through your service. But, I needed a program to find the
mode or modes of a data set. Here is what I came up with:
names(sort(table(x)))[sort(table(x))==max(sort(table(x)))]
Michael Allen
Department of Mathemat
Yhe question of finding the mode of a dataset has been discussed previously in
the list not only for categorical data :
search "How can I get the mode" in the search engine of the list.
Hope this helps.
Romain.
Selon Uwe Ligges <[EMAIL PROTECTED]>:
> LONG Yu wrote:
>
> > Dear all,
> >
> > I wa
: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message -
From: "LONG Yu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 23, 2004 9:19 AM
Subject: [
LONG Yu wrote:
Dear all,
I want to find out the mode for a data set, anyone knows how to do it in
R?
I tried the codes below, but it seems too long:
tt<-table(data1) #get the frequency tables of data1
oo<-order(tt);#get the order of frequencies
len<-length(tt) #th
Dear all,
I want to find out the mode for a data set, anyone knows how to do it in
R?
I tried the codes below, but it seems too long:
tt<-table(data1) #get the frequency tables of data1
oo<-order(tt);#get the order of frequencies
len<-length(tt) #the length of th
> From: Thomas Lumley
>
> On Fri, 12 Nov 2004, Vito Ricci wrote:
> > Mode<-function(x){t<-table(x)
> > if (is.numeric(x)) as.numeric(names(t)[t == max(t)])
> > else (names(t)[t == max(t)])
> > }
> >
> > Any other improvement and suggestion will welcome.
> >
>
> which.max is design for finding the
-9140x23604
http://socserv.mcmaster.ca/jfox
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Lumley
> Sent: Friday, November 12, 2004 10:44 AM
> To: Vito Ricci
> Cc: [EMAIL PROTECTED]
> Subject:
On Fri, 12 Nov 2004, Vito Ricci wrote:
Mode<-function(x){t<-table(x)
if (is.numeric(x)) as.numeric(names(t)[t == max(t)])
else (names(t)[t == max(t)])
}
Any other improvement and suggestion will welcome.
which.max is design for finding the maximum, so
names(t)[which.max(t)]
-thomas
_
On Fri, 12 Nov 2004, Liaw, Andy wrote:
You might want to do a bit to handle NAs, as table() excludes them by
default. Also, you could write it a bit cleaner as:
Mode <- function(x) {
tab <- table(x)
m <- names(tab)[tab == max(tab)]
if (is.numeric(x)) m <- as.numeric(m)
m
}
(Generally I
You might want to do a bit to handle NAs, as table() excludes them by
default. Also, you could write it a bit cleaner as:
Mode <- function(x) {
tab <- table(x)
m <- names(tab)[tab == max(tab)]
if (is.numeric(x)) m <- as.numeric(m)
m
}
(Generally I try avoiding constructs like:
Thanking John for his suggestion I build this function
which get the mode of both categorial and discrete
data.
Mode<-function(x){t<-table(x)
if (is.numeric(x)) as.numeric(names(t)[t == max(t)])
else (names(t)[t == max(t)])
}
Any other improvement and suggestion will welcome.
Best
Vito
> s
[
Perhaps a time out might be helpful.
?which.max will produce the location (index) of the maximum of a numeric
vector, but Paolo doesn't want that. He wants the location of the most
frequent observation which would be the maximum of the probability density,
which he doesn't have.
It would be us
Sorry, typo:
On 13-Dec-03 Ted Harding wrote:
> Example of kernel density estimation:
>
> X<-c(rnorm(200),2+0.5*rnorm(300))
> hist(X,freq=FALSE,breaks=(-4)+0.2*(0:50))
> S<-density(X,from=(-4),to=5,bw=0.2)
> N<-length(S$y)
> V1<-S$y[1:(N-2)];V2<-S$y[2:(N-1)];V3<-S$y[3:N]
> ix<-1+which(
Douglas Bates wrote:
> "Christian Mora" <[EMAIL PROTECTED]> writes:
>>How can I get the mode (most frequent value) from a dataset
>>(continuos variables)? I can obtain it when the data is discrete
>>(by making a table and looking at the higher frequency) but I
>>don't know how obtain it from, for e
Apologies for pursuing this increasingly off-topic thread, but I've just
remembered that 'my' mode is not so hard to compute. Suppose a
one-dimensional data set is in general position (all gaps unequal), find
the smallest gap, then choose whichever endpoint has the closest neighbour.
That's the mod
On 11 Dec 2003, Douglas Bates wrote:
> "Christian Mora" <[EMAIL PROTECTED]> writes:
>
> > How can I get the mode (most frequent value) from a dataset (continuos
> > variables)? I can obtain it when the data is discrete (by making a table
> > and looking at the higher frequency) but I don't know h
Opps! This is what I should have written:
The mode of a data vector x might be defined as the limit of m_p as p
tends to zero from above and where m_p is the m minimizing
sum(abs(x - m)^p). I would not expect the mode so defined to be of much
use in data analysis, nor would it be easy to comput
The mode of a data vector x might be defined as the limit of m_p as p
tends to zero from above and where m_p is the m minimizing
sum(abs(x - m)). I would not expect the mode so defined to be of much
use in data analysis, nor would it be easy to compute.
Murray
Douglas Bates wrote:
"Christian
"Christian Mora" <[EMAIL PROTECTED]> writes:
> How can I get the mode (most frequent value) from a dataset (continuos
> variables)? I can obtain it when the data is discrete (by making a table
> and looking at the higher frequency) but I don't know how obtain it
> from, for example, a density plot
How can I get the mode (most frequent value) from a dataset (continuos
variables)? I can obtain it when the data is discrete (by making a table
and looking at the higher frequency) but I don't know how obtain it
from, for example, a density plot of the data. Does anyone know how to
do it? Thanks
CM
Dear Erin,
Assuming that by "data set" you mean a vector "v", then
sort(table(v))
will give you what you want.
On Mon, 23 Jun 2003, Erin Hodgess wrote:
> Date: Mon, 23 Jun 2003 10:50:47 -0500 (CDT)
> From: Erin Hodgess <[EMAIL PROTECTED]>
> To: [EMAIL PROTE
Erin Hodgess wrote:
Dear R People:
Is there a function to find the mode of a data set, please?
This is the mode as in the value(s) which occur most often.
Erin,
Will this work for you?
R> x <- rbinom(100, size = 20, prob = .2)
R> table.x <- table(x)
R> table.x[which.max(table.x)]
4
23
R>
Rega
On Monday 23 June 2003 17:50, Erin Hodgess wrote:
> Dear R People:
>
> Is there a function to find the mode of a data set, please?
>
> This is the mode as in the value(s) which occur most often.
>
x[rev(order(table(x)))[1]]
is this what you want?
regards
Adelchi Azzalini
--
Adelchi Azzalini
Dear R People:
Is there a function to find the mode of a data set, please?
This is the mode as in the value(s) which occur most often.
Thanks so much!
R for Windows, v 1.7.0
Sincerely,
Erin Hodgess
mailto: [EMAIL PROTECTED]
__
[EMAIL PROTECTED] mail
Patrik -
I interpret your question as "statistical mode" rather than
"storage mode", etc. and I ask you to think about whether
this question is even well-defined. Statistical mode, in the
sense of the most frequent value, is well-defined for samples
from a distribution on a discrete set, and it
Hello,
are there any functions in R for estimation of the mode of a MCMC-chain?
Best,
Patrik Waldmann
[[alternate HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
30 matches
Mail list logo