Displaying 20 results from an estimated 300 matches similar to: "Question on "assign(paste..""
2008 Apr 11
2
system.time gives error when "=" is used for assignment (R-2.6.0)
Hello list,
I found that system.time works correctly when I used "<-" to assign a
value to a variable but when I happened to use "=" instead of "<-", R
gave an error message:
"Error in system.time(your argument here...)". It happened with a few
functions I tried. Is this a bug or is there any circumstances that
"=" cannot be used for
2006 Jan 20
3
Troubles with the function rmultinom.c of the R's Random Number Generator
Hi,
I'm simulating a Markov chain in Fortran interfaced with R-2.2.1 in order
to generate data according to a Markov Random Field called the Potts model.
R Version:
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 2
minor 2.1
year 2005
month 12
day 20
svn rev 36812
Each loop of my Fortran calls the function rmultinom.c
2023 Apr 08
1
Error message for infinite probability parameters in rbinom() and rmultinom()
>>>>> Christophe Dutang
>>>>> on Sat, 8 Apr 2023 14:21:53 +0200 writes:
> Dear all,
> Using rmultinom() in a stochastic model, I found this function returns an error message 'NA in probability' for an infinite probability.
> Maybe, a more precise message will be helpful when debugging.
>> rmultinom(1, 3:5, c(1/2, 1/3,
2023 Apr 08
1
Error message for infinite probability parameters in rbinom() and rmultinom()
On 08/04/2023 5:53 p.m., Martin Maechler wrote:
>>>>>> Christophe Dutang
>>>>>> on Sat, 8 Apr 2023 14:21:53 +0200 writes:
>
> > Dear all,
>
> > Using rmultinom() in a stochastic model, I found this function returns an error message 'NA in probability' for an infinite probability.
>
> > Maybe, a more
2023 Apr 08
1
Error message for infinite probability parameters in rbinom() and rmultinom()
Dear all,
Using rmultinom() in a stochastic model, I found this function returns an error message 'NA in probability' for an infinite probability.
Maybe, a more precise message will be helpful when debugging.
> rmultinom(1, 3:5, c(1/2, 1/3, Inf))
Error in rmultinom(1, 3:5, c(1/2, 1/3, Inf)) : NA in probability vector
> rmultinom(1, 3:5, c(1/2, 1/3, NA))
Error in rmultinom(1,
2016 Mar 10
3
rmultinom.c error probability not sum to 1
Hi all,
I should have given a better explanation of my problem. Here it is.
I extracted from my code the bit that gives the error. Place this in a file called test.c
#include <math.h>
#include <R.h>
#include <Rmath.h>
#include <float.h>
#include <R_ext/Print.h>
int main(){
double prob[3] = {0.0, 0.0, 0.0};
double prob_tot = 0.;
prob[0] = 0.3*dnorm(2, 0,
2008 Mar 30
1
norm_rand() in R-extension vs rnorm in R ---which is better?
I need to generate good quality of random numbers from univariate
normal distribution for further transformation. I tried rnorm in R but
it was not good sometimes. Someone said C++ standard library or
Fortran's built-in functions for that are good. I found that there is
double norm_rand() in R-extension. Does this function, norm_rand()
use the same algorithm as rnorm in R or something similar
2008 May 05
1
Is there any way to find out how a certain functions are implemented in R?
Hello
I wrote a bootstrap program in C language that is called and run by R.
When I tried it, it is slow
and I'm trying to write and run the whole thing in C. But I cannot use
handy functions in R and
need to figure out how to write those functions by myself. Is there
any way that I can get the
actual codes that implement functions in R so that I can translate
them into other languages? For
2010 Sep 08
11
problem with outer
Hello,
i wrote this function guete and now i want to plot it: but i get this error
message. i hope someone can help me.
Error in dim(robj) <- c(dX, dY) :
dims [product 16] do not match the length of object [1]
p_11=seq(0,0.3,0.1)
p_12=seq(0.1,0.4,0.1)
guete = function(p_11,p_12) {
set.seed(1000)
S_vek=matrix(0,nrow=N,ncol=1)
for(i in 1:N) {
X_0=rmultinom(q-1,size=1,prob=p_0)
2009 Mar 19
1
object size of a matrix and a list
Hello,
My program calculates several variables at each iteration and some of them are
integers and the rest are numeric. When I save them into a matrix, all of them
are of numeric type, of course.
I'm trying to find a way to save time/memory of my program and I was thinking
that it might help to force some variables to be of integer type and the other
columns numeric type.
But when I
2009 Oct 10
0
installing any package fails using 'install.packages()' (PR#13996)
On 10 October 2009 at 05:25, lmramba at gmail.com wrote:
| Dear all,
| I installed my R-2.9.2 on my ubuntu version 9.04 successfully using=
the
| command
|=20
| sudo apt-get install r-base-dev
|=20
| The problem is that I cannot install any package.
Huh? This has _nothing_ to do with the error below.
=20
| See my details below:
|=20
|=20
|=20
| > install.packages("epicalc")
|
2016 Mar 10
2
rmultinom.c error probability not sum to 1
Dear all,
I have a questions regarding using the c function rmultinom.c.
I got the following error message "rbinom: probability sum should be 1, but is 0.999264"
Which is thrown by:
if(fabs((double)(p_tot - 1.)) > 1e-7)
MATHLIB_ERROR(_("rbinom: probability sum should be 1, but is %g"),
(double) p_tot);
I understand my probabilities do not sum to one close enough. I
2008 Apr 18
1
R-extension in unix system -- help to locate header files
Hi list,
To call C, I used to use R-extension in windows but I'm moving to unix system
because my PC doesn't have enough memory. My C codes requires to include the
following header files:
#include <stdlib.h>
#include <R.h>
#include <Rdefines.h>
#include <Rmath.h>
#include <R_ext/Applic.h>
#include <R_ext/PrtUtil.h>
In windows, I had no problem with it
2008 Nov 06
1
trouble with for loop
Hello,
I'm having two similar problems with for loop and I would appreciate
any help or comment.
I want to use "for loop" to calculate series of initial values for an
optimization problem. But
some initial values have my function quit due to problems like
calculating the inverse of singular
matrices. I don't want to make my program check determinants and skip it if it
is
2006 Dec 09
1
Error in rmultinom(n, size, prob) : too few positive probabilities
// R 2.3.1
Can someone please explain why this error returns?
> y=numeric(100)
> x=matrix(runif(16),4,4)
> for(i in 2:100)
+ {
+ y[i]=which(rmultinom(1, size = 1, prob = x[y[i-1], ])==1)
+ }
Error in rmultinom(n, size, prob) : too few positive probabilities
thx much
ej
2007 Mar 30
1
faster computation of cumulative multinomial distribution
Dear list members,
I have a series of /unequal/ probabilities [p1,p2,...,pk], describing
mutually exclusive events, and a "remainder" class with a probability
p0=1-p1-p2-....-pk, and need to calculate, for a given number of trials
t>=k, the combined probability that each of the classes 1...k contains
at least 1 "event" (the remainder class may be empty).
To me this reaks
2011 Nov 07
3
Sampling with conditions
Hey everyone,
I am at best, an amateur user of R, but I am stuck on how to set-up the
following situation.
I am trying to select a random sample of numbers from 0 to 10 and insert
them into the first column of a matrix (which will used later in a loop).
However, I need to have those numbers add up to 10. How can I set those
conditions?
So far I have:
n<-matrix(0,nr=5,ncol=10)
for(i in
2008 May 04
1
help with segmentation fault
Hello all,
I'm trying to have C called by R. I wrote C codes that worked
perfectly fine with R-2.6.0 in
windows system ( using R tools).
I had to change to SuSE Linux (this system has 3.2 GHz Intel
Xeon processors and 4 GB of RAM), the C codes were compiled okay but
when it was called to R-2.6.2, I got
error mesage :
***caught segfault***
address 0x1df5000, cause 'memory not
2008 Apr 08
1
Using Rtools in Unix environment
The previous mail I wrote was bounced for some reason and I'm writing
it again...
I have used Rtools in windows to call C from R but my computer does
not have enough memory for my current project. So I'm trying to use
Rtools in the high performance computer at my school. The guy who
handles the HPC says it's Unix and I have three questions:
1. I found from the web that Unix has
2011 Apr 15
1
How to generate a correlation matrix with restrictions on its eigenvalues
Dear All,
I would like to generate m positive real numbers c_i, I=1,...,m, such that
(1) c_1 + c_2 + ... + c_m=m,
(1) after being ordered into c_1 >= c_2 >= .... >=c_m>0, we have that c_m is of the same order of m^(-1/8), when m is sufficiently large.
Thanks,
-Chee
[[alternative HTML version deleted]]