similar to: simulating outcomes - categorical distribution (?)

Displaying 20 results from an estimated 2000 matches similar to: "simulating outcomes - categorical distribution (?)"

2007 Aug 17
4
matching elements from two vectors
Hi, Imagine a vector x with elements (1,2,1,1,3,5,3,3,1) and a vector y with elements (2,3). I need to find out what elements of x match any of the elements of y. Is there a simple command that will return a vector with elements (F,T,F,F,T,F,T,T,F). Ideally, I would like a solution that works with dataframe colums as well. I have tried x==y and it doesn't work. x==any(y) doesn't work
2010 Aug 20
3
change object name within for loop
Hi, I am writing a for loop that creates one object, say 'outn' on every round of the loop. I would like the name of each object to include the index of the loop as in, for example: out1, out2, out3, ... And I would like the naming of the object to take place automatically as the loop moves through? Similarly, I would like to be able to call different objects (in1, in2, in3,
2008 Mar 13
2
joining matrices, vectors, scalars in one object
Hi, I have: a <- matrix(c(0,1,0,1),nrow=2) b <- matrix(c(1,1,1,0,0,0),nrow=3) c <- 1 d <- c(1,0,1) And I would like to join them in an object 'thing' so that I can access a, b, c, or d through an index in a for loop. For example: thing[4] would return [1] 1 0 1 Note however, that I have many of these 'thing' components. So many that a command like thing
2007 Aug 17
1
finding the row(s) for a date in a data frame
Hi, If I have a data frame A with the following format: Day1 Day2 Day3 Day4 1 1979-11-02 1979-11-03 1979-11-04 <NA> 2 1979-12-06 <NA> <NA> <NA> 3 1979-12-13 1979-12-14 1979-12-15 1979-12-16 4 1979-12-20 <NA> <NA> <NA> And a date "1979-12-14", for
2004 Aug 13
2
lapply problem
R-help, I wish to replace NULL elements(or missing) in the following list : > z2 $cod mean sd 62.56190 12.65452 $haddock mean sd 36.61490 11.50365 $ling mean sd 86.17949 20.43587 $saithe mean sd 50.275847 5.453606 $whiting NULL $"norway pout" mean sd 13.739623 1.393104 $"great silver smelt" mean
2007 Aug 21
2
extracting month from date in numeric form
Hi, Anyone knows what would be a short way of extracting a month from a date in numeric or integer format? months("1979-12-20") returns "December" in character format. How could I get 12 in numeric or integer format? Thanks! G. [[alternative HTML version deleted]]
2012 Nov 08
4
Accessing selected elements of a list
Hi, If I have a vector: junk <- c(2,0,0,3,0) and want to access, say, all the elements that are greater than zero. I just do: junk[which(junk>0)] Now, If I have a list: jlist <- list(NULL,c(1,0),NULL,c(1,2,3), NULL) and want to access all the elements that have length greater than zero, I know how to find the elements with: which(sapply(jlist,length)>0) But how do I get a
2011 May 04
1
bivariate linear interpolation
Hi, I have three matrices (X,Y,P) with the same dimension. The X,Y grid is regular and I want to perform linear interpolation to pick out certain points. In matlab appropriate call is something like Pout=interp2(X,Y,P,Xout,Yout, method="linear") where Xout and Yout are the locations where I want the Pout data (typically a different grid). (Scipy has this routine in
2008 Mar 15
3
locating minimum value in matrix
Hi, I have a matrix BEE and want to find the row and column numbers of the minimum value in that matrix. The command which(BEE==min(BEE)) returns only one value which, I take, is the position of the minimum in a vector with as many elements as the matrix. Is there a quick and simple way of getting row and column numbers? Thanks, Gonçalo [[alternative HTML version deleted]]
2011 Sep 08
3
Density function: Area under density plot is not equal to 1. Why?
Hi, I have a vector 'data' of 58 probability values (bounded between 0 and 1) and want to draw a probability density function of these values. For this, I used the commands: data <- runif(58) a <- density(data, from=0, to=1) plot(a, type="l",lwd=3) But then, when I try to approximate the area under the plotted curve with the command: area <- sum(a$y)*(a$x[1]-a$y[2])
2001 Nov 30
1
graphics device updating (PR#1189)
Hi problem: plot(xxx) results in the graphics device window adding the axes values for what ever xxx is but failing to actually add lines or produce the plot until the consol window is activated and moved over the graphics window. The graphics window then shows what has been plotted. This started happening 4 days ago, up until that time plot(xxx) would produce the plot on the graphics device
2012 Jan 11
2
Vegan(ordistep) error: Error in if (aod[1, 5] <= Pin) { : missing value where TRUE/FALSE needed
I am getting the following erro rmessage in ordistep. I have a number of similarly structured datasets using ordistep in a loop, and the message only occurs for some of the datasets. I cannot include a reproducible sample - the specific datasets where this is occur ing are fairly large and there are several pcnm's in the rhs of the formula. thanks for any pointers that may allow me to
2008 Jan 27
1
calling a list element from a list name passed to a function
Hi, 'true_name' is a list of numerical, matrix, and text items I do pass_name <- "true_name" and pass the name of the list to a function so that the character class variable 'passed_name' contains the name of the list called 'true_name' Inside the function, how can I get a specified element from the list? For example, if I want to get
2007 Oct 15
2
clipping off words inside a vector of strings
Hi, I have a vector of strings (class character) with 6 elements (length 6). I call it 'names'. "Graham Chapman" "John Cleese" "Terry Gilliam" "Eric Idle" "Terry Jones" "Michael Palin" And I want to turn it into another vector of strings called 'shortnames' with the same length. The new vector should look like:
2007 Jun 10
1
R logistic regression - comparison with SPSS
Dear R-list members, I have been a user of SPSS for a few years and quite new to R. I read the documentation and tried samples but I have some problems to obtain results for a logistic regression under R. The following SPSS script LOGISTIC REGRESSION vir /METHOD = FSTEP(LR) d007 d008 d009 d010 d011 d012 d013 d014 d015 d016 d017 d018 d069 d072 d073 /SAVE = PRED COOK SRESID
2010 Aug 13
1
different outcomes of P values in SPSS and R
I have been using generalized linear models in SPSS 18, in order to build models and to calculate the P values. When I was building models in Excel (using the intercept and Bs from SPSS), I noticed that the graphs differed from my expectations. When I ran the dataset again in R, I got totally different outcomes for both the P values as well as the Bs and the intercepts. The outcomes of R seem much
2004 Aug 06
0
Lost ogg sync using jspeex
Hi I am getting lost ogg sync exception when I tried to decompress a speex stream. I am using the following program for both compressing as well as decompressing. I am just planning to test how jspeex works. // File AudioCapture.java import javax.sound.sampled.spi.*; import javax.sound.sampled.*; import org.xiph.speex.spi.*; import java.util.*; import java.net.*; import java.io.*; public
2004 Aug 06
0
Lost ogg sync using jspeex
Hi I am getting lost ogg sync exception when I tried to decompress a speex stream. I am using the following program for both compressing as well as decomressing. I am just planning to test how jspeex works. // File AudioCapture.java import javax.sound.sampled.spi.*; import javax.sound.sampled.*; import org.xiph.speex.spi.*; import java.util.*; import java.net.*; import java.io.*; public
2008 Mar 05
1
CROSSOVER TRIALS IN R (Binary Outcomes)
I will like to analyse a binary cross over design using the random effects model. The probability of success is assumed to be logistic. Suppose as an example, we have 4 subjects undergoing a crossover design, where the outcome is either success or failure. The first two subjects receive treatment "A" first followed by treatment "B". The remaining two subjects receive
2004 Aug 06
0
Please Help, Lost ogg sync using jspeex
<HTML dir=ltr><HEAD></HEAD> <BODY> <DIV id=idOWAReplyText8852 dir=ltr> <DIV dir=ltr><FONT face=Arial color=#000000 size=2><FONT face=Arial color=#000000 size=2>Hi</FONT></DIV></DIV> <DIV dir=ltr> <DIV dir=ltr> <DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial