Re: [R] error MANOVA in R

2015-04-02 Thread peter dalgaard
> On 30 Mar 2015, at 17:11 , Gian Maria Niccolò Benucci > wrote: > > Dear R-usrs, > > I am trying to perform a MANOVA on a data frame with 31 columns about soil > parameters and 1 column containing the explanatory variable (Fraction) that > have three levels. > my code is the following: > > d

[R] Inverse of many small matrices

2015-04-02 Thread Feng Li
Dear all, I am working with a likelihood function that requires the inverse of many small covariance matrices for multivariate normal densities. When the sample size is large, this calculation is really heavy. Those matrices are independent but unfortunately I can hardly find a way to vectori

Re: [R] Calculating Kendall's tau

2015-04-02 Thread S Ellison
> I am analyzing trend  using Mann-kendall  test for 31 independent sample, each > sample  have 34 years dataset.  I supposed to find Kendall “tau” for each > sample. The data is arranged in column wise (I attached  the data).To find > Kendall tau, I wrote R script as: > ... > Anyone can tell me ho

[R] Kruskal-Wallace power calculations.

2015-04-02 Thread Collin Lynch
Greetings, I am working on a project where we are applying the Kruskal-Wallace test to some factor data to evaluate their correlation with existing grade data. I know that the grade data is nonnormal therefore we cannot rely on ANOVA or a similar parametric test. What I would like to find is a me

Re: [R] Inverse of many small matrices

2015-04-02 Thread Duncan Murdoch
On 02/04/2015 9:31 AM, Feng Li wrote: Dear all, I am working with a likelihood function that requires the inverse of many small covariance matrices for multivariate normal densities. When the sample size is large, this calculation is really heavy. Those matrices are independent but unfortunately

Re: [R] about model.matrix

2015-04-02 Thread Fix Ace
Thank you very much for the response. Then what does it mean? I am not a stat person, but have to use it for my project. :( Could you please recommend some readings about it? Thanks a lot! On Wednesday, April 1, 2015 10:58 AM, Michael Dewey wrote: This is really a question about st

Re: [R] Error in dis[sppInSample, sppInSample]:subscript out of bounds

2015-04-02 Thread John Kane
As a follow-up to Don's reply have a look at https://github.com/hadley/devtools/wiki/Reproducibility and/or ttp://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for some useful suggestions on how to frame a question. If you need to include sample data with your

Re: [R] about model.matrix

2015-04-02 Thread Bert Gunter
This is a big topic. You might try looking for tutorials on "linear models", with "rank" or "rank deficiency" as subtopics. One possible book is: http://www.amazon.com/Linear-Models-Chapman-Statistical-Science/dp/1439887330/ref=sr_1_5?s=books&ie=UTF8&qid=1427987551&sr=1-5&keywords=linear+models+in

Re: [R] Calculating Kendall's tau

2015-04-02 Thread William Dunlap
> MannKendalltau<- numeric(nc) simply makes MannKendalltau a single > integer equal to nc; that doesn't look sensible when the next thing you > do is treat MannKendalltau as a vector. No, numeric(nc) makes a "numeric" (double precision) vector of length nc filled with zeros. Perhaps you were thin

Re: [R] Kruskal-Wallace power calculations.

2015-04-02 Thread Jeff Newmiller
Please stop... you are acting like a broken record, and are also posting in HTML format. Please read the Posting Guide and demonstrate that you have used a search engine on this topic before posting again. --- Jeff Newmiller

Re: [R] about model.matrix

2015-04-02 Thread Michael Dewey
You cannot have columns which are linearly dependent. Starting a project which uses statistics without having some sort of local statistical backup seems unprofitable. install.packages("fortunes") # if not already done library(fortunes) fortune(122) On 02/04/2015 15:20, Fix Ace wrote: Thank

[R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Dimitri Liakhovitski
I have a data frame 'mydata.final' (see below) that contains US counties and a continuous numeric variable 'Mean.Wait' that ranges from zero to 10 or so. I also created variable 'wait' that is based on the 'Mean.Wait' and takes on discrete values from 1 (lowest values on 'Mean.Wait') to 5 (highest

Re: [R] From replicate to accesing sublists

2015-04-02 Thread David Winsemius
On Apr 1, 2015, at 9:59 PM, Alaios wrote: You are still replying with formatted email. This mailing list attempts to be an HTML-free zone. > Thanks.The code you gave me at the end works correctly.. I was wondering if > there is more efficient way to access each element withouth this classic fo

Re: [R] Calculating Kendall's tau

2015-04-02 Thread David Winsemius
On Apr 2, 2015, at 7:06 AM, S Ellison wrote: >> I am analyzing trend using Mann-kendall test for 31 independent sample, >> each >> sample have 34 years dataset. I supposed to find Kendall “tau” for each >> sample. The data is arranged in column wise (I attached the data).To find >> Kendall

[R] recode the same subset of variables in several list elements

2015-04-02 Thread Simon Kiss
Hi there: I have a list of data frames with identical variable names. I’d like to reverse scale the same variables in each data.frame. I’d appreciate any one’s suggestions as to how to accomplish this. Right now, I’m working with the code at the very bottom of my sample data. Thanks, Simon K

Re: [R] Calculating Kendall's tau

2015-04-02 Thread Desta Yoseph via R-help
Thank you for  the explanation and comments. I managed to solve and your comments are helpfully! thanks once again,Desta On Thursday, April 2, 2015 7:19 PM, David Winsemius wrote: On Apr 2, 2015, at 7:06 AM, S Ellison wrote: >> I am analyzing trend  using Mann-kendall  test for 3

Re: [R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Adams, Jean
Dimitri, You could use colorRamp() and rgb() to get more continuous colors. For example newpal <- colorRamp(c("yellow", "red")) missing <- is.na(mydata.final$Mean.Wait) newcol <- ifelse(missing, "white", rgb(newpal(mydat$Mean.Wait/max(mydat$Mean.Wait)), maxColorValue=255)) map('county', fill=TR

Re: [R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Dimitri Liakhovitski
Thank you, Jean, but I think this newcol line is not working. I am running: newcol <- ifelse(missing, "white", rgb(newpal(mydata.final$Mean.Wait/max(mydata.final$Mean.Wait, na.rm=T)), maxColorValue=255)) # And I am getting: Error in rgb(newpal(mydata.final$Mean.Wait/max(myda

Re: [R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Dimitri Liakhovitski
Jean, I think I fixed it: newpal <- colorRamp(c("yellow", "red")) missing <- is.na(mydata.final$Mean.Wait) newcol <- ifelse(missing, "white", rgb(newpal(mydata.final$Mean.Wait[!is.na(mydata.final$Mean.Wait)]/ max(mydata.final$Mean.Wait, na.rm=T)), maxColorValue=2

Re: [R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Jim Lemon
Hi Dimitri, You can also try the color.scale function in plotrix, which allows you to specify the NA color in the call. newcol<-color.scale(mydata.final$Mean.Wait,extremes=c("yellow","red"),na.color="white") Jim On Fri, Apr 3, 2015 at 8:08 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.c

Re: [R] recode the same subset of variables in several list elements

2015-04-02 Thread Jim Lemon
Hi Simon, How about this? library(plotrix) revlist<-grep("i",names(df),fixed=TRUE) df[,revlist]<-sapply(df[,revlist],rescale,c(3,1)) Jim On Fri, Apr 3, 2015 at 6:30 AM, Simon Kiss wrote: > Hi there: I have a list of data frames with identical variable names. > I’d like to reverse scale the s

Re: [R] Kruskal-Wallace power calculations.

2015-04-02 Thread Jim Lemon
Hi Collin, Have a look at this: http://stats.stackexchange.com/questions/70643/power-analysis-for-kruskal-wallis-or-mann-whitney-u-test-using-r Although, thinking about it, this might have constituted your "perusal of the literature". Plus it always looks better when you spell the names properly

Re: [R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Dimitri Liakhovitski
This is really cool, Jim - thanks a lot! On Thu, Apr 2, 2015 at 6:18 PM, Jim Lemon wrote: > Hi Dimitri, > You can also try the color.scale function in plotrix, which allows you to > specify the NA color in the call. > > newcol<-color.scale(mydata.final$Mean.Wait,extremes=c("yellow","red"),na.colo

[R] double-axis labels function of each other

2015-04-02 Thread Hurr
I have been doing other things, but want again to learn R. First some code: #try 2 axes at bottom x1 <- c(1,2,3,4,5,6,7,8,9) x2 <- c(5,1,9,6,3,7,8,2,4) plot(x1,x2,type="l") #scatter plot x1 on horizontal, x2 on vertical axis axis(1,labels=TRUE,tick=TRUE,col="red",col.axis="red",lwd=4,line=2.5) So

Re: [R] Kruskal-Wallace power calculations.

2015-04-02 Thread Collin Lynch
Thank you Jim, I did see those (though not my typo :) and am still pondering the warning about post-hoc analyses. The situation that I am in is that I have a set of individuals who have been assigned a course grade. We have then clustered these individuals into about 50 communities using standard

Re: [R] Inverse of many small matrices

2015-04-02 Thread Feng Li
On 04/02/2015 10:40 PM, Duncan Murdoch wrote: On 02/04/2015 9:31 AM, Feng Li wrote: Dear all, I am working with a likelihood function that requires the inverse of many small covariance matrices for multivariate normal densities. When the sample size is large, this calculation is really heavy. T

Re: [R] double-axis labels function of each other

2015-04-02 Thread Jim Lemon
Hi Hurr, Try this: par(mar=c(7,4,4,2)) plot(x1,x2,type="l",xlab="") require(plotrix) fullaxis(1,at=pretty(x1),labels=round(1/pretty(x1),2),tick=TRUE, col="red",col.axis="red",lwd=4,pos=-0.2) mtext("x1",side=1,line=4.5) Jim On Fri, Apr 3, 2015 at 11:16 AM, Hurr wrote: > I have been doing other

Re: [R] double-axis labels function of each other

2015-04-02 Thread Hurr
Thanks, That was good help; I tried this; I hope I didn't copy it wrong: #try 2 axes at bottom x1 <- c(1,2,3,4,5,6,7,8,9) x2 <- c(5,1,9,6,3,7,8,2,4) par(mar=c(7,4,4,2)) plot(x1,x2,type="l",xlab=””) #scatter plot x1 on horiz, x2 on vert axis require(plotrix) fullaxis(1,at=pretty(x1),labels=round(1/

[R] Multistratum blocking in AlgDesign

2015-04-02 Thread Marc Moragues
Hi all, I need to design an experiment very similar to the design described in the AlgDesign vignette on page 44. When I run the code on the vignette, I get the following error: > library(AlgDesign) > Rep<-gen.factorial(3,1,factor=1,varName="Rep") > Block<-gen.factorial(3,1,factor=1,varName="Blo

Re: [R] double-axis labels function of each other

2015-04-02 Thread Jim Lemon
Hi Hurr, The problem is with the quotes in xlab="". In your version the quotes are not ASCII double quotes but some sort of "smart" quotes. Either your email client has substituted them or more likely, you are editing your code in something like MS Word and cutting and pasting the result into R. Tr