2.5
weighted.mean(c(1, 2, 3, NA), weights=c(1, 1, 1, 1))
[1] NA
weighted.mean(c(1, 2, 3, NA), weights=c(1, 1, 1, 1), na.rm=TRUE)
[1] 2
Von: Richard O'Keefe
Gesendet: Montag, 12. Juli 2021 13:18
An: Matthias Gondan
Betreff: Re: [R] density with weights missing values
Does your copy of
.
Best wishes,
Matthias
PS. Sorry for the HTML email. I’ve given up trying to fix such behavior.
Von: Martin Maechler
Gesendet: Dienstag, 13. Juli 2021 09:09
An: Matthias Gondan
Cc: r-help@r-project.org
Betreff: Re: [R] density with weights missing values
>>>>> Matthias Gonda
d then in
your report mention both density() and weighted.mean(), i.e., a
cleaned up version of the union of your first 2 e-mails..
Thank you for thinking about this and concisely reporting it.
Martin
> Von: Richard O'Keefe
> Gesendet: Montag, 12. Juli 2021 13:18
> An: Ma
On 12/07/2021 1:22 p.m., matthias-gondan wrote:
You're right, of course. Extrapolating your argument a bit, the whole practice
of na.rm is questionable, since there's always a reason for missingness (that
is not in x and rarely elsewhere in the data)Best wishes Matthias
For what it's worth, I
12.07.21 18:44 (GMT+01:00) An:
>r-help@r-project.org, matthias-gondan , Bert
>Gunter Cc: r-help@r-project.org Betreff: Re:
>[R] density with weights missing values Sure, you might think that.But
>most likely the reason this code has not been corrected is that when
>you give weights
er
Datum: 12.07.21 18:44 (GMT+01:00) An:
r-help@r-project.org, matthias-gondan , Bert Gunter
Cc: r-help@r-project.org Betreff: Re: [R] density with
weights missing values Sure, you might think that.But most likely the reason
this code has not been corrected is that when you give weights for mi
dan Cc: r-help@r-project.org
>Betreff: Re: [R] density with weights missing values The behavior is as
>documented AFAICS.na.rmlogical; if TRUE, missing values are removed
>from x. If FALSE anymissing values cause an error.The default is
>FALSE.weightsnumeric vector of non-negative obse
eighted.mean(c(1, 2, 3, 4), weights=c(1, 1, 1, 1))
> > [1] 2.5
> > > weighted.mean(c(1, 2, 3, NA), weights=c(1, 1, 1, 1))
> > [1] NA
> > > weighted.mean(c(1, 2, 3, NA), weights=c(1, 1, 1, 1), na.rm=TRUE)
> > [1] 2
> >
> >
> >
> >
> >
thing?
Ursprüngliche Nachricht Von: Bert Gunter
Datum: 12.07.21 16:25 (GMT+01:00) An: Matthias
Gondan Cc: r-help@r-project.org Betreff: Re: [R]
density with weights missing values The behavior is as documented
AFAICS.na.rmlogical; if TRUE, missing values are removed from x. If FALSE
anymissing v
ghts=c(1, 1, 1, 1))
> [1] 2.5
> > weighted.mean(c(1, 2, 3, NA), weights=c(1, 1, 1, 1))
> [1] NA
> > weighted.mean(c(1, 2, 3, NA), weights=c(1, 1, 1, 1), na.rm=TRUE)
> [1] 2
>
>
>
>
> Von: Richard O'Keefe
> Gesendet: Montag, 12. Juli 2021 13:18
> An:
a.rm=TRUE)
[1] 2
Von: Richard O'Keefe
Gesendet: Montag, 12. Juli 2021 13:18
An: Matthias Gondan
Betreff: Re: [R] density with weights missing values
Does your copy of R say that the weights must add up to 1?
?density doesn't say that in mine. But it does check.
On Mon, 12 Jul 2021
Dear R users,
This works as expected:
• plot(density(c(1,2, 3, 4, 5, NA), na.rm=TRUE))
This raises an error
• plot(density(c(1,2, 3, 4, 5, NA), na.rm=TRUE, weights=c(1, 1, 1, 1, 1, 1)))
• plot(density(c(1,2, 3, 4, 5, NA), na.rm=TRUE, weights=c(1, 1, 1, 1, 1, NA)))
This seems to work (it trigge
Hello,
Yes, there is even an old discussion on this on r-devel, dated August,
10 2013.
See [1].
[1]
https://r-project.markmail.org/search/?q=broken-link-in-docs-for-Binormial-functions#query:broken-link-in-docs-for-Binormial-functions+page:1+mid:rf6tbiokcdyai6el+state:results
Hope this he
Thank you Peter and Spencer. That clears things up. Also since no one
responded the second part of my question, I'm still wondering if it was
noted that there is a hyperlink in the dbinom help file (?dbinom) that
isn't directing correctly?
Stefan
On Fri, Mar 15, 2019, 07:37 peter dalgaard, wrote
PM
To
r-help@r-project.org,
cc
Subject
[R] density vs. mass for discrete probability functions
Dear R users,
While experimenting with the dbinom() function and reading its
documentation (?dbinom) it reads that "dbinom gives the density" but
shouldn't it be called "ma
On 2019-03-15 08:37, peter dalgaard wrote:
Mathematically, you can bring discrete and continuous distributions on a common
footing by defining probability functions as densities wrt. counting measure.
You don't really need Radon-Nikodym derivatives to understand the idea, just
the fact that
Mathematically, you can bring discrete and continuous distributions on a common
footing by defining probability functions as densities wrt. counting measure.
You don't really need Radon-Nikodym derivatives to understand the idea, just
the fact that sums can be interpreted as integrals wrt counti
On 2019-03-14 19:43, Stefan Schreiber wrote:
Dear R users,
While experimenting with the dbinom() function and reading its
documentation (?dbinom) it reads that "dbinom gives the density" but
shouldn't it be called "mass" instead of "density"? I assume that it
has something to do with keeping
Dear R users,
While experimenting with the dbinom() function and reading its
documentation (?dbinom) it reads that "dbinom gives the density" but
shouldn't it be called "mass" instead of "density"? I assume that it
has something to do with keeping the function for "density" consistent
across discr
You desperately need to read the Posting Guide mentioned at the bottom of every
posting on this list. Avoid attachments (your code did not come through), keep
sample data size minimal, don't reply to other topic messages (start a fresh
email thread so your message doesn't get buried in other peo
Hi,
I'm Najad, a student at the University of Glasgow. I really need help with a
script of mine to plot density plot for my data. I kept on having an error
saying need at least 2 points to select a bandwidth automaticallyI've tried to
replace the NaN in my data to zero but still the same. I'm no
Thank you very much!
I do need to learn more about R!!
On Tuesday, March 17, 2015 9:26 PM, William Dunlap
wrote:
Fix Ace wrote What is the default "n"?
512: > length(density(rnorm(10^6))$x) [1] 512 > args(density.default)
function (x, bw = "nrd0", adjust = 1, kernel = c(
> I have a dataset with 6187 elements, ranged from 3 to 104028. When I tried to
> examine only small range of data, I found that the plot was not smooth (as
> shown below):
> plot(density(test$V2), xlim=c(0,1000))
>
>
> Is there away to make it smoother?
For small ranges, use 'from' and 'to' i
Thank you for the email.
What is the default "n"?
Thanks!
On Tuesday, March 17, 2015 4:06 PM, William Dunlap
wrote:
Increasing the value of 'n' given to density will give an estimate at more
points so it will look smoother. Try n=2^18.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
Fix Ace wrote
What is the default "n"?
512:
> length(density(rnorm(10^6))$x)
[1] 512
> args(density.default)
function (x, bw = "nrd0", adjust = 1, kernel = c("gaussian",
"epanechnikov", "rectangular", "triangular", "biweight",
"cosine", "optcosine"), weights = NULL, w
Increasing the value of 'n' given to density will give an estimate at more
points so it will look smoother. Try n=2^18.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Mar 17, 2015 at 12:06 PM, Fix Ace wrote:
>
>
> I have a dataset with 6187 elements, ranged from 3 to 104028. When I
> tr
I have a dataset with 6187 elements, ranged from 3 to 104028. When I tried to
examine only small range of data, I found that the plot was not smooth (as
shown below):
plot(density(test$V2), xlim=c(0,1000))
Is there away to make it smoother?
Thanks a lot!!
___
uot;
Envoyé le : Jeudi 19 février 2015 17h51
Objet : Re: [R] Density plots for Chi-square and F-distribution on my data
I think you might do well to consult a local statistical expert, as
you appear to be out of your statistical depth here.
Also, is this homework? If so, this is not a homework
I think you might do well to consult a local statistical expert, as
you appear to be out of your statistical depth here.
Also, is this homework? If so, this is not a homework site (although
posters sometimes get help anyway).
Cheers,
Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467
Dear R-helpers,
I want to compute the density plot (probability plot) of the Chi-square
distribution.
My 2 categorical variables are gender (male, female) and colors of the eyes
(blue, green and brown).
The sample size n = 100. The proportions are the following :
male and blue eyes : 10%
male
Hello,
What you are doing wrong? Correctly read the help page.
>From the help page: "if FALSE, probability densities, component
density, are plotted (so that the histogram has a *total area of
one*)"
> sum(check$density * diff(check$breaks))
[1] 1
HTH,
Pascal
On Tue, May 20, 2014 at 3:06 PM, v
Dear List,
I am trying to make a histogram with following data:
dput(a)
c(1, 0, 1.5, 1, 0, 0, 0, 1, 1.5, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1,
0, 0, 0, 1, 1, 1, 0, 1, 0.5, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0,
0, 0, 0, 0, 1, 1, 1, 0, 0, 1.5, 0, 0, 0, 0, 1, 0, 0, 0.5, 0,
0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1,
M
To: DHIMAN BHADRA; r-help@r-project.org
Subject: Re: [R] Problem with R "density" function
Hi,
Have you tried using a different bandwidth rather than the number of points,
the default bandwidth gives ...
x <- rnorm(1)
dd <- density(x,kernel="epanechnikov",
..@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of DHIMAN BHADRA
Sent: 14 May 2014 10:36
To: r-help@r-project.org
Subject: [R] Problem with R "density" function
Hello,
My friend has the following issue with R. I will be glad to receive any
response.
Thanks,
Dhiman Bhadra
Hello
Hello,
My friend has the following issue with R. I will be glad to receive any
response.
Thanks,
Dhiman Bhadra
Hello everyone,
I am trying to use the 'density' function available with the base package
of R to estimate the density of a data set for subsequent use. I just
noticed that with even 100
Thanks Jim.. once again your rock
On Wednesday, January 22, 2014 9:51 AM, Jim Lemon wrote:
On 01/22/2014 07:37 PM, Alaios wrote:
> Hi there,
> I would like to be able to draw a density plot or a box plot where the median
> and the median and the mean would be visible.
>
> If I decide a de
On 01/22/2014 07:37 PM, Alaios wrote:
Hi there,
I would like to be able to draw a density plot or a box plot where the median
and the median and the mean would be visible.
If I decide a density plot I need to put two big marks one for the median and
one for the mean, which I do not know how I
Hi there,
I would like to be able to draw a density plot or a box plot where the median
and the median and the mean would be visible.
If I decide a density plot I need to put two big marks one for the median and
one for the mean, which I do not know how I can achieve to put marks in a
density p
ng -- rather use freq=FALSE
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: J Toll [mailto:jct...@gmail.com]
> Sent: Tuesday, January 22, 2013 5:32 PM
> To: William Dunlap
> Cc: r-help
> Subject: Re: [R] density of hist(freq = FAL
Bill,
Thank you. I got it. That can require a fair amount of work to
interpret the density, especially with odd or irregular bin sizes.
Thanks again,
James
On Tue, Jan 22, 2013 at 5:33 PM, William Dunlap wrote:
> The probability density function is not unitless - it is the derivative of th
ilto:r-help-boun...@r-project.org] On
> Behalf
> Of J Toll
> Sent: Tuesday, January 22, 2013 2:48 PM
> To: r-help
> Subject: [R] density of hist(freq = FALSE) inversely affected by data
> magnitude
>
> Hi,
>
> I have a couple of observations, a question or two, and
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
, August 09, 2012 8:55 AM
To: dcarl...@tamu.edu
Cc: r-help
Subject: Re: [R] Density
Hi David,
Thanks a lot for the reply.
I might not have stated the problem clearly. Let me try again.
Given a set of observations X, I want to find out the estimated density
values for the observations X?
CO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of li li
> Sent: Thursday, August 09, 2012 6:55 AM
> To: dcarl...@tamu.edu
> Cc: r-help
> Subject: Re: [R] Density
>
>
amp;M University
> College Station, TX 77843-4352
>
>
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> > project.org] On Behalf Of li li
> > Sent: Wednesday, August 08, 2012 9:03 PM
> > To: r-help
> > Subject: [R]
352
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of li li
> Sent: Wednesday, August 08, 2012 9:03 PM
> To: r-help
> Subject: [R] Density
>
> Dear all,
>Given a set of observations X, I wa
Dear all,
Given a set of observations X, I want to evaluate the kernel density
estimator
at these observed values. If I do the following, I do not get the those
estimated values directly.
Can anyone familiar with this give an idea on how to find out the estimated
density values for X?
> X <- rn
; College Station, TX 77843-4352
>
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
>> project.org] On Behalf Of Ayyappa Chaturvedula
>> Sent: Friday, August 03, 2012 10:37 AM
>> To: r-help@r-project.org
>> Subjec
ofessor of Anthropology
Texas A&M University
College Station, TX 77843-4352
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Ayyappa Chaturvedula
> Sent: Friday, August 03, 2012 10:37 AM
> To: r-help@r-project.org
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[all
t;> Associate Professor of Anthropology
>> Texas A&M University
>> College Station, TX 77843-4352
>>
>> > -Original Message-
>> > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
>> > project.org] On Behalf Of Michael Young
>>
M University
> College Station, TX 77843-4352
>
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> > project.org] On Behalf Of Michael Young
> > Sent: Wednesday, July 25, 2012 9:53 PM
> > To: li li
> > Cc: r-h
-Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Michael Young
> Sent: Wednesday, July 25, 2012 9:53 PM
> To: li li
> Cc: r-help
> Subject: Re: [R] density
>
> I can't help you decide which band
I can't help you decide which bandwidth method to use, but here's how
you view the density source code...
methods("density")
density.default
On Wed, Jul 25, 2012 at 5:56 PM, li li wrote:
>
> Hi all,
> I have a question regarding the density function which gives the
> kernel density estimator.
Hi all,
I have a question regarding the density function which gives the
kernel density estimator.
I want to decide the bandwidth when using gaussian kernel, given a set of
observations. I am not familiar with different methods for bandwidth
determination. Below are the different ways in R on
Here are 2 approaches:
Use logspline density estimates (logspline package) rather than kernel
density estimates, this can give you a function to pass to integrate
or other tools, the estimates may be a little different from the
kernel density estimates.
If you need to use kernel density estimates
Hello,
Maybe the link below is of some use.
http://stats.stackexchange.com/questions/14061/area-under-the-pdf-in-kernel-density-estimation-in-r
Hope this helps,
Rui Barradas
Em 27-06-2012 01:13, pilaw escreveu:
Hello,
I need density function so that I can find expected value (using
integra
Hello,
I need density function so that I can find expected value (using
integration). I use density():
f= density(data)
but f isn't a function and I can't get values and integrate it
This is very urget, so please help.
Greetings
Peter
--
View this message in context:
http://r.789695.n4.nabble
t, price)) + geom_point(alpha = 1/10)
p
http://had.co.nz/ggplot2/geom_point.html
John Kane
Kingston ON Canada
> -Original Message-
> From: j...@bitwrit.com.au
> Sent: Thu, 14 Jun 2012 21:39:36 +1000
> To: field.c...@gmail.com
> Subject: Re: [R] density plot on a log s
On 06/14/2012 07:08 PM, field.cady wrote:
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
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 o
My guess (unconfirmed) is that read.table() gives you a data frame but
density.lf expects an atomic (= not a list = not a data frame) vector.
Perhaps try density.lf(x[,1]) to just send the column -- the "drop"
behavior should make sure this is an atomic vector.
If that doesn't help, please do prov
Dear R help group: I am attempting to produce a density plot from a list of
2 values using the density.lf function and would appreciate any help, I
hope I have done my homework reading the documentation but I still seem to
be missing something basic.
I have read the data as a table using read.
I didn't try out your extensive code, but here's one potentially serious
problem:
You only pass two arguments to f(), alpha and h, but within f you nonetheless
use x1 and y and several other things. This is bad practice, and dangerous:
you should pass all the necessary arguments to f(), not rely o
Sorry that was my poor copying and pasting. Here's the correct R code. The
problem does seem to be with the function I define as f.
# Model selection example in a bayesian framework
# two competiting non-nested models
# M0: y_t = alpha * x1^2 + e_t
# M1: y_t = beta * x1^4 + e_t
# where e_t ~ iidN(
On Dec 3, 2011, at 5:42 PM, napps22 wrote:
Dear R users,
I'm trying to carry out monte carlo integration of a posterior density
function which is the product of a normal and a gamma distribution.
The
problem I have is that the density function always returns 0. How
can I
solve this proble
Dear R users,
I'm trying to carry out monte carlo integration of a posterior density
function which is the product of a normal and a gamma distribution. The
problem I have is that the density function always returns 0. How can I
solve this problem?
Here is my code
#generate data
x1 <- runif(100
Hello R community,
I have recorded online/offline timestamps per user that looks like this:
username,online_time,offline_time
a,2011-11-01 16:16:56.692572+01,2011-11-01 21:06:16.388903+01
a,2011-11-01 21:07:14.204367+01,2011-11-01 21:34:21.47081+01
a,2011-11-01 21:38:09.501356+01,2011-11-01 21:53
Hi,
I have recorded online/offline timestamps per user that looks like this:
username,online_time,offline_time
a,2011-11-01 16:16:56.692572+01,2011-11-01 21:06:16.388903+01
a,2011-11-01 21:07:14.204367+01,2011-11-01 21:34:21.47081+01
a,2011-11-01 21:38:09.501356+01,2011-11-01 21:53:45.272321+
On Sep 8, 2011, at 19:03 , Albyn Jones wrote:
> Look at
>
>area <- sum(a$y)*(a$x[1]-a$y[2])
>
> The problem appears to be "a$x[1]-a$y[2]"; that is not the length of
> the base of an approximating rectangle, whatever it is :-)
I would assume that that is just a typo for a$x[1]-a$x[2], which
Is your "data" supposed to be observations, or values of the density
of the underlying law?
Also, could you explain the rationale behind :
sum(a$y)*(a$x[1]-a$y[2])
because it is not immediately clear to the reader.
2011/9/8 Gonçalo Ferraz :
> Hi, I have a vector 'data' of 58 probability values (b
Look at
area <- sum(a$y)*(a$x[1]-a$y[2])
The problem appears to be "a$x[1]-a$y[2]"; that is not the length of
the base of an approximating rectangle, whatever it is :-)
albyn
On Thu, Sep 08, 2011 at 11:36:23AM -0400, Gonçalo Ferraz wrote:
> Hi, I have a vector 'data' of 58 probability value
ilto:r-help-bounces@r-
> project.org] On Behalf Of Gonçalo Ferraz
> Sent: Thursday, September 08, 2011 9:36 AM
> To: r-help@r-project.org
> Subject: [R] Density function: Area under density plot is not equal to
> 1. Why?
>
> Hi, I have a vector 'data' of 58 probability v
Hi, I have a vector 'data' of 58 probability values (bounded between 0 and 1)
and want to draw a probability density function of these values. For this, I
used the commands:
data <- runif(58)
a <- density(data, from=0, to=1)
plot(a, type="l",lwd=3)
But then, when I try to approximate the area
On Aug 31, 2011, at 1:04 PM, alex46...@yahoo.com wrote:
Hi, there,
I found density function cannot work well on UNIX.R
version 2.13.1 (2011-07-08), Platform: i386-pc-solaris2.10 (32-bit)
Here is an example from R doucments which can work well on other
version.
plot(density(c(-20,rep(0,98
Hi, there,
I found density function cannot work well on UNIX.R
version 2.13.1 (2011-07-08), Platform: i386-pc-solaris2.10 (32-bit)
Here is an example from R doucments which can work well on other version.
plot(density(c(-20,rep(0,98),20)), xlim = c(-4,4))#
But right now the estimated probab
Let me ask another way.
Is there a way to create a histogram with a fitted line, but without bars?
Or, perhaps draw the bars with invisible lines?
Thanks.
On Tue, Aug 16, 2011 at 7:29 AM, Jeff Newmiller
wrote:
> This is a nonsensical request. It is like saying you want to plot the speed
> of
This is a nonsensical request. It is like saying you want to plot the speed of
a falling object but you want the units of speed to be meters.
---
Jeff Newmiller The . . Go Live...
DCN: Basics: ##.#. ##.#. Live Go...
Li
I would like to create a kernal density plot, but rather than show
density units on the vertical axis I would like frequencies.
I know histograms do this but I don't want the bars, just the density curve.
Thanks!
__
R-help@r-project.org mailing list
h
On Wed, Aug 3, 2011 at 5:11 AM, r student wrote:
> Like below?
>
> plot(density(oh$FINCP,weights=oh$PWGTP/sum(oh$PWGTP)))
>
Yes
If you are doing lots of analyses with weighted data you might want to
look at the survey package. It also has a density estimator, in
svysmooth(), which works very mu
Like below?
plot(density(oh$FINCP,weights=oh$PWGTP/sum(oh$PWGTP)))
On Tue, Aug 2, 2011 at 10:06 AM, David Winsemius wrote:
>
> On Aug 2, 2011, at 12:51 PM, r student wrote:
>
>> I'm trying to create a density plot using census data, where the
>> weights don't sum to 1.
>>
>>
>>> plot(density
On Aug 2, 2011, at 1:11 PM, r student wrote:
Like below?
plot(density(oh$FINCP,weights=oh$PWGTP/sum(oh$PWGTP)))
I don't understand why you are asking for approval. You are the one
with the data and know where they came from. We have none of that
background.
--
David.
On Tue, Aug 2, 20
On Aug 2, 2011, at 12:51 PM, r student wrote:
I'm trying to create a density plot using census data, where the
weights don't sum to 1.
plot(density(oh$FINCP,weights=oh$PWGTP))
Warning message:
In density.default(oh$FINCP, weights = oh$PWGTP) :
sum(weights) != 1 -- will not get true dens
I'm trying to create a density plot using census data, where the
weights don't sum to 1.
>plot(density(oh$FINCP,weights=oh$PWGTP))
Warning message:
In density.default(oh$FINCP, weights = oh$PWGTP) :
sum(weights) != 1 -- will not get true density
How would I go about doing this?
Thanks!
I tried logspline function using a lower bound 0 for my data, it works
like a charm. When the I changed the xlim only positive part, the
vertical line was also gone. That's exactly what I expected.
Thanks.
-JJ
Greg Snow wrote:
You might want to use the logspline package instead of the density
help-boun...@r-project.org] On
Behalf Of Greg Snow
Sent: Wednesday, April 27, 2011 1:55 PM
To: Juanjuan Chai; r-help@r-project.org
Subject: Re: [R] density plot of simulated exponential distributed data
You might want to use the logspline package instead of the density function, it
allow
p-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Juanjuan Chai
> Sent: Tuesday, April 26, 2011 4:19 PM
> To: r-help@r-project.org
> Subject: [R] density plot of simulated exponential distributed data
>
> Hi all,
>
> I tried to plot the den
Hi:
Try this (and note the use of vectorization rather than a loop):
rate <- 3
dta <- -log(1 - runif(1000))/rate
hist(dta, nclass = 30, probability = TRUE)
x <- c(0.001, seq(0, 3, by = 0.01))
lines(x, dexp(x, rate = 3))
This is the difference in timings between the vectorized and iterative
metho
Hi all,
I tried to plot the density curve using the data from simulation. I am
sure that the data should be exponentially distributed, but the plot
of density curve always starts from (0,0) which is not the case for
exponential distribution. Is there any way around this, to keep the
curve
I have two columns of data, one is a subset of the other. All the data lie
beteen 0 and 1 inclusive. I want to fit both densities on the same graph. I
would also like the ability to extract the fitted values of both smoothed
density (using the best method of course).
For example, if
h = c( runif(1
Hi:
Try this:
densityplot( ~ height | voice.part, data = singer, layout = c(2, 4),
xlab = "Height (inches)", bw = 5)
densityplot( ~ height | voice.part, data = singer, layout = c(2, 4),
xlab = "Height (inches)", bw = 5, plot.points = FALSE)
The plot.points argument is a
Hi,
Is it possible to remove the points at the base of a density plot?I would like
to keep only the curves of the plot, not the points.
Thank you.
Marie-Helene HacheyM.Sc. studentUniversite Laval, Quebec
__
R-h
On 21-Nov-10 19:11:20, William Dunlap wrote:
>> -Original Message-
>> From: r-help-boun...@r-project.org
>> [mailto:r-help-boun...@r-project.org] On Behalf Of Shant Ch
>> Sent: Saturday, November 20, 2010 6:34 PM
>> To: David Winsemius
>> Cc: r-h
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Shant Ch
> Sent: Saturday, November 20, 2010 6:34 PM
> To: David Winsemius
> Cc: r-help@r-project.org
> Subject: Re: [R] density at particular values
>
rate().
Bill Venables.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of David Winsemius
Sent: Sunday, 21 November 2010 3:21 PM
To: Shant Ch
Cc: r-help@r-project.org
Subject: Re: [R] density at particular values
On Nov 20, 2010, at 9
From: David Winsemius
To: Shant Ch
Cc: r-help@r-project.org
Sent: Sat, November 20, 2010 8:54:32 PM
Subject: Re: [R] density at particular values
On Nov 20, 2010, at 8:07 PM, Shant Ch wrote:
> Hello everyone!
>
> I want to use density function of R to compute the density at
x(=0, sa
sity given as y.
>
> I want to find the density of the given data at x=1. I basically want the
> value
> of y(=density) for x=1 i.e. kernel density at x=1.
>
> Shant
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> From: David Winsemius
>
>
vid Winsemius
Cc: r-help@r-project.org
Sent: Sat, November 20, 2010 8:54:32 PM
Subject: Re: [R] density at particular values
On Nov 20, 2010, at 8:07 PM, Shant Ch wrote:
> Hello everyone!
>
> I want to use density function of R to compute the density at x(=0, say). But
>it
> is gi
On Nov 20, 2010, at 8:07 PM, Shant Ch wrote:
Hello everyone!
I want to use density function of R to compute the density at x(=0,
say). But it
is giving me the 5-number summary and mean of the data and densities
at that
point.
I just want the densities at different values specified by me.
Hello everyone!
I want to use density function of R to compute the density at x(=0, say). But
it
is giving me the 5-number summary and mean of the data and densities at that
point.
I just want the densities at different values specified by me. Can anyone let
me
know how can I find that?
For
1 - 100 of 155 matches
Mail list logo