Displaying 20 results from an estimated 9000 matches similar to: "density() integrates to 1?"
2012 Jun 14
2
density plot on a log scale
I'm working with a large dataset - large enough that when I do a scatter plot
the points all blur together, so I want to plot their density by color - a
heat map or something like that. I've used smoothScatter for tasks like
this, but the problem is that my current dataset really only looks good on a
log-log scale. When I do the following command
smoothScatter(
data,
2010 Nov 20
2
How to do a probability density based filtering in 2D?
Hello,
This sounds like a problem to which many solutions should exist, but I
did not manage to find one.
Basically, given a list of datapoints, I'd like to keep those within
the X% percentile highest density.
That would be equivalent to retain only points within a given line of
a contour plot.
Thanks to anybody who could let me know which function I could use!
Best,
Emmanuel
2006 Oct 27
1
how to draw histograms on multiple variables in a graph?
for example, I have two sets, x and y.
I want to draw their histograms using different colors in a graph.
I didn't find how to do this by reading ?hist
Thanks very much.
[[alternative HTML version deleted]]
2010 Apr 19
1
densCols: what are the computed densities and how to create a legend
Hi,
I'm using the densCols function for a scatterplot and cannot figure out 1) how to extract the computed densities, and 2) how to create a legend based that represents the upper and lower ranges of the densities.
For example:
movers.den <- densCols(move$x, move$y)
table(movers.den)
#08306B #083775 #083B7C #083D7E #3989C1 #3F8FC4
28 22 101 25
2012 Aug 03
2
Density plots
Dear group,
I need help on two problems:
1. I am trying to plot density plots for each individual in 8 occasions.
I can do this by subject wiht the code below:
par(mfrow=c(4,2))
plot(density(all8scenarios$SIMCONC[all8scenarios$ID==1&all8scenarios$WSEQ==0]))
plot(density(all8scenarios$SIMCONC[all8scenarios$ID==1&all8scenarios$WSEQ==1]))
2007 Jul 13
1
spatstat - Fitting a Strauss model with trend determined by kernel density smoother
Dear r-help,
I would like to use the 'ppm' function of the 'spatstat' package to
fit a Strauss inhibition model. I understand that I can specify a
parametric model for the "background" trend, but how would I specify a
trend which is estimated using a Kernel density smoother?
In particular, I would like to use the 'kde' function of the 'ks'
package to
2016 Apr 22
2
S4 non-virtual class with no slots?
It seems that if an S4 class has no slots it can't be instantiated because it is assumed to be virtual. Is there a way around this other than adding a do-nothing slot? A singleton would be OK, though is not essential.
Problem:
EmptyFitResult <- setClass("EmptyFitResult", representation=representation())
# also tried it without the second argument. same result.
> e <-
2011 Jun 10
1
smoothScatter function question and adding a legend
Hello,
I have a few questions, regarding the smoothScatter function.
I have a scatter plot with more than 500,000 data points for
two samples. So, I am wanting to display the density in colors
to convince people that my good correlation coefficient is not
due to an "influential point effect" and plus, I also want to make
my scatter plot look pretty. Anyway ...
I have been able to
2011 Feb 07
1
kernel density
Hi all (again),
many thanks for the answer to the optimization problem. All is fine now. The
problem now is with kernel estimators in sm. package. I do all the work and
the graphics good, but I need the density function data for each point, and
I don't know how to get it. The only thing I get is the table at the end of
the following sequence:
>
2015 Mar 03
2
Asssistance
Hi to All,
I am building a package in R and whenever I run command "R CMD build OAR"
in the terminal, I get the following error:
* checking for file ?OAR/DESCRIPTION? ... OK
* preparing ?OAR?:
* checking DESCRIPTION meta-information ... ERROR
Malformed Depends or Suggests or Imports or Enhances field.
Offending entries:
R (>=3.0.2)
Entries must be names of packages optionally
2003 Jun 17
1
hist density...
Hi!
Do not understand following behavior.
> summary(test$dif)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.7389 0.9713 0.9850 0.9818 1.0000 1.0000
length(test$dif)
[1] 85879
tmp <- hist(test$dif,breaks=100,freq=FALSE)
The density on the Y axis in the plot are in the range 0-200.
Thought that the density should be in the range 0-1
(something like
2008 Aug 07
2
histogram - freq=FALSE - density computation
Hi,
I don't understand what
hist(x, freq=FALSE)
does.
At first I thought it would be just the relative frequencies instead
of the absolute frequencies,
by just computing "frequencies / n" in every category.
But with a small dataset the y-values (densities) don't sum to one.
Is there a way to get the histogram doing that?
Or what is the idea of this density-computation?
2006 Jun 14
1
Estimate region of highest probabilty density
Estimate region of highest probabilty density
Dear R-community
I have data consisting of x and y. To each pair (x,y) a z value (weight) is assigned. With kde2d I can estimate the densities on a regular grid and based on this make a contour plot (not considering the z-values). According to an earlier post in the list I adjusted the kde2d to kde2d.weighted (see code below) to estimate the
2011 May 23
1
How is the relation between Frequency and Counts in hist/density defined?
Hi all,
I'm looking to add a "density" smoother on top of a hist when Freq=T.
In order to do this I can use the relation between count and density, but I
would like to know if there is a way for me to predict it upfront.
Here is an example:
set.seed(242)
z = rnorm(30)
hist_z <- hist(z)
hist_z$counts / hist_z$density # the relation is 15
# why is this 15 ??
# So I can now do:
2009 Jul 20
1
tabulate can accept NA values?
tabulate has
.C("R_tabulate", as.integer(bin), as.integer(length(bin)),
as.integer(nbins), ans = integer(nbins), PACKAGE="base")$ans
The implementation of R_tabulate has
if(x[i] != R_NaInt && x[i] > 0 && x[i] <= *nbin)
and so copes with (silently drops) NA. Perhaps the .C could have
NAOK=TRUE? This is useful in apply'ing tabulate to
2000 Jan 12
3
functions for flat file import/export + utilities
Dear R-Developers,
please find attached a set of drafted functions for flat file import and
export, partially extending existing functions, partially completely written
as new code.
I thought you might be interested in those functions and the accompanying
utilities for padding and trimming.
Main features are
- supports several formats, i.e. fixed width and CSV (with one exception)
- supports
2012 Mar 10
1
How to improve the robustness of "loess"? - example included.
Hi,
I posted a message earlier entitled "How to fit a line through the
"Mountain crest" ..."
I figured loess is probably the best way, but it seems that the
problem is the robustness of the fit. Below I paste an example to
illustrate the problem:
tmp=rnorm(2000)
X.background = 5+tmp; Y.background = 5+ (10*tmp+rnorm(2000))
X.specific = 3.5+3*runif(1000);
2010 Apr 13
1
Binning Question
Hi,
I'm trying to setup some complicated binning with statistics and could
use a little help.
I've found the bin2 function from the ash package, but it doesn't do
everything I need. My intention is to copy some of their code and then
modify as needed.
I have a vector of two columns:
head(data)
r1 r2
[1,] 0.03516559 0.03102128
[2,] 0.02162539 0.14847034
2006 Feb 18
1
truncated negative binomial using rnegbin
Dear R users,
I'm wanting to sample from the negative binomial distribution using the
rnegbin function from the MASS library to create artificial samples for the
purpose of doing some power calculations. However, I would like to work
with samples that come from a negative binomial distribution that includes
only values greater than or equal to 1 (a truncated negative binomial), and
I
2006 Aug 30
2
density() with from, to or cut and comparrison of density()
Hi
the function density() does normally integrate to one - I've checked it
and it works and I also read the previous threads.
But I realised that it does not integrate to one if I use from, to or cut.
My scenario: I simulated densities of a plants originating from an sseed
source at distance zero. Therefore the density of the plants will be
highest close to zero. Is there anything I can do