Re: [R] Variation of bubble sort (based on divisors)

2017-04-03 Thread Hervé Pagès
Hi Piotr, On 03/31/2017 11:16 AM, Piotr Koller wrote: Hi, I'd like to create a function that will sort values of a vector on a given basis: -zeros -ones -numbers divisible by 2 -numbers divisible by 3 (but not by 2) -numbers divisible by 5 (but not by 2 and 3) In other words, you want to

Re: [R] Variation of bubble sort (based on divisors)

2017-04-03 Thread Boris Steipe
Piotr - keep discussions on-list please. I generally do not open attachments to eMails. You are misinterpreting the results: 0: 0 1: 1 2: 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 3: 3 9 15 21 27 (all even multiples of 3 have been sorted with 2) 5: 5 25 (10, 20, 30 are sorted as

Re: [R] Variation of bubble sort (based on divisors)

2017-03-31 Thread Boris Steipe
This looks opaque and hard to maintain. It seems to me that a better strategy is to subset your vector with modulo expressions, use a normal sort on each of the subsets, and add the result to each other. 0 and 1 need to be special-cased. myPrimes <- c(2, 3, 5) mySource <- sample(0:10) #

[R] Variation of bubble sort (based on divisors)

2017-03-31 Thread Piotr Koller
Hi, I'd like to create a function that will sort values of a vector on a given basis: -zeros -ones -numbers divisible by 2 -numbers divisible by 3 (but not by 2) -numbers divisible by 5 (but not by 2 and 3) etc. I also want to omit zeros in those turns. So when I have a given vector of

Re: [R] Variation Inflation factor for GLS

2014-05-22 Thread John Fox
Subject: [R] Variation Inflation factor for GLS Dear all, I am running a gls and I would like to check the vif of my model. It seems that the vif function in the car package and the vif.mer function available online do not work for gls. Would you know of a method to measure variance

[R] Variation Inflation factor for GLS

2014-05-20 Thread Laura Riggi
Dear all, I am running a gls and I would like to check the vif of my model. It seems that the vif function in the car package and the vif.mer function available online do not work for gls. Would you know of a method to measure variance inflation factors for GLS? Thank you Laura

Re: [R] Variation Inflation factor for GLS

2014-05-20 Thread John Fox
Dear Laura, There is no car::vif() method for gls objects, but the approach that car:::vif.lm() uses -- to compute VIFs (and generalized VIFs) from the correlation matrix of the coefficients -- should be applicable to models fit by gls(). I'll take a look a providing a vif.gls() method when I

[R] Variation of predictor of linear model

2010-09-27 Thread Yi Du
Hi folks, I use lm to run regression and I don't know how to predict dependent variable based on the model. I used predict.lm(model, newdata=80), but it gave me warnings. Also, how can I get the variance of dependent variable based on model. Thanks. [[alternative HTML version deleted]]

Re: [R] Variation of predictor of linear model

2010-09-27 Thread Joshua Wiley
Hi, Try this: # using the iris dataset mydat - iris mymodel - lm(Sepal.Length ~ Petal.Length + Species, data = mydat) summary(mymodel) newdat - data.frame(Petal.Length = seq(1, 10, by = .1), Species = factor(rep(virginica, 91))) results - predict(object = mymodel, newdata =

Re: [R] Variation of predictor of linear model

2010-09-27 Thread Yi Du
Thanks Josh. The variance of predictor should be var(beta_0+beta_1*newdata+epsilon). It is actually the variance of dependent variable if we plug the concrete value of independent variable into the model. On Mon, Sep 27, 2010 at 2:09 PM, Joshua Wiley jwiley.ps...@gmail.comwrote: Hi, Try

[R] variation of the aggregate function

2010-08-13 Thread Eva Nordstrom
Is there a more efficient/elegant way to obtain the result z below. a - c('pink','pink','blue','blue','gold','gold') b - c(5,8,9,12,7,4) agg - aggregate(x=b,by=list(a), FUN='mean') m - match(a, agg[,1]) z - agg[m,2] z [[alternative HTML version deleted]]

Re: [R] variation of the aggregate function

2010-08-13 Thread Gabor Grothendieck
On Fri, Aug 13, 2010 at 12:26 PM, Eva Nordstrom eva.nordst...@yahoo.com wrote: Is there a more efficient/elegant way to obtain the result z below. a - c('pink','pink','blue','blue','gold','gold') b - c(5,8,9,12,7,4) agg - aggregate(x=b,by=list(a), FUN='mean') m - match(a, agg[,1]) z -

[R] variation

2010-06-05 Thread Adel ESSAFI
Hi list I am a new user of R. I ask for some beginner question I am searching if there is any function that computes the variation of some discrete values of a vector (mean() and sd() exists, but i have not find variation). Thanks in advance Adel -- PhD candidate in Computer Science Address

Re: [R] variation

2010-06-05 Thread Jannis
What exactly do you mean by variation? As I understand it, this term is a broad term for all kinds of different spread measures (like quantile range or standard deviation). Do you mean the Coefficient of Variation? If you found out how to compute the mean and the std.dev., it is

Re: [R] variation

2010-06-05 Thread Adel ESSAFI
2010/6/5 Jannis bt_jan...@yahoo.de What exactly do you mean by variation? As I understand it, this term is a broad term for all kinds of different spread measures (like quantile range or standard deviation). Do you mean the Coefficient of Variation? If you found out how to Yes, that what I

Re: [R] variation

2010-06-05 Thread Adel ESSAFI
2010/6/5 Adel ESSAFI adel.s...@imag.fr 2010/6/5 Jannis bt_jan...@yahoo.de What exactly do you mean by variation? As I understand it, this term is a broad term for all kinds of different spread measures (like quantile range or standard deviation). Do you mean the Coefficient of Variation?

Re: [R] variation

2010-06-05 Thread Jannis
As far as I know there is no such function (i could be wrong here!). The reason for that might be that it is so straightforward to calculate it as the ratio of sd() and mean()for similar reasons there is most probably no function for the variance (and only one for std.dev)I would think

Re: [R] variation

2010-06-05 Thread Jannis
Sorry, my remark about the variance and standard deviation was nonsense! There are functions for both measures in R! Jannis Jannis schrieb: As far as I know there is no such function (i could be wrong here!). The reason for that might be that it is so straightforward to calculate it as the

Re: [R] variation

2010-06-05 Thread John Kane
?var perhaps --- On Sat, 6/5/10, Adel ESSAFI adel.s...@imag.fr wrote: From: Adel ESSAFI adel.s...@imag.fr Subject: Re: [R] variation To: r-help@r-project.org Received: Saturday, June 5, 2010, 7:57 AM 2010/6/5 Jannis bt_jan...@yahoo.de What exactly do you mean by variation? As I

[R] variation in one variable

2009-09-25 Thread Samuel Okoye
Hello, Could you please tell me wether there is any function in R that tell me how many subgroup in one variable I have? So for example if my data are x - c(rnorm(50,50,3),rgamma(50,2,1),runif(50,0,1)) I want to know how many group I have? Many thank in advance, Samuel --- On Thu, 9/17/09,