[R] A combinatorial assignment problem

2014-05-01 Thread Ravi Varadhan
Hi, I have this problem: K candidates apply for a job. There are R referees available to review their resumes and provide feedback. Suppose that we would like M referees to review each candidate (M R). How would I assign candidates to referees (or, conversely, referees to candidates)?

Re: [R] help using extrafont package | R graphics

2014-05-01 Thread Yixuan Qiu
Hi Evan, If you just need one font, you may try the showtext package. Here is a piece of code that you can test: library(showtext) # If you have this font installed font.add(gara, gara.ttf) # Or you can install a similar one from Google Font # font.add.google(EB Garamond, gara) # Try some plots

Re: [R] Using apply with more than one matrix

2014-05-01 Thread David Winsemius
On Apr 30, 2014, at 6:03 PM, Waichler, Scott R wrote: Here is a working example with no random parts. Thanks for your patience and if I'm still off the mark with my presentation I'll drop the matter. v - c(NA, 1.5, NA, NA, NA, 1.1, 0.5, NA, NA, 1.3, 0.4, 0.9) a1 -

Re: [R] Using apply with more than one matrix

2014-05-01 Thread Waichler, Scott R
I would ask you to look at this loop-free approach and ask if this is not equally valid? ans - matrix(NA, ncol=2, nrow=2) ind.not.na - which(!is.na(a1)) ans[] - condition1*a1[,,ind.not.na[1]]+ m2 # two matrices of equal dimensions, one logical. ans [,1] [,2] [1,] NA 1.66 [2,]

Re: [R] Using apply with more than one matrix

2014-05-01 Thread David Winsemius
On Apr 30, 2014, at 9:32 PM, Waichler, Scott R wrote: I would ask you to look at this loop-free approach and ask if this is not equally valid? ans - matrix(NA, ncol=2, nrow=2) ind.not.na - which(!is.na(a1)) ans[] - condition1*a1[,,ind.not.na[1]]+ m2 # two matrices of equal dimensions,

[R] outer() problem

2014-05-01 Thread Marc Girondot
Dear list-members, Can someone explains me why the last command gives an error. Thanks a lot: outer(0:1, 0:1, FUN=function(x, y) {x+y}) [,1] [,2] [1,]01 [2,]12 outer(0:1, 0:1, FUN=function(x, y) {x}) [,1] [,2] [1,]00 [2,]11 outer(0:1, 0:1,

Re: [R] outer() problem

2014-05-01 Thread Ken Knoblauch
Marc Girondot marc_grt at yahoo.fr writes: outer(0:1, 0:1, FUN=function(x, y) {1}) Erreur dans outer(0:1, 0:1, FUN = function(x, y) { : dims [produit 4] ne correspond pas à la longueur de l'objet [1] Because whatever the dimensions of your 2 input vectors, this function simply returns the

Re: [R] outer() problem

2014-05-01 Thread Berend Hasselman
On 01-05-2014, at 08:44, Marc Girondot marc_...@yahoo.fr wrote: Dear list-members, Can someone explains me why the last command gives an error. Thanks a lot: outer(0:1, 0:1, FUN=function(x, y) {x+y}) [,1] [,2] [1,]01 [2,]12 outer(0:1, 0:1, FUN=function(x, y) {x})

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ravi Varadhan Sent: Wednesday, April 30, 2014 10:49 AM To: r-help@r-project.org Subject: [R] A combinatorial assignment problem Hi, I have this problem: K candidates apply

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Daniel Nordlund Sent: Thursday, May 01, 2014 1:10 AM To: r-help@r-project.org Subject: Re: [R] A combinatorial assignment problem -Original Message- From:

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Bert Gunter
This is not really a combinatorial problem, I'll use small letters instead of caps. Arrange the r referees in a circle. start - 1 Replicate k times{ end - (start + m-1)%% r output: c(start,end) start - (end+1)%% r } Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Bert Gunter
I had trouble with my email and it went before it should. Here's the solution I meant to send: Arrange the r referees in a circle. start - 0 Replicate k times{ end - (start + m-1)%% r output: c(start,end) +1 start - (end+1)%% r } The start and end pairs give the subsets of referees around the

Re: [R] Tobit model with panel data

2014-05-01 Thread Arne Henningsen
Hi Phil On 30 April 2014 23:06, phil quij...@gmx.net wrote: I just started to work with R a couple of weeks ago. Right now I would like to regress an independent variable on a couple of explanatory variables. The dependent variable is left censored in the sense that all negative values and

Re: [R] Using apply with more than one matrix

2014-05-01 Thread arun
Hi, You may try: evaluate - function(arr, mat1, mat2) {     if (!all(dim(mat1) == dim(mat2))) {     stop(both matrices should have equal dimensions)     }     indx1 - as.matrix(do.call(expand.grid, lapply(dim(arr), sequence)))     indx2 - paste0(indx1[, 1], indx1[, 2])     condition1 -

Re: [R] Unbalanced manova

2014-05-01 Thread Sergio Fonda
Thank you John, I solved exploiting Anova call type 2 in your car package :) Il 25/apr/2014 14:57 John Fox j...@mcmaster.ca ha scritto: Dear Sergio, The Anova() function in the car package can perform MANOVA with a multivariate linear model fit to unbalanced data by lm() -- see the examples

[R] Legendre quadrature

2014-05-01 Thread pari hesabi
Hello everybody I need to approximate the amount of integral by using legendre quadrature. I have written a program which doesn't give me a logical answer; Can anybody help me and send the correct program? For example the approximated amount of integral of ( x ^2) on (-1,1) based on legendre

[R] legendre quadrature

2014-05-01 Thread pari hesabi
Hello everybody I need to approximate the amount of integral by using legendre quadrature. I have written a program which doesn't give me a logical answer; Can anybody help me and send the correct program? For example the approximated amount of integral of ( x ^2) on (-1,1) based on legendre

Re: [R] legendre quadrature

2014-05-01 Thread Prof. Dr. Matthias Kohl
you could use package distrEx: library(distrEx) GLIntegrate(function(x) x^2, lower = -1, upper = 1, order = 50) hth Matthias On 01.05.2014 09:43, pari hesabi wrote: Hello everybody I need to approximate the amount of integral by using legendre quadrature. I have written a program which

Re: [R] legendre quadrature

2014-05-01 Thread Enrico Schumann
On Thu, 01 May 2014, pari hesabi statistic...@hotmail.com writes: Hello everybody I need to approximate the amount of integral by using legendre quadrature. I have written a program which doesn't give me a logical answer; Can anybody help me and send the correct program? For example the

[R] Tobit model with L1 and L2 penalties (elastic net)

2014-05-01 Thread Sicotte, Hugues, Ph.D.
Does anyone know of package that implements a tobit model with L1 and L2 (lasso and ridge) penalties aka elastic net. I am interested in an elastic net implementation of tobit because my variables are SNPs genotypes/dosage in Linkage disequilibrium and elastic net type models to well for that.

Re: [R] Using apply with more than one matrix

2014-05-01 Thread arun
Hi, Sorry, a typo in the previous function: - if (condition1[i] !is.na(indx3)) {     arr[x1][indx3] + m2[i]  ## should be mat2[i]     } else NA   --- Also, you can try: library(plyr) evaluateNew - function(arr, mat1, mat2){ if

Re: [R] R 3.1 changes to type.convert causing strings where I used to get numeric

2014-05-01 Thread Bos, Roger
Duncan, Yes, I admit I haven't updated since 2.15.2 so I was behind. I am seeing the same problem with reading from RODBC (sql server) tables. I write data to a table and then read it back. In R 2.15 it would come in numeric. Under R 3.1 it comes in as a string. Thanks, Roger

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Bert Gunter
Ravi: You cannot simultaneously have balance and guarantee random mixing. That is, you would need to specify precisely what you mean by balance and random mixing in this context, as these terms are now subjective and undefined. You could, of course, randomize the initial assignment of referees

Re: [R] Using apply with more than one matrix

2014-05-01 Thread Waichler, Scott R
Sapply or mapply may work, I haven't used these much and will try to learn better how to use them. Your use of sapply looks good; but I'm trying to understand if and how I can bring in the operation on a1. This doesn't work: evaluate - function(idx) { ind.not.na -

Re: [R] Using apply with more than one matrix

2014-05-01 Thread Waichler, Scott R
Thank you, A.K. I learned from both of your solutions. I find the one that uses alply easier to follow and understand intuitively. I guess I'll want to learn more about what plyr can do. I've been using R for years but hadn't pushed vectorization far enough in my code. Now my computing

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Charles Berry
Ravi Varadhan ravi.varadhan at jhu.edu writes: Hi, I have this problem: K candidates apply for a job. There are R referees available to review their resumes and provide feedback. Suppose that we would like M referees to review each candidate (M R). How would I assign candidates to

Re: [R] Using apply with more than one matrix

2014-05-01 Thread William Dunlap
Thank you, A.K. I learned from both of your solutions. I find the one that uses alply easier to follow and understand intuitively. Another approach is to only loop over the 3rd dimensional slices of a1. Your original code, converted to a function so it is easier to test and think about is

Re: [R] help using extrafont package | R graphics

2014-05-01 Thread Evan Cooch
Thanks very much. I'll give it a try. On 4/30/2014 9:33 PM, Yixuan Qiu wrote: Hi Evan, If you just need one font, you may try the showtext package. Here is a piece of code that you can test: library(showtext) # If you have this font installed font.add(gara, gara.ttf) # Or you can install

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Ravi Varadhan
Thanks, Bert. I have written this simple code, which is crude, but seems to do a decent job. It works perfectly when M is a factor of R. Otherwise, it gives decent balance (of course, balance is not guaranteed). I guess it is possible to take the results, that are somewhat unbalanced and

[R] error using polymars argument

2014-05-01 Thread varin sacha
Hi Dear all, I got an error when I try to do a MARS regression with the polymars argument on the A matrix and the V vector here below. I don't understand the error, I have nrow=22 for the response variable and for the predictor matrix. So if somebody could tell me what is going wrong, it would

[R] Understanding power analysis in glm and binomial proportion test

2014-05-01 Thread Wall, Wade A ERDC-RDE-CERL-IL
Hi all, I am trying to run a power analysis using simulated data to compare the power of a glm versus a binomial proportion test to detect differences in proportions. For example, suppose you have some proportion that decreases by some amount over X number of time steps. .4,.39,.38,.37 . . . .

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Ravi Varadhan
Thank you, Dan and Bert. Bert - Your approach provides a solution. However, it has the undesired property of referees lumping together (I apologize that I did not state this as a condition). In other words, it does not mix the referees in some random fashion. Dan - your approach attempts

Re: [R] Understanding power analysis in glm and binomial proportion test

2014-05-01 Thread Bert Gunter
While R is certainly used for statistical simulations as you showed, this list is really for questions about R programming, not statistics. While they certainly overlap and someone may respond here, I suggest you post this to stats.stackexchange.com or other statistics site that is specifically

Re: [R] [EXTERNAL] Re: Understanding power analysis in glm and binomial proportion test

2014-05-01 Thread Wall, Wade A ERDC-RDE-CERL-IL
Thanks for the information. I will pose the question on Stack Exchange. Wade A. Wall US Army ERDC-CERL P.O. Box 9005 Champaign, IL 61826-9005 1-217-373-4420 wade.a.w...@usace.army.mil -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Thursday, May 01, 2014

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Charles Berry
Ravi Varadhan ravi.varadhan at jhu.edu writes: Thanks, Bert. I have written this simple code, which is crude, but seems to do a decent job. It works perfectly when M is a factor of R. Otherwise, it gives decent balance (of course, balance is not guaranteed). I guess it is possible to

Re: [R] error using polymars argument

2014-05-01 Thread Jim Lemon
On 05/01/2014 09:47 PM, varin sacha wrote: Hi Dear all, I got an error when I try to do a MARS regression with the polymars argument on the A matrix and the V vector here below. I don't understand the error, I have nrow=22 for the response variable and for the predictor matrix. So if somebody

Re: [R] outer() problem

2014-05-01 Thread David Winsemius
On Apr 30, 2014, at 11:44 PM, Marc Girondot wrote: Dear list-members, Can someone explains me why the last command gives an error. Thanks a lot: outer(0:1, 0:1, FUN=function(x, y) {x+y}) [,1] [,2] [1,]01 [2,]12 outer(0:1, 0:1, FUN=function(x, y) {x}) [,1] [,2]

[R] how to extract a part of objects from list ?

2014-05-01 Thread Kristi Glover
Hi R User, I am wonedring how I can extract a part of objects from list. For example str(out1970) List of 8 $ comm : num [1:16, 1:57] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, dimnames)=List of 2 .. ..$ : chr [1:16] H_s5 H_s1 R_s2 H_s2 ... .. ..$ : chr [1:57] Pimephales.promelas

Re: [R] how to extract a part of objects from list ?

2014-05-01 Thread Jorge I Velez
Hi Kristi, Try out1970$smoot HTH, Jorge.- On Fri, May 2, 2014 at 10:00 AM, Kristi Glover kristi.glo...@hotmail.comwrote: Hi R User, I am wonedring how I can extract a part of objects from list. For example str(out1970) List of 8 $ comm : num [1:16, 1:57] 1 1 1 1 1 1 1 1 1 1 ...

[R] speeding up applying hist() over rows of a matrix

2014-05-01 Thread Ortiz-Bobea, Ariel
Hello everyone, I'm trying to construct bins for each row in a matrix. I'm using apply() in combination with hist() to do this. Performing this binning for a 10K-by-50 matrix takes about 5 seconds, but only 0.5 seconds for a 1K-by-500 matrix. This suggests the bottleneck is accessing rows in

[R] How do I create multiple orthogonal designs with the Conjoint package?

2014-05-01 Thread David Moskowitz
Hi, I am trying to create multiple orthogonal designs using the Conjoint package. I have 4 factors with 5 levels in each. library(conjoint) experiment-expand.grid( price-c(a1,a2,a3,a4,a5), tag-c(b1,b2,b3,b4,b5), smell-c(c1,c2,c3,c4,c5), aroma-c(f1,f2,f3,f4,f5))

[R] R and GML data from the Canadian Goverment

2014-05-01 Thread jcrosbie
I'm trying to create a map of transmission lines in Alberta. In addition, I'm very new to creating maps. The data can be found at: http://geogratis.gc.ca/site/eng/download http://ftp2.cits.rncan.gc.ca/pub/canvec/doc/CanVec_distribution_formats_en.pdf Would someone be able to point me in the

Re: [R] help using extrafont package | R graphics

2014-05-01 Thread Taiyun Wei
The showtext package is really nice! On Thu, May 1, 2014 at 9:33 AM, Yixuan Qiu yixuan@cos.name wrote: Hi Evan, If you just need one font, you may try the showtext package. Here is a piece of code that you can test: library(showtext) # If you have this font installed font.add(gara,

Re: [R] Tobit model with panel data

2014-05-01 Thread phil
Hi Arne, thanks a lot for your reply, it was really helpful! Now, after having managed to apply the censReg to my data, I get the following error message when I enter the command summary(): Error in printCoefmat(coef(x, logSigma = logSigma), digits = digits) : 'x' must be coefficient

Re: [R] Tobit model with panel data

2014-05-01 Thread phil
Hi Arne, it's me once again. I just tried the same regression with less predictors since so far I have used 16 for 52 observations. Having used less predictors, R showed me some output for the command summary(). Without doubt, it was clear beforehand that this ratio between dependent and

Re: [R] Simulative data production

2014-05-01 Thread Merve Şahin
Thanks for your answer and attention :) I will try to do it Merve *Arş.Gör.Merve ŞAHİN* *Abant İzzet Baysal Üniversitesi* *Eğitim Bilimleri Bölümü* *Ölçme ve Değerlendirme A.B.D.* 2014-04-30 15:57 GMT+03:00 Lorenz, David lor...@usgs.gov: Merve, I'm not 100 percent sure I

Re: [R] error using polymars argument

2014-05-01 Thread varin sacha
Hi Jim, Many thanks. Sorry for disturbing just for a parenthesis... But I couldn't go ahead... Le Jeudi 1 mai 2014 23h22, Jim Lemon j...@bitwrit.com.au a écrit : On 05/01/2014 09:47 PM, varin sacha wrote: Hi Dear all, I got an error when I try to do a MARS regression with the polymars

[R] Fwd: Difficulty in finding some R functions

2014-05-01 Thread prachi jain
Hey, I am trying to find some of the following functions in R packages: MLEt pt3 cormatrix2vector ParameterEst tCopula riskBT I have checked every package from this link: http://cran.r-project.org/web/packages/available_packages_by_name.html but is unable to find the above functions. These