Displaying 20 results from an estimated 4000 matches similar to: "Algorithm needed"
2012 Nov 14
5
aggregate combination data
Dear R users,
I want to aggregate all *d *data from all combination of n *plots* taken
by k.
Thank very much!
My data is like that:
plot d 1 14 1 13 1 12 1 14 1 18 1 20 1 21 1
43 1 108 1 43 2 41 2 61 2 83 2 61 2 84 2 45 2 21 2 12 2 11 ... 100
10
100 12
--
---
Catalin-Constantin ROIBU
Forestry engineer, PhD
Forestry Faculty of Suceava
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
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
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
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
???
2012 Jun 08
1
Saving estimates after nested loops
Hi R-listers,
Savings regression results after a loop is straightforward. But what about when you have nested loops?
I am running a regression of the form
lm(y~1+x+M+ D[,i] + D[,j] + D[,k])
where x is the variable of interest. M and D are vectors with other covariates.
Vectors "M" and "x" are included in every regression. Then i loop over the columns of D to use all
2005 Dec 08
1
Listing all possible samples of size n form a population of size N
Dear useRs!
I would like to list all possible samples of size n form a population of
size N. Obviously, N must be small (up to 20??) for this to be possible.
For example, let say that N = 3 and n = 2. Therefore, we can say we have
units 1, 2 and 3. I believe all possible samples are : {1,2},{2,3} and
{1,3}.
I would like to emphasize that I am not looking for the number of different
2010 Nov 25
2
delete-d jackknife
Hi dear all,
Can aynone help me about delete-d jackknife
usually normal jackknife code for my data is:
n <- nrow(data)
y <- data$y
z <- data$z
theta.hat <- mean(y) / mean(z)
print (theta.hat)
theta.jack <- numeric(n)
for (i in 1:n)
theta.jack[i] <- mean(y[-i]) / mean(z[-i])
bias <- (n - 1) * (mean(theta.jack) - theta.hat)
print(bias)
but how i can apply delete-d jackknife
2017 Nov 01
2
"prob" package alternative
The prob package has been archived because it depends upon some other
packages which have issues.
However, such projects as Introduction to Probability and Statistics in R
depend upon it for learning. There are a few other resources that also use
it.
Does anyone know of any workarounds?
Someone at stack exchange mentioned using R 2.9. However, that broke my
RStudio (WSOD) and the dependent
2011 Jul 07
2
elimination duplicate elements sampling!
Hi everyone!
I have a data frame with 1112 time series and I am going to randomly
sampling r samples for z times to compose different portfolio size(r
securities portfolio). As for r=2 and z=10000,that's:
z=10000
A=seq(1:1112)
x1=sample(A,z,replace =TRUE)
x2=sample(A,z,replace =TRUE)
M=cbind(x1,x2) # combination of 2 series
Because in a portfolio with x1[i]=x2[i],(i=1,2,...,10000) means a 1
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
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,
2006 Oct 06
1
Sum of Bernoullis with varying probabilities
Hi Folks,
Given a series of n independent Bernoulli trials with
outcomes Yi (i=1...n) and Prob[Yi = 1] = Pi, I want
P = Prob[sum(Yi) = r] (r = 0,1,...,n)
I can certainly find a way to do it:
Let p be the vector c(P1,P2,...,Pn).
The cases r=0 and r=n are trivial (and also are exceptions
for the following routine).
For a given value of r in (1:(n-1)),
library(combinat)
Set <- (1:n)
2015 Mar 21
4
Combinatoria
En relación con lo que comenta Carlos, por ejemplo para el caso de las Variaciones sin Repetición, puede ser instructivoenseñar como se construye como por ejemplo:
VsinR <- function(m, n){ return (factorial(m)/factorial(m-n))}
VsinR(9,3)
-------------------------
Creo que con la función factorial que viene por defecto en R puedes construir siguiendo este modelo rápidadmentecasi cualquier
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
2017 Nov 02
2
"prob" package alternative
The issue is fAsianOptions. Is there a version that works with the latest
version of R? If not, which version of it works with which version of R and
where can it be found? I tried several at the archive already.
Alternatively, is there another package that behaves similarly to prob?
On Wed, Nov 1, 2017 at 6:17 PM, David Winsemius <dwinsemius at comcast.net>
wrote:
>
> > On Nov
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
2007 Jul 16
5
formula(CO2)
The formula attribute of the builtin CO2 dataset seems a bit strange:
> formula(CO2)
Plant ~ Type + Treatment + conc + uptake
What is one supposed to do with that? Certainly its not suitable for
input to lm and none of the examples in ?CO2 use the above.
2015 Mar 22
3
Combinatoria
Hola amigos, muchas gracias por vuestra ayuda.
Entonces veo que mi sorpresa era legítima. Por todos vuestros mails la
conclusión es que:
- En el módulo base de R no incluye combinatoria elemental, ni siquiera
el número combinatorio Cm,n hay que cargar el paquete *combinat*
- Y para las variaciones con repetición el paquete* gtools*
- Y aún así no tenemos ni las combinaciones ni las
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()"