similar to: help with population matrix

Displaying 20 results from an estimated 4000 matches similar to: "help with population matrix"

2012 Apr 26
2
Subsetting dataframe with missing values
Dear R-community, I am using R (V 2.14.1) on Windows 7. I have a dataset which consists of 19 variables for 91 individuals or rows. Two of my variables are Age (adult/chick, with no NA values) and Sex (0 for females/1 for females, with quite a few NA values). The sex of many adult birds is unknown (entered as NA in dataframe). At some point of my analyses, I happen to need to need to work with
2008 Mar 22
1
Simulating Conditional Distributions
Dear R-Help List, I'm trying to simulate data from a conditional distribution, and haven't been able to modify my existing code to do so. I searched the archives, but didn't find any previous post that matched my question. n=10000 pop = data.frame(W1 = rbinom(n, 1, .2), W2 = runif(n, min = 3, max = 8), W3 = rnorm(n, mean=0, sd=2)) pop = transform(pop, A = rbinom(n, 1,
2002 Mar 13
2
Strange encoding issue
If this is not the proper list for this type of question, please direct me to the correct one and I'll post similar queries there in the future. I've been happily using rc3 since shortly after its release and slowly converting the music collection on my PC from mp3 to ogg. I've now run into a problem that has me stumped. On the 2nd track of The Breeders _Last Splash_ album, the
2000 Feb 17
2
bug in rbinom? (PR#448)
# Your mailer is set to "none" (default on Windows), # hence we cannot send the bug report directly from R. # Please copy the bug report (after finishing it) to # your favorite email program and send it to # # r-bugs@biostat.ku.dk # ###################################################### In version 0.99.0 for Windows NT I get the following: > .Random.seed [1] 0 21012
2008 Aug 21
3
[help] simulation of a simple Marcov Stochastic process for population genetics
Hi, this is my first time using R. I want to simulate the following process: "in a population of size N, there are i individuals bearing genotype A, the number of those bearing A is j in the next generation, which following a binominal distribution (choose j from 2*N, the p is i/2*N), to plot the probability of the next generations, my script is as follows. It cannot run successfully,
2010 Jun 23
1
Generation of binomial numbers using a loop
Dea'R' helpers I have following data - prob = c(0.1, 0.2, 0.3, 0.4, 0.5) frequency = c(100, 75, 45, 30, 25) no_trials = c(10, 8, 6, 4, 2) freq1 = rbinom(frequency[1], no_trials[1], prob[1]) freq2 = rbinom(frequency[2], no_trials[2], prob[2]) freq3 = rbinom(frequency[3], no_trials[3], prob[3]) freq4 = rbinom(frequency[4], no_trials[4], prob[4]) freq5 = rbinom(frequency[5],
2005 Apr 02
2
Solaris10/amd64 + SunSutio Compile (PR#7767)
Full_Name: Teru KAMOGASHRIA Version: 2.0.1 OS: SunOS sun 5.10 Generic i86pc i386 i86pc Submission from: (NULL) (219.5.176.24) rbinom.c cannot be compiled because of the casting problem. /opt/SUNWspro/bin/cc -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -D__NO_MATH_INLINES -g -c rbinom.c -o rbinom.o "rbinom.c", line 60: operand must have real
2006 Sep 20
1
Simulation help
I'm trying to simulate trend data over a five year period. I want different trend profiles...the simplest being a linear trend. I've been using the following code: patBdta1 <- NULL for(i in 1:100) patBdta1 <- rbind(patBdta1,c(yr1= mean(rbinom(50,1,.50)), yr2 =mean(rbinom(50,1,.51)), yr3 =mean(rbinom(50,1,.52)),
2012 Jan 04
5
a quick question about "rbinom"
Hello, I have the following code using rbinom, but I don't understand what *"+1"* means in the code. Could someone help? Thanks so much, > X1<-c("A","B")[rbinom(n,1,0.6)+1] > X2<-c("C","D")[rbinom(n,1,0.1)+1] -- View this message in context: http://r.789695.n4.nabble.com/a-quick-question-about-rbinom-tp4262977p4262977.html Sent
2012 Aug 07
2
Passing arguments to a function within a function ...
Hallo Everybody How do you specify arguments for a function used within another function? Here is my problem: I am reconstructing a calculator for the burden of disease due to air pollution from publications and tools published by the WHO. The calculations make use of published dose-response relationships for particular health end-points. This is then applied to populations with known or
2012 Jun 18
6
Trying to speed up an if/else statement in simulations
Dear R-help, I am trying to write a function to simulate datasets of size n which contain two time-to-event outcome variables with associated 'Event'/'Censored' indicator variables (flag1 and flag2 respectively). One of these indicator variables needs to be dependent on the other, so I am creating the first and trying to use this to create the second using an if/else statement.
2007 Oct 17
3
how to repeat the results of a generated probabilities
hello, I want to simulate 200 times the mean of a joint probability (y1) and 200 times the mean of another joint distribution (y2), that is I'm expecting to get 200 means of y1 and 200 means of y2. y1 and y2 are probabilities that I calculate from the marginal prob. (z1 and z2 respectively) multiple by the conditional prob. (x1 and x2 respectively), which I generaterd from the binomial
2010 Feb 17
1
lapply to apply a function using a vector
Hi, First, thank you all for your help. Here is my problem (simplified): Say I have a list: a=list(matrix(50,nrow=5,ncol=5),matrix(25,nrow=5,ncol=5),matrix(10,nrow=5,ncol=5)) I'd like to use rbinom with a different probability for each matrix. I tried: b=c(.8,.1,.9) brep=rep(b,each=25) lapply(a,function(a) rbinom(25,a,brep)) but that doesn't work-- it just uses the first value of b
2008 Sep 09
2
naive variance in GEE
Hi, The standard error from logistic regression is slightly different from the naive SE from GEE under independence working correlation structure. Shouldn't they be identical? Anyone has insight about this? Thanks, Qiong a<-rbinom(1000,1) b<-rbinom(1000,2,0.1) c<-rbinom(1000,10,0.5) summary(gee(a~b, id=c,family="binomial",corstr="independence"))$coef
2005 Aug 16
2
quirky behavior from rbinom (PR#8071)
Full_Name: Chris Paulse Version: 2.1.1 OS: WinXP Submission from: (NULL) (129.98.60.134) This seems strange. I have a small block of code that repeatedly calls rbinom. I put a break in there in case it returns NaN, as I've been having problems with this. Here is a transcript from the debug session: Browse[1]> theP [1] 1 Browse[1]> yleft[dataIndex] [1] 3 Browse[1]> rbinom(1,3,1)
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,
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
2001 Dec 02
1
bug in rbinom? (PR#1190)
Full_Name: Kert Viele Version: 1.3 OS: Windows ME and 2000 Submission from: (NULL) (65.6.218.65) Hello! Thanks for all your efforts on R. They are appreciated! I was simulating the central limit theorem in class, but found that repeated use of mean(rbinom(100000,500,0.4)) resulted in values less than 200 (the expected mean), for example > mean(rbinom(100000,500,0.4)) [1] 199.0294 >
2005 Feb 28
2
A problem about outer()
Dear all, I have something about function outer() that I can't understand. Just see the following example. The two NaNs are due to 0/0, but I can't figure out the cause of the last two errors. I wonder if some one can explain this for me. ___________________________________________________________________ > sx=rbinom(10,1,0.5);ot=rbinom(10,1,0.5);ag <- rbinom(10,100,0.3);ho <-
2013 May 21
2
problem with "transform" and "get" functions
Hello, I'm having a problem using the "transform" and "get" functions. I'm probably making a dumb mistake, and I need help! I start by making a small simulated dataset. I save the names of the variables in "var.names." Without getting into the details of it, I have to create a custom function to perform some statistics. As part of this, I need to sequentially