Displaying 20 results from an estimated 8000 matches similar to: "Sum of Bernoullis with varying probabilities"
2013 Sep 06
1
Importing function that is previously imported by other package
Dear developeRs,
I encounter the following problem: in the current version of my package
FrF2, certain calls to a functioni do not work when package combinat is
loaded, because function combn from combinat masks the function from
utils that my package uses.
I tried to solve this issue by importing function combn into the
namespace of FrF2; I don't need to export it, I just want to use it
2007 Apr 10
1
R CMD Rdconv drops sections: arguments, seealso, examples (PR#9606)
I've created a .Rd file (below), then converted that to .sgml using
R CMD Rdconv --type=Ssgm combn.Rd > combn.sgml
The output (shown below) is missing some of the sections:
arguments
seealso
examples
If instead I convert to .d (below), the same sections are missing,
and the "note" section is included but without the necessary newline.
2006 May 09
1
combn(n, k, ...) and all its re-inventions
It seems people are reinventing the wheel here:
The goal is to generate all combinations of 1:n of size k.
This (typically) results in a matrix of size k * choose(n,k)
i.e. needs O(n ^ k) space, hence is only applicable to
relatively small k.
Then alternatives have been devised to generate the combinations
"one by one", and I think I remember there has been a
quiz/challenge about 20
2013 Jan 24
2
Please help R error message "masked from 'package:utils':combn"
Hi
The message occurred from R, when I was selected of "optimization > block
diagonal Fhiser matrix" and used the attached file on PFIM.
Could you please advise me about the following message?
*****************************
Loading required pakage: combinat
Attaching package:'combinat'
The following object(s) are masked from 'package:utils':combn
2006 May 08
3
Non repetitive permutations/combinations of elements
Hello all,
I am trying to create a matrix of 1s and -1s without any repetitions for a
specified number of columns.
e.g. 1s and -1s for 3 columns can be done uniquely in 2^3 ways.
-1 -1 -1
-1 -1 1
-1 1 -1
-1 1 1
1 -1 -1
1 -1 1
1 1 -1
1 1 1
and for 4 columns in 2^4 ways and so on.
I finally used the function combn([0 1],3) that I found at the following link
2013 Apr 24
2
Distance matrices Combinations
Dear UseRs,
MY PROBLEM IS A SMALL PIECE OF A REAL BIG AND A COMPLICATED PROBLEM. IF I DELIBERATE IN A VERY SIMPLE WAY THEN ALL I
WANT IS TO PUT ALL THE POSSIBLE COMBINATIONS OF 75 DISTANCE MATRICES (BY TAKING 4 MATRICES, MORE COMMONLY 75C4), in the following equation.
t<-as.matrix((MAT1)^2+(MAT2)^2+(MAT3)^2+(MAT4)^2+,upper=T,diag=T))
Then "1215450" values of "t"(one for
2008 Jul 03
1
Problem in applying conditional looping
Respected All,
I hope you are enjoying good health, I am tring to write a program in R but
could not be very sucessful. My program draws random sample form bivariate
normal distribution and then compute a variable PIJ. For certian samples
some entries of variable PIJ is apearing as negative, which result
in negative variance estimator. I want to introduce a loop in my program
that verify the each
2006 Jan 30
2
yet another vectorization question
Dear R-helpers,
I'm trying to develop a function which specifies all possible expressions that
can be formed using a certain number of variables. For example, with three
variables A, B and C we can have
- presence/absence of A; B and C
- presence/absence of combinations of two of them
- presence/absence of all three
A B C
1 0
2 1
3 0
4 1
5 0
6 1
2005 Aug 17
2
Copying rows from a matrix using a vector of indices
Hi,
I am trying to use a vector of indices to select some
rows from a matrix. But before I can do that I somehow
need to convert 'combinations' into a list, since
'mode(combinations)' says it's 'numerical'. Any idea
how I can do that?
library("combinat")
combinations <- t(combn(8,2))
indices <- c(sample(1:length(combinations),10))
# convert
???
2006 Jul 13
1
looping using combinatorics
I have a problem where I need to loop over the total combinations of
vectors (combined once chosen via combinatorics). Here is a
simplification of the problem:
STEP 1: Define three vectors a, b, c.
STEP 2: Combine all possible pairwise vectors (i.e., 3 choose 2 = 3
possible pairs of vectors: ab,ac, bc)
NOTE: the actual problem has 8 choose 4, 8 choose 5 and 8 choose 6
combinations.
STEP
2007 Apr 30
1
R CMD Rdconv drops sections: arguments, seealso, examples (PR#9645)
On Tue, 10 Apr 2007 timh at insightful.com wrote:
> I've created a .Rd file (below), then converted that to .sgml using
> R CMD Rdconv --type=Ssgm combn.Rd > combn.sgml
> The output (shown below) is missing some of the sections:
> arguments
> seealso
> examples
> If instead I convert to .d (below), the same sections are missing,
> and the "note"
2010 Dec 22
3
A question to get all possible combinations
Let say, I have a matrix with 8 rows and 6 columns:
> df1 <- matrix(NA, 8, 4)
> df1
[,1] [,2] [,3] [,4]
[1,] NA NA NA NA
[2,] NA NA NA NA
[3,] NA NA NA NA
[4,] NA NA NA NA
[5,] NA NA NA NA
[6,] NA NA NA NA
[7,] NA NA NA NA
[8,] NA NA NA NA
Now I want to get **all possible** ways to fetch 6 cells at a
2015 Mar 22
2
Combinatoria
Hola Miguel,
Sí se pueden obtener las variaciones con y sin repetición en R.
Eso sí están un poco escondidas...
Se pueden calcular de esta forma:
#----------------------
> #Cargar el paquete gtools
> library(gtools)
> #Definir el conjunto sobre el que se hará el cálculo
> x <- c('rojo', 'azul', 'verde')
> #Utilizar la función "permutations()"
2010 Mar 26
2
More efficient alternative to combn()?
Hi,
i am working on a problem where i need to compute the products of all
possible combinations of size m of the elements of a vector. I know that
this can be achieved using the function combn(), e.g.:
> vector <- 1:6
> combn(x = vector, m = 3, FUN = function(y) prod(y))
In my case the vector has 2000 elements and i need to compute the values
specified above for m = 32. Using combn() i
2007 Apr 20
1
simply this loop?
Hi, anyone interested in this:
I tried to simply this loop with lapply or something but haven't figured it out:
mapt = c("203929_s_at", "203930_s_at", "203928_x_at", "206401_s_at")
mapt.combn <- lapply(1:4, function(i) combn(mapt, i))
out = list()
k = 1
for (i in 1:length(mapt.combn)){
for (j in 1:ncol(mapt.combn[[i]])){
out[[k]] =
2015 Mar 21
3
Combinatoria
Hola buenos días, me presento, me llamo Miguel y 'soy de' y 'vivo en'
Galicia.
Soy profesor de secundaria (Bachillerato Adultos) y llevo 15 días
estudiando R a un buen ritmo, pero todavía me faltan miles de cosas.
He visto que R facilita, no solo el análisis de datos y que posee una
potencia en cálculos estadísticos a cualquier nivel, sino gran caudal de
recursos para Data Mining,
2007 May 29
2
summing up colum values for unique IDs when multiple ID's exist in data frame
I have data.frame's with IDs and multiple columns. B/c some of IDs showed up
more than once, I need sum up colum values to creat a new dataframe with
unique ids.
I hope there are some cheaper ways of doing it... Because the dataframe is
huge, it takes almost an hour to do the task. Thanks so much in advance!
Young
# ------------------------- examples are here and sum.dup.r is at the
2012 Nov 16
1
pairing data using combn with criteria
Dear All,
I have a dataframe made up of individual beetles consisting of individual
number, family number, mother's family number, father's family number, and
sex of the beetle. I would like to pair up the individuals for breeding. I
would, however, like to avoid breeding beetles of the same sex (obviously),
the same family, and with the same mother's family or father's family,
2010 Nov 17
1
efficient conversion of matrix column rows to list elements
Hi List,
I'm hoping to get opinions for enhancing the efficiency of the following
code designed to take a vector of probabilities (outcomes) and calculate a
union of the probability space. As part of the union calculation, combn()
must be used, which returns a matrix, and the parallelized version of
lapply() provided in the multicore package requires a list. I've found that
2015 Mar 22
2
Combinatoria
Sí, también...
Para las permutaciones, n=r.
Y con el parámetro "repeats.allowed" controlas si son con o sin repetción:
#----------------------
> #Permutaciones *con repetición*
> permutations(n=3, r=3, v=x, repeats.allowed=TRUE)
[,1] [,2] [,3]
[1,] "azul" "azul" "azul"
[2,] "azul" "azul" "rojo"
[3,]