Displaying 20 results from an estimated 10000 matches similar to: "How to change the number of bins in "hist" function?"
2001 May 07
1
unexpected breaks in hist
Hello R-list,
I've been using hist to plot histograms of some data, but I get variable
numbers of bins. I understood from reading the help file that breaks will
set the number of bins. Please correct me if I'm wrong.
I'm plotting measures from subsets of a larger data set. Depending on the
data subset the number of bins varies despite having set breaks to 5 in
all cases.
See
2009 Jun 04
3
Understanding R Hist() Results...
Think I'm missing something to understand what is going on with hist(...)
http://n2.nabble.com/What-is-going-on-with-Histogram-Plots-td3022645.html
For my example I count 7 unique years, however, on the histogram there only 6. It looks like the bin to the left of the tic mark on the x-axis represents the number of entries for that year, i.e. Frequency.
I guess it looks like the bin for
2009 Feb 18
1
Plotting Binned Data
Dear all,
I have a binned data that looks like this:
> dat
(-1,9] (9,19] (19,29] (29,39] (39,49] (49,59] (59,69] (69,79]
10063374 79 16 4 3 4 4 3
(79,89] (89,99]
6 2
I tried to plot a histogram overlayed with curve.
With the following snippet:
library(lattice)
pdf("myfile.pdf")
hist(dat)
2012 Jul 10
2
Changing x-axis values displayed on histogram
Is it possible to change the x-axis values in a histogram to reflect binned
values?
Here are my data:
histexample<-c(6,7,7,8,8,8,9,9,9,9,9,10,10,10,10,10,10,10,11,11,11,11,11,11,12,12,12,12,13,13,13,14,14,14,15,16)
hist(histexample)
Now, I'll bin pairs of adjacent values together (e.g., 5-6, 7-8, 9-10,
11-12, 13-14, 15-16) using the following
bins<-c(4.5,6.5,8.5,10.5,12.5,14.5,16.5)
2003 Oct 28
1
stacking histograms
Hi,
I have a set of observations which are divided into two sets A and B.
I have some code that bins the dataset into 10 bins based on the max and
min of the observed values.
I would like to make a histogram of A & B using my calculated bins but
plot the distribution of B on top of A (like a stacked barplot). This is
possible since both sets A & B are binned using the same bin ranges.
2006 Nov 14
2
dividing vectors into bins with equal widths
Hi R-users,
I am trying to divide a vector (say X) into equal frequency bins. If one uses the hist()
function, then a histogram is plotted, but with bins of equal widths, and not with bins
having the same number of data points.
I have then tried the histogram() function as follows:
histogram(X, nint=10, breaks=NULL, equal.widths=F)
This works as I want. However, I can't extract which
2008 Jan 30
1
"hist" combines two lowest categories -- is there a workaround?
When preparing a series of histograms I found that hist was combining
the two lowest categories or bins, 1 and 2. Specifying breaks, as
illustrated below, resulted in the correct histogram:
values <- sample(10,500,replace=TRUE)
hist(values)
hist(values,breaks = 0:10)
Apparently, the number of values strictly less than 1 is shown in the
first bin (and since none is less than 1,
2008 May 19
2
How hist() decides breaks?
Hi Folks,
I'd like to know how hist() decides how many cells to use
when it ignores my "suggestion" to use say 'hist(...,breaks=50)'.
More specifically, I have the results of 10000 simulations,
each returning an 8-vector, therefore 8 variables each with
10000 values. Some of these 8 have somewhat skew distributions.
Say one of these 8 variables is X.
I ask for H <-
2017 Nov 08
0
Default for bin limits in hist()
Hello all.
I noticed that the default setting for breaks in the construction of histograms in hist() is ?right = TRUE?.
I think ?right=FALSE? would be more consistent with usual definitions of lower and upper limits for bins in applied statistics, and I suggest that you consider making it the default for hist().
For example, I generated the following frequency distribution for duration of
2005 Jun 17
1
hist.default documentation
I think there are a couple of things in ?hist that are not quite as
clear as they could be.
(1)
freq: logical; if 'TRUE', the histogram graphic is a representation
of frequencies, the 'counts' component of the result; if
'FALSE', _relative_ frequencies ("probabilities"), component
'density', are plotted. Defaults to
2013 Jan 22
3
density of hist(freq = FALSE) inversely affected by data magnitude
Hi,
I have a couple of observations, a question or two, and perhaps a
suggestion related to the plotting of density on the y-axis within the
hist() function when freq=FALSE. I was using the function and trying
to develop an intuitive understanding of what the density is telling
me. After reading through this fairly helpful post:
2003 Jan 31
3
hist (PR#2512)
The command hist(c(2,2,2,4,5,6)) returns a histogram that looks incorrect -- 3 in the bin labeled 2 on the left, but 1 each in the bins labeled 3,4,5 on the left.
Thanks!
Pam Surko
--------------------
> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 1
minor
2005 Nov 02
2
breaks in hist()
Dear listers,
A quick question about breaks in hist().
The histogram is highly screwed to the right, say, the range of the vector is [0, 2], but 95% of the value is squeezed in the interval (0.01, 0.2). My question is : how to set the breaks then make the histogram look even?
Thanks in advance,
Leaf
2006 Aug 25
1
How to get back POSIXct format after calculating with hist() results
Hi,
I have a casting/formatting question on hist.POSIXt:
The histogram plot from POSIXct works perfect (with help of Prof. Ripley
-thanks!).
When processing the hist(plot=FALSE) output and then plotting the
results over the x-axis (bins) coming from hist(), I lose the date/time
labels, getting instead integers displayed.
Trying to cast the $breaks with as.POSIXct gives silly results with
2011 Dec 07
1
Rank samples by breaks in hist and assign result as factor
Hi R users,
My goal is to rank my samples according to how they fall out in a
histogram with 10 bins to produce a ranking for each sample according
to where it falls on the histogram, with a "1" to represent one tail
of the hist, a "10" to represent the other tail, and a "5" for the
median/mean. I have a number of different data sets to do this with
and in all cases
2006 Jan 10
2
reading contigency tables
Hi all,
I need some help using read.ftable to read a contingency table. My columns
are organized as follows:
order--family--species--location--number of individuals
I couldn't figure out how to change the data on my text file to be
imported into R; and after you do that, is it possible to convert the
table into a data frame? Any tips would be greatly appreciatted!
Thanks a lot,
Naiara.
2006 Feb 16
2
how to retrieve robust se in coxph
Hi,
I am using coxph in simulations and I want to store the "robust se" (or
"se2" in frailty models) for each replicate. Is there a function to retrieve
it, like vcov() for the variance estimate? Thanks!
Lei Liu
Assistant Professor
Division of Biostatistics and Epidemiology
Dept. of Public Health Sciences
School of Medicine
University of Virginia
3181 Hospital West
2006 Jan 11
1
Log-likelihood for Multinominal Probit Regression Model
I use mnp to run a multinominal probit regression model, but the summary
doesn't contain the model statistics, such as the log-likelihood and degree
of freedom, for the assessment of the goodness-of-fit of the fitted model.
Is there any way that I can generate these statistics for the fitted model
in R?
Many thanks in advance!
SC
2006 Feb 11
1
R-newbie-question, fixed effects panel model, large number of observations
Hi,
I'm trying to fit a fixed effect (LSDV) panelmodel with R. I have a dataset
with y as dependent, x1&x2 as indeps, t as time index and i as an
id-variable for each individual. There are three observations for each
individual (t=1, t=2, t=3).
I want to try a simple regression, but with individual intercepts:
-------------------------------------------------
# reading in some data ...
2006 Feb 20
1
need help on nlme()
Hello there,
I am using nlme() to fit a logistic mixed effect model on our data.
The outcome variable is binary.
I got the error when I wanted to add a group factor to my model.
My initial model is as below:
model.a <- nlme(response~ 1/(1 + exp( -intercept- u0 - slope*TIME -
u1*TIME)),
+ fixed=intercept+slope~1, random= u0+u1~1
|studentID,