search for: nbin

Displaying 20 results from an estimated 75 matches for "nbin".

Did you mean: bin
1999 Apr 03
2
tabulate causes segmentation fault (PR#156)
Peter, I thought this one was noted and fixed, but I could be wrong. R : Copyright 1999, The R Development Core Team Version 0.63.3 (March 6, 1999) .... [Previously saved workspace restored] > tabulate(1:10, 5) Process R:1 segmentation fault at Sat Apr 3 17:48:34 1999 -- (The following contact details become official on 1 May 1999, but the email
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 the rows o...
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
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);
2011 Mar 19
2
persuade tabulate function to count NAs in a data frame
...s occurring in columns 'b' to 'e' but considering the fact at the very same time that these distributions should be 'groupped by' the id numbers in column 'id'. It works fine, check it -> matrix(matrix(unlist(lapply(df[,(-(1))],function(x) tapply(x,df$id,tabulate,nbins=nlevels(factor(df[,2])))) [[1]])),ncol=3,nrow=3,byrow=TRUE) matrix(matrix(unlist(lapply(df[,(-(1))],function(x) tapply(x,df$id,tabulate,nbins=nlevels(factor(df[,3])))) [[2]])),ncol=3,nrow=3,byrow=TRUE) matrix(matrix(unlist(lapply(df[,(-(1))],function(x) tapply(x,df$id,tabulate,nbins=nlevels(factor...
2010 Apr 16
2
how to change the position of xlab in truehist?
...first delete xlab and then add marks myself, but it doesn't look like it's working. The old label can not be removed by setting xlab="" or xlab = NULL. Thanks for your help! Hua #------------------------ x = c(rep(0,10),rep(1,100),rep(2,50), rep(3,30)) library(MASS) truehist(x,nbins=4) truehist(x,nbins=4,xlab="")
2006 Feb 06
2
panel.levelplot() for 2D histograms
...y=rnorm(3000),group=rep(factor(c("A","B","C")), 1000)) # this binscatter-function shows what I want, # I just would like to have it as a panel function binscatter<-function(x,y){ col<-rev(gray.colors(5)) breaks=c(1,5,10,100,500,100000) h2d<-hist2d(x=x,y=y,nbins=10,same.scale=T,show=F) image(h2d$x,h2d$y,h2d$counts,breaks=breaks,col=col,axes=T) } # for one group, this works fine A<-subset(ds,group=="A") binscatter(A$x,A$y) # simple xyplot does too (of course) xyplot(y~x|group,data=ds) # but my lattice-ified version of binscatter does not:...
2004 Oct 20
2
apply function
...on. Is that possible to pass some non-default arguments in the function we want to apply ? For example: if "mat" is a matrix and I want to use the "tabulate" function on its row. The command apply(mat,1,tabulate) works but I have problem with this one apply(mat, 1, tabulate(nbins=4)). Any clue ? Thanks, Eric -- Eric Pellegrini, PhD Computer-Chemie-Centrum University of Erlangen-N??rnberg N??gelbachstra??e, 25 D-91052 Erlangen Germany
2006 Feb 18
1
truncated negative binomial using rnegbin
...ed) that will do such a thing: # # Function to generate a vector containing values from a truncated # negative binomial distribution (i.e., no zeros). Select desired # mean and variance, sample size, initial values for mean and theta, # and a threshold value for tests. # # format: out<-nbin(desired_mean, desired_variance, n, initial_mean, # theta, threshold_level) # # example: out<-nbin(2, 1, 100, 2, 2, 0.1) # # nbin<-function(mu.s,var.s,n,mu.i,theta,test) { library(MASS) mu<-0 var<-0 rand<-rep(0,n) while(abs(mu.s-mu)>=test &...
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
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
2003 Sep 24
3
density() integrates to 1?
Visual inspection of the plot of a density() function vs a normal with the same mean and variance suggests the area under the density curve is bigger than under the normal curve. The two curves are very close over most of the domain. Assuming the normal curve does integrate to 1, this implies the area under density() is > 1. Is there any assurance that the density kernel smoother produces
2006 Apr 05
1
Bin by bin histogram comparisons
Hello, I have created two histograms with: hist2d(gps2, nbins=200, col = c("white",heat.colors(16))) Both of them have the same range and the same number of bins. Now I would like to compare them bin by bin and plot the results. Could someone please tell me how to do that. I searched the man pages and the web, but couldn't find anything. Than...
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]]
2007 Oct 12
2
Automating binning for chisq.test()
The standard chisq.test() and fisher.test() functions, when applied to two distributions (to determine whether the same underlying distribution applies to both) requires one to pre-bin the distributions. Is there a library function (either built-in or in a package) that acts more like the ks.test() function, in that one can simply pass the two distributions and have it do the necessary binning as
2010 Apr 13
2
how to work with big matrices and the ff-package?
...I need to convert my ff_matrix to a data.frame to discretize the whole matrix and calculate the mutual information. The calculated result should be saved as an ffdf-object or something similar. require(infotheo) disc <- as.ffdf(discretize(as.data.frame(as.ffdf(cc)), disc="equalwidth", nbins=5)) This won't work. After this step it somehow loses the path to the working directory. As soon as I try to discretize the next data.frame I get the following message: Error in if (dfile == getOption("fftempdir")) finalizer <- "delete" else finalizer <- "close&...
2012 Jun 14
2
density plot on a log scale
...,10000000000), log="xy", pch="." ) the output seems to only show a few of the points, and they are in odd places that don't seem to correlate at all with the colors. I got a warning that I should increase the gridsize, but even using comically large values (nbin=10000) didn't help. Does anybody know how I can do this? Thanks! -- View this message in context: http://r.789695.n4.nabble.com/density-plot-on-a-log-scale-tp4633347.html Sent from the R help mailing list archive at Nabble.com.
2005 Jan 14
3
summing subsets of rows matrices
I have a large data matrix (4460X3500) and I want to sum row subsets in groups of 10 (bin). Is there an efficient way to do this in R without using loops. Looping takes forever to perform this task! For example suppose we have the matrix > matrix(1:12,6,2) [,1] [,2] [1,] 1 7 [2,] 2 8 [3,] 3 9 [4,] 4 10 [5,] 5 11 [6,] 6 12 my problem is to sdum for
2011 Jan 16
3
rootogram for normal distributions
Using R-2.12.1 and latticeExtra-0.6-14, I would like to understand why a rootogram displaying samples from the Poisson distribution looks like I expected it, whereas a rootogram using the normal distribution does not: library(latticeExtra) rootogram(~rpois(1000, lambda = 50), dfun = function(x) dpois(x, lambda = 50)) rootogram(~rnorm(1000), dfun = function(x) dnorm(x,mean(x),sd(x))) I
2002 Jan 18
1
New R on Mac user fails to run MASS
My R installation (Mac OS9.2.2) is working, but when I try to run the examples from Venables & Ripley (p. 6): R : Copyright 2001, The R Development Core Team Version 1.4.0 (2001-12-19) ... > library(MASS) > x<-rnorm(1000) > y<-rnorm(1000) > truehist(c(x,y+3),nbins=25) % Plots nicely > dd<-con2tr(kde2d(x,y)) % Doesn't complain > contourplot(z ~ x + y, data=dd,aspect=1) Error: couldn't find function "contourplot" > wireframe(z ~ x + y, data=dd,drape=T) Error: couldn't find function "wireframe" > -- ===...