[R] Top Trading Cycles (TTC) Algorithm in R

2015-09-22 Thread VictorDelgado
Hello R users I'm posting here my recent implementation of Top Trading Cycles Algorithm in R. For more details, look for Shapley and Scarf "On Cores and Indivisibility" Journal of Mathematical Economics, 1, 23-37. ttc.many <- function(m, n, preference.row, preference.col,expand) { # m = row numbe

Re: [R] Fixing Gale-Shapley Algorithm for R

2015-09-22 Thread VictorDelgado
Hello R Developers, I have made a new code for this algorithm in R. In the end I present an very small example with system.time computing. Gale-Shapley Many-to-One (Note that many are always in Rows): # # gsa

Re: [R] Merge data frame with mispelling characters

2012-11-02 Thread VictorDelgado
David Winsemius wrote > On Nov 2, 2012, at 11:20 AM, VictorDelgado wrote: > >> Hello dear R-helpers, >> >> I'm working with R-2.15.2 on Windows 7 OS. I'm stucked with a merge of >> two >> data frames by characters. >> In each data frame I

[R] Merge data frame with mispelling characters

2012-11-02 Thread VictorDelgado
Hello dear R-helpers, I'm working with R-2.15.2 on Windows 7 OS. I'm stucked with a merge of two data frames by characters. In each data frame I got two different list of names, that is my main-key to be merged. To figure out what I'm saying, I build up a modified "?merge" example, with errors b

Re: [R] Error in solve.default(res$hessian * n.used) :Lapack routine dgesv: system is exactly singular

2012-03-01 Thread VictorDelgado
Vinicius, Vinicius Magalhães wrote > > > + n <- length(*x.ts*) > + for (p in 0:maxord[1]) for (d in 0:maxord[2]) for (q in 0:maxord[3]) > + for (P in 0:maxord[4]) for (D in 0:maxord[5]) for (Q in 0:maxord[6]) > + { > + fit <- arima(*x.ts*, order=c(p,d,q), > + seas = list(order=c(P,D,Q), >

Re: [R] Fixing Gale-Shapley Algorithm for R

2012-02-16 Thread VictorDelgado
VictorDelgado wrote > > gsa <- function(m, n, preference.row, preference.col, first) > { > # m: number of rows (men) > # n: number of columns (women) > # first 1 for row (men); and 2 for column (women) > # > # Two Auxiliary functions: > # 1: > min.n <- fun

Re: [R] calculate quantiles of a custom function

2012-01-03 Thread VictorDelgado
VictorDelgado wrote > > > quantile(x) > > Correcting to quantile(q) - Victor Delgado cedeplar.ufmg.br P.H.D. student www.fjp.mg.gov.br reseacher -- View this message in context: http://r.789695.n4.nabble.com/calculate-quantiles-of-a-custom-function-tp4256887p4257575.htm

Re: [R] calculate quantiles of a custom function

2012-01-03 Thread VictorDelgado
Gerhard wrote > > > Suppose I create a custom function, consisting of two beta-distributions: > > myfunction <- function(x) { > dbeta(x,2,6) + dbeta(x,6,2) > } > > How can I calculate the quantiles of myfunction? > > Thank you in advance, > > Gerhard > > Gehard, if do you want to know

Re: [R] Gale-Shapley Algorithm for R

2011-12-29 Thread VictorDelgado
VictorDelgado wrote > > Dear R-helpers, > > I'm not a speciallist in writing complex functions, and the function still > very rusty (any kind of suggestions are very welcome). I want to implement > Gale-Shapley algorithm for R Language. It is based on > http://ww

Re: [R] Contingency tables example

2011-12-29 Thread VictorDelgado
sambooth21 wrote > > > And I just don't know where to start, if anyone could help this would be > greatly appreciated > > look for ?anova - Victor Delgado cedeplar.ufmg.br P.H.D. student www.fjp.mg.gov.br reseacher -- View this message in context: http://r.789695.n4.nabble.com/Conting

Re: [R] Contingency tables example

2011-12-29 Thread VictorDelgado
sambooth21 wrote > > I am having a few problems importing the data i'm running this code and > the table sets up fine but all of the data values say NA: > > housdat<- c(21, 21, 28, 14, 19, 37, 34, 22, 36, 17, 23, 401, 10, 11, 36, > 3, 5, 23, 61, 23, 17, 78, 46, 43, 43, 35, 40, 48, 45, 86, 26, 18

[R] Gale-Shapley Algorithm for R

2011-12-28 Thread VictorDelgado
Dear R-helpers, I'm not a speciallist in writing complex functions, and the function still very rusty (any kind of suggestions are very welcome). I want to implement Gale-Shapley algorithm for R Language. It is based on http://www.jstor.org/stable/10.2307/2312726 Gale and Shapley (1962) , and it

Re: [R] problem finding p-value for entropy in reldist package

2011-07-11 Thread VictorDelgado
Hi Amy Wesolowski, I don't have a straightfoward answer to you question. I have been working with reldist too, and the 'rpy' and 'rpluy' functions described by "Applying Relative Distribution Methods in R" are also not working here in my 2.9.1 R-version. I think its because they are reldist intern

Re: [R] How to label specific points on a scatterplot

2011-07-08 Thread VictorDelgado
rstudent, one solution could be given by spliting your graph in two parts: part_1 <- # take the desired four points subset # part_2 <- # all rest points not to label You will also need one vector with your names. I supose: list <- c("B13", "G13", "K14", "N14") So plot(part_1$x, part_1$y) text

Re: [R] Simple conditional plot

2011-07-08 Thread VictorDelgado
Another possibility without using subset(): plot(Well[][Plate==101]~Raw[][Plate==101]) This also works to '>=' '<=' and other conditions. -- View this message in context: http://r.789695.n4.nabble.com/Simple-conditional-plot-tp3654300p3654666.html Sent from the R help mailing list archive at

Re: [R] Getting wrong NA values using "for" cmd

2011-07-08 Thread VictorDelgado
ty S. Goslee, It's helpfull to test the condition: > all.equal(s[4],0.15) [1] TRUE instead the previous "FALSE" answer obtained with >s[4]==0.15 [1] FALSE but I still need get it to vector r: Victor Delgado wrote: > > >> for (w in 1:length(s)){ >> r[w] <- dados[,3][dados[,2]==s[w]][1] >> }

[R] Getting wrong NA values using "for" cmd

2011-07-08 Thread VictorDelgado
Hi There, I'm facing one problem to construct a vector using the "for" command: I have one matrix named 'dados' (same as /data/ from portuguese), for example: > dados[140:150,] [,1] [,2] [,3] [1,] 212.7298 0.14 0.11 [2,] 213.3778 0.14 0.11 [3,] 214.0257 0.15 0.11 [4,] 214.6737 0.1