similar to: how to get vector of data from line ?

Displaying 20 results from an estimated 7000 matches similar to: "how to get vector of data from line ?"

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
2010 Dec 07
4
increase or decrease variable by 1
many languages have shorthands for that operation like: variable += 1 or ++variable is there something like that in R ? -- View this message in context: http://r.789695.n4.nabble.com/increase-or-decrease-variable-by-1-tp3076390p3076390.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
2012 Mar 09
1
nonparametric densities for bounded distributions
Can anyone recommend a good nonparametric density approach for data bounded (say between 0 and 1)? For example, using the basic Gaussian density approach doesn't generate a very realistic shape (nor should it): > set.seed(1) > dat <- rbeta(100, 1, 2) > plot(density(dat)) (note the area outside of 0/1) The data I have may be bimodal or have other odd properties (e.g. point mass
2010 Nov 21
3
how to get rid of unused space on all 4 borders in plot() render
x= c(1,5,7,-3,4) y= c(2,4,-5,2,5) plot(x,y,ylim=c(-20,20),xlim=c(min(x),max(x)),pch='X',col = rgb(0, 0, 0, 0.5),yaxt="n", ann=FALSE) and this code produces: http://i53.tinypic.com/ffd7d3.png Where I marked in red areas that I want to get rid of and use as much real screen estate as I can. -- View this message in context:
2010 Nov 21
8
[beginner] simple keyword to exit script ?
I have tried quit(), and return() but first exits from whole graphical interface and second is only for functions. What I need only to exit from current script and return to the console. -- View this message in context: http://r.789695.n4.nabble.com/beginner-simple-keyword-to-exit-script-tp3052417p3052417.html Sent from the R help mailing list archive at Nabble.com.
2007 Apr 02
3
Random number from density()
Hello, I'm writing some genetic simulations in R where I would like to place genes along a chromosome proportional to the density of markers in a given region. For example, a chromosome can be presented as a list of marker locations: Chr1<-c(0, 6.5, 17.5, 26.2, 30.5, 36.4, 44.8, 45.7, 47.8, 48.7, 49.2, 50.9, 52.9, 54.5, 56.5, 58.9, 61.2, 64.1) Where the numbers refer to the locations of
2009 Nov 05
5
Density estimate with bounds
Dear R users, I would like to show the estimated density of a (0, 1) uniformly distributed random variable. The density curve, however, goes beyond 0 and 1 because of the kernel smoothing. Example: x = runif(10000) plot(density(x)) Is there a way to estimate the density curve strictly within (0, 1) and still use some sort of smoothing? Any help would be greatly appreciated. Best regards,
2012 Jun 27
2
density function
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.com/density-function-tp4634563.html Sent from the R help mailing list archive at Nabble.com.
2008 Aug 29
3
Density estimates in modelling framework
Hi all, Do any packages implement density estimation in a modelling framework? I want to be able to do something like: dmodel <- density(~ a + b, data = mydata) predict(dmodel, newdata) This isn't how sm or KernSmooth or base density estimation works. Are there other packages that do density estimation? Or is there some reason that this is a bad idea. Hadley -- http://had.co.nz/
2012 May 17
1
oldlogspline probabilities
I using oldlogspline (from logspline package) to model data distributions, and having a problem. My data are search area sizes. They are based on circular search radii from random points to the nearest edge of the nearest grass tussock. Search area sizes are distributed from 0 (the random point intercepts a tussock) and upwards (as points are further from any tussocks). The density of all my
2012 Oct 01
3
calculating probability from the density function
Hello, I have a data x with normal (or very close to normal) distribution, I can plot a density distribution with density(x,...). My question is is there any way to calculate an area under this distribution (=probability) for particular range of x values, let's say for x from 0 to 2? I was not able to find any kind of simple procedure to do this. Thanks in advance for your help, Evgeny.
2003 Jan 13
2
density estimation
I've been trying to figure this out for a while, but my knowledge of R is obviously still too limited. The context is as follows: I have some time series, and I would like to estimate their densities, and then use the actual densities in a monte carlo simulation. Now, I can easily estimate the density using density(); I can write a random number generator to fit an arbitrary density
2005 Jun 15
3
how to plot density distribution with a arrow pointer?
Hi all, for example: > X<- rnorm(1000) > X0 <- 0.899 I want to draw a density distribution plot with a arrow pointer indicating the position of X0, meanwhile, giving out the p-value. any functions? Thanks very much.
2012 Jul 11
2
Computing inverse cdf (quantile function) from a KDE
Hello, I wanted to know if there is a simple way of getting the inverse cdf for a KDE estimate of a density (using the ks or KernSmooth packages) in R ? The method I'm using now is to perform a numerical integration of the pdf to get the cdf and then doing a search for the desired probablity value, which is highly inefficient and very slow. Thanks, -fj [[alternative HTML version deleted]]
2005 Jul 21
1
About object of class mle returned by user defined functions
Hi, There is something I don't get with object of class "mle" returned by a function I wrote. More precisely it's about the behaviour of method "confint" and "profile" applied to these object. I've written a short function (see below) whose arguments are: 1) A univariate sample (arising from a gamma, log-normal or whatever). 2) A character string
2011 Sep 30
1
Implementing Silverman's Negative Reflection
Hi! I'm trying to implement in R in an easy way the negative reflection method described in Silverman (1986) on p.31, ie I have a non-negative dataset and would like to estimate the density by applying a reflection method where the reflected points have weight -1. I thought there should be a way to evaluate the wanted kernel at the required points, in other words to calculate formula (2.16):
2003 May 08
2
approximation of CDF
Hi all, is there any package in R capable of smooth approximation of CDF basing on given sample? (Thus, I am not speaking about ecdf) In particular, I expect very much that the approximation should subject to the property: f(x0)<=f(x1) for x0<x1, where x0 and x1 belong to range of the sample given. Polynomial approximation could be OK for me as well. P.S.
2010 Jan 27
1
returning a list of functions
Hi interested readers, I have a function that creates several functions within a loop and I would like them to be returned for further use as follows: Main.Function(df,...){ # df is a multivariate data funcList<-list(NULL) for (i in 1:ncol(df)){ temp<-logspline(df[,i],...) # logspline density estimate funcList[[i]]<-function(x){expression(temp,x)} } return(funcList) } I have tried
2010 Dec 07
2
longer object length is not a multiple of shorter object length
In datamatrix[, "y"] == datamatrix[, "y"][-1] : longer object length is not a multiple of shorter object length out = c(FALSE,datamatrix[,'y'] == datamatrix[,'y'][-1]) and I do not know why I get that error, the resulting out matrix is somehow one row larger than datamatrix... all I try to do is filter matrix by dropping rows where [,'y'][-1] ==