Displaying 20 results from an estimated 10000 matches similar to: "error in using sample( )"
2006 Dec 30
2
Error: cannot take a sample larger than the population
Hi,
In Splus7 this statement
xlrmN1 <- sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ))
worked fine, but in R the interpreter reports that the length of the
vector to chose c(0,1,2) is shorter than the size of many times I want
to be selected from the vector c(0,1,2).
Any good reason?
See below the error.
> xlrmN1 <- sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ))
Error in
2010 Jan 13
2
Simulation numbers from a probability table
Dear friends,
If I have a table like this, first row A B C D ... are different
levels of the variable, first column 0 1 2 4 ... are the levels of the
"numbers", the numbers inside the table are the probabilities of the
"number" occuring.
A B C D ...
0 0.2 0.3 0.1 0.05
1 0.1 0.1 0.2 0.2
2 0.02 0.2 0 0.1
4 0.3 0.01 0.01
2006 Feb 03
5
pbinom with size argument 0 (PR#8560)
Full_Name: Uffe H?gsbro Thygesen
Version: 2.2.0
OS: linux
Submission from: (NULL) (130.226.135.250)
Hello all.
pbinom(q=0,size=0,prob=0.5)
returns the value NaN. I had expected the result 1. In fact any value for q
seems to give an NaN. Note that
dbinom(x=0,size=0,prob=0.5)
returns the value 1.
Cheers,
Uffe
2019 Jun 23
2
Calculation of e^{z^2/2} for a normal deviate z
I agree with many the sentiments about the wisdom of computing very
small p-values (although the example below may win some kind of a prize:
I've seen people talking about p-values of the order of 10^(-2000), but
never 10^(-(10^8)) !). That said, there are a several tricks for
getting more reasonable sums of very small probabilities. The first is
to scale the p-values by dividing the
2009 Oct 29
2
sample weight for box plot?
Hi,
I would like to make a box and whisker plot but use a sample weight for each
observation. I've searched around a bit and have not found a method of
doing this.
Anyone have any advice?
Thanks much,
Sean Parks
--
View this message in context: http://www.nabble.com/sample-weight-for-box-plot--tp26104205p26104205.html
Sent from the R help mailing list archive at Nabble.com.
2007 Aug 15
1
Errors from dovecot 1.1
I downloaded and installed dovecot 1.1 nightly build yesterday. Here is a
the errors I collected from the log file.
dovecot: Aug 15 14:19:29 Error: IMAP(use at doamin): Log synchronization error
at seq=7,offset=24 for /data2/mail/we/webmail.us/ji/jing/dovecot.index:
Extension introduction for unknown id 2
dovecot: Aug 15 14:19:29 Error: IMAP(use at doamin): Log synchronization error
at
2012 Feb 20
3
How to determine a subset of a binary strings?
Hi,
I need some neat ways of determing a subset of binary strings. For example,
x=c(0,0,1), y=c(0,1,1), z=c(0,1,0). So x is a subset of y and z is also a
subset of y, but x is not a subset of z.
I tried to search R functions and packages but no hits. Any ideas?
Best,
Jing
--
Jing Tang, PhD
Senior Researcher
Finnish Institute of Molecular Medicine (FIMM)
FI-00014 University of
2019 Jun 21
4
Calculation of e^{z^2/2} for a normal deviate z
You may want to look into using the log option to qnorm
e.g., in round figures:
> log(1e-300)
[1] -690.7755
> qnorm(-691, log=TRUE)
[1] -37.05315
> exp(37^2/2)
[1] 1.881797e+297
> exp(-37^2/2)
[1] 5.314068e-298
Notice that floating point representation cuts out at 1e+/-308 or so. If you want to go outside that range, you may need explicit manipulation of the log values. qnorm()
2010 Apr 23
2
Deferred Default Marker
I've finally narrowed down a puzzling problem: here is the short test
case.
tmt34% R --vanilla
R version 2.10.0 (2009-10-26)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
> temp <- matrix(runif(50), ncol=2)
> t(temp) %*% temp
[,1] [,2]
[1,] 7.916016 6.049698
[2,] 6.049698 7.650694
> library(kinship)
Loading required package:
2005 May 19
1
R from Perl -- RSPerl and lines function.
Dear R-helpers,
I am running well Perl and R on my Debian Linux, and I tried RSPerl.
Installation is ok and all simple functions run well. But I have a
problem to call the "lines" function.
I would like to draw an histogram with the density curve on. Is is OK
in R with the command:
>x<-rnorm(1000)
>hist(x,prob=T)
>lines(density(x))
for example.
Now, I have a Perl script
2019 Jun 24
2
Calculation of e^{z^2/2} for a normal deviate z
>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:
>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:
> include/Rmath.h declares a set of 'logspace' functions for use at the C
> level. I don't think there are core R functions that call
2002 Mar 08
2
? about sample
i am trying to use the
sample command and have one question about it:
i am getting the error
Error in sample(length(x), size, replace, prob) :
insufficient positive probabilities
when i use something like:
sample (1:4, prob=c(0,0,1,0))[1]
i was expecting that to return a 3 every time
while this is not exactly what i am using it for, i need the capabilities to
deal with zeros (as the
2004 Nov 02
3
n-th power of a matrix
Hello all,
To calculate the power of a matrix, I used the command "mtx.exp(X, n)", but
there is an error saying "Error: couldn't find function "mtx.exp"". How can
I deal with this problem?
Jing
2019 May 30
2
use of buffers in sprintf and snprintf
Hi again,
I realised it is useful to replicate the warnings locally without relying on CRAN automatic check; instead of R(-devel) CMD check --as-cran package_version.tar.gz one can use
R CMD check --configure-args=""
and in my case the WARNINGS were initially given with https://www.stats.ox.ac.uk/pub/bdr/gcc9/README.txt and those specification might as well used in --configure-args
2010 Jun 20
1
proposed change to 'sample'
There is a weakness in the 'sample'
function that is highlighted in the
help file. The 'x' argument can be
either the vector from which to sample,
or the maximum value of the sequence
from which to sample.
This can be ambiguous if the length of
'x' is one.
I propose adding an argument that allows
the user (programmer) to avoid that
ambiguity:
function (x, size, replace
2011 Jul 31
4
Error in plotmath
Under
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 2
minor 13.1
year 2011
month 07
2019 Jun 21
4
Calculation of e^{z^2/2} for a normal deviate z
Hello,
Well, try it:
p <- .Machine$double.eps^seq(0.5, 1, by = 0.05)
z <- qnorm(p/2)
pnorm(z)
# [1] 7.450581e-09 1.228888e-09 2.026908e-10 3.343152e-11 5.514145e-12
# [6] 9.094947e-13 1.500107e-13 2.474254e-14 4.080996e-15 6.731134e-16
#[11] 1.110223e-16
p/2
# [1] 7.450581e-09 1.228888e-09 2.026908e-10 3.343152e-11 5.514145e-12
# [6] 9.094947e-13 1.500107e-13 2.474254e-14 4.080996e-15
2019 Mar 03
2
bug: sample( x, size, replace = TRUE, prob= skewed.probs) produces uniform sample
When `length( skewed.probs ) > 200' uniform samples are generated in R-devel.
R-3.5.1 behaves as expected.
`epsilon` can be a lot bigger than illustrated and still the uniform distribution is produced.
Chuck
> set.seed(123)
>
> epsilon <- 1e-10
>
> ## uniform to 200 then small
> p200 <- prop.table( rep( c(1, epsilon), c(200, 999-200)))
> ## uniform to 201
2010 Feb 12
1
Using seq_len() vs 1:n]
Pat Burns makes a good point. -Peter
-------- Original Message --------
Subject: Re: [R] Using seq_len() vs 1:n
Date: Fri, 12 Feb 2010 09:01:20 +0000
From: Patrick Burns <pburns at pburns.seanet.com>
To: Peter Ehlers <ehlers at ucalgary.ca>
References: <4B746AEF.10900 at ucalgary.ca>
If you want your code to be compatible with
S+, then 'seq_len' isn't going to work.
2024 Apr 16
1
read.csv
?s 11:46 de 16/04/2024, jing hua zhao escreveu:
> Dear R-developers,
>
> I came to a somewhat unexpected behaviour of read.csv() which is trivial but worthwhile to note -- my data involves a protein named "1433E" but to save space I drop the quote so it becomes,
>
> Gene,SNP,prot,log10p
> YWHAE,13:62129097_C_T,1433E,7.35
> YWHAE,4:72617557_T_TA,1433E,7.73
>