Displaying 20 results from an estimated 20000 matches similar to: "Kernel density output"
2007 Aug 01
1
Re : Custom axis
Maybe I do not explain well what I would like to do. I do not want to change the labels of the axis, but the scale. What I want is a general procedure for changing the scale. Its like using a logarithmic scale on a plot. Labels are the same, but the increases of x along the x-axis are defined by a known monotone and continuous function.
Florent Bresson
----- Message d'origine ----
De :
2006 Oct 16
2
Re : Re : Generate a random bistochastic matrix
Yes, you're right. In fact, it's just an adaptation of a matlab command and the author advises using N^4 replications that's why it's the default in the function. The bistochastic matrix is not my subject of interest, but I need it to perform some random tranformation of a vector of incomes.
Florent Bresson
----- Message d'origine ----
De : Richard M. Heiberger <rmh at
2006 Oct 16
5
Re : Generate a random bistochastic matrix
Thanks, I tried someting like this, but computation takes times for large matrices
btransf <- function(y,X=length(y)^4) {
N <- length(y)
bm <- matrix(rep(1/N,N^2),N,N)
for(j in 1:X){
coord <- sample(1:N,4,replace=T)
d <- runif(1,0,min(bm[coord[1],coord[2]],bm[coord[3],coord[4]]))
2006 Oct 16
2
Generate a random bistochastic matrix
Please, I would like to generate a random bistochastic matrix, that is a squared matrix of non-negative numbers with each row and each column sum to 1, for example :
.2 .3 .5
.6 .3 .1
.2 .4 .4
I don't know of to code this. Do you have any idea ?
Thanks
Florent Bresson
___________________________________________________________________________
Demandez ?
2005 Nov 28
3
optimization with inequalities
I have to estimate the following model for several
group of observations :
y(1-y) = p[1]*(x^2-y) + p[2]*y*(x-1) + p[3]*(x-y)
with constraints :
p[1]+p[3] >= 1
p[1]+p[2]+p[3]+1 >= 0
p[3] >= 0
I use the following code :
func <- sum((y(1-y) - p[1]*(x^2-y) + p[2]*y*(x-1) +
p[3]*(x-y))^2)
estim <- optim( c(1,0,0),func, method="L-BFGS-B" ,
lower=c(1-p[3], -p[1]-p[3]-1,
2001 May 10
3
lookup function for density(...) objects
Hi folks:
Is there a lookup function that returns the variate given the cumulative
probability for an object returned by the density(...) function?
> mydata _ as.vector(mymatrix)
> mydata.density _ density(mydata)
> mydata.p80 _ lookup(mydata.density, p=0.8) # is there any function to
accomplish this task?
Thanks.
Rajiv.
--------
Rajiv Prasad, Postdoctoral Research Associate,
2005 Dec 05
3
The gamma function and infinity
I have to calculate some formula like:
gamma(x)/(gamma(x+y)
and I observed that for relatively big values of x, R
returns infinity and so cannot compute the formula. Is
it possible to force R to give the real value of
gamma(x) instead of Inf ?
thanks
2005 Oct 31
3
Applying a function to a vector
I have defined a function to compute the value of a
beta distribution of the second kind (the existing
beta distribution of th stats package is the beta
distribution of the first kind). It works perfectly
for a single value, but I want to apply it to a vector
of 22 000 values. I can use a loop for the calculation
of each value but it runs very very slowly.
So, what can I change ?
Hers's the
2009 Jan 07
1
Importing data from SPSS with Arabic encoding
Dear R-users,
I'm facing a problem with the import of data in R. I have a sav file that, I presume, uses some Arabic encoding (but I don't know which one) and I would like to read it with R. When I use the function read.spss (I also tried spss.get(Hmisc)), I get the following message:
> read.spss("Hhld.sav")
Erreur dans read.spss("Hhld.sav") :
erreur ? la lecture
2007 Aug 24
2
Applying a function to an array
Dear R-users,
I would like to apply a function (more precisely sd()) over the third dimension of a three-dimension array. The function apply would be interesting but the chosen function can only be applied on the rows and columns of the array according to the help file. I can use a loop to cut the array in matrices and then use apply for each replication, but it's not very nice. A small
2008 Sep 05
3
Area of density
Hello!
Please, anybody help me.
Can I calculate area of density was created by:
> D <- density(x)
In other words I want to know area under curve 'plot(D)'
and It's good to calculate area before and after 0 separately.
--
View this message in context: http://www.nabble.com/Area-of-density-tp19338958p19338958.html
Sent from the R help mailing list archive at Nabble.com.
2006 Jun 07
4
Density Estimation
Dear R-list,
I have made a simple kernel density estimation by
x <- c(2,1,3,2,3,0,4,5,10,11,12,11,10)
kde <- density(x,n=100)
Now I would like to know the estimated probability that a
new observation falls into the interval 0<x<3.
How can I integrate over the corresponding interval?
In several R-packages for kernel density estimation I did
not found a corresponding function. I
2006 Jan 12
2
tapply and weighted means
I' m trying to compute weighted mean on different
groups but it only returns NA. If I use the following
data.frame truc:
x y w
1 1 1
1 2 2
1 3 1
1 4 2
0 2 1
0 3 2
0 4 1
0 5 1
where x is a factor, and then use the command :
tapply(truc$y,list(truc$x),wtd.mean, weights=truc$w)
I just get NA. What's the problem ? What can I do ?
2012 Jan 27
4
percentage from density()
Hi folks,
I know that density function will give a estimated density for a give
dataset. Now from that I want to have a percentage estimation for a
certain range. For examle:
> y = density(c(-20,rep(0,98),20))
> plot(y, xlim=c(-4,4))
Now if I want to know the percentage of data lying in (-20,2). Basically
it should be the area of the curve from -20 to 2. Anybody knows a simple
2006 Jul 19
3
Progress in a loop
Hi, I have to use a loop to perform a quite computer
intensive estimation and I would like to know the
progress of the loop during the process. I tried to
include something like
print(paste(k,date(),sep=" : "))
where k is the number of the iteration, but the result
appears only at the end of the loop. Can someone help
me please ?
2018 Mar 11
0
Empirical density estimation
On 3/11/2018 3:35 PM, Christofer Bogaso wrote:
> But for my reporting purpose, I need to generate a bell curve like
> plot based on empirical PDF, that also contains original points.
>
> Any idea would be helpful. Thanks,
>
Christofer,
something like the following may get you what you want:
## get the kernel density estimate
dens <- density(Dat)
## estimate the density at
2008 Feb 05
2
two densities with same stepsize
Hi there,
I have two series of data. plotting the density function of both gives me an
idea about the difference of the data. But I would like to quantify the
difference I see.
a <- rnorm(100)
b <- rnorm(100)
da <- density(a)
db <- density(b)
The problem is that da$x and db$x are different and so I have difficulties to
compare them... Is there any way to force the density
2011 Jun 27
1
Kernel Density Estimation at manually specified points
Hello,
my name is Carsten. This ist my first post to R-help mailing list.
I estimate densities with the function "density" out of the package
"stats".
A simplified example:
#generation of test data
n=10
z = rnorm(n)
#density estimation
f=density(z,kernel="epanechnikov",n=n)
#evaluation
print(f$y[5])
Here I can only evaluate the estimation at given
2008 Dec 11
2
how to get the CDF of a density() estimation?
Hi,
I've estimated a simple kernel density of a univariate variable with
density(), but after I would like to find out the CDF at specific
values.
How can I do it?
thanks for your help, with it I am very close to finish my first
little bit more serious work in R,
Viktor
2005 Oct 19
1
Problem with na in nls
I'm trying to run a nls on a subset of a data.frame.
In the subset, one observation is NA. So I drop the
observation but when I ask for :
>sm <- nls(machin$revcum ~
Lc.singh(machin$popcum,p), start=list(p=c(2,3)))
I get :
Erreur dans parse(file, n, text, prompt) : syntax
error in "~ "
If I put some value for the non available observation
instead of droping it, it works.