[R] How to get the p-value from lmer on a longitudinal analysis
Hi, I have a modelo like this: Yvar <- c(0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 1, 2, 3, 6, 6, 3, 3, 4) TIME <- 4:22 ID <- rep("PlotA",19) m <- lmer(Yvar~TIME+(TIME|ID),family=poisson) anova(m) summary(m) How to get the p-value for this case? Thanks Ronaldo -- Just because you're paranoid doesn't mean they AREN'T after you. -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/lbc | ICQ#: 5692561 | LinuxUser#: 205366 -- Favor NÃO ENVIAR arquivos do Word ou Powerpoint Prefira enviar em PDF, Texto, OpenOffice (ODF), HTML, or RTF. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to get the p-value from lmer on a longitudinal analysis
Em Sex 01 Ago 2008, Marc Schwartz escreveu: > on 08/01/2008 10:11 AM Ronaldo Reis Junior wrote: > > Hi, > > > > I have a modelo like this: > > > > Yvar <- c(0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 1, 2, 3, 6, 6, 3, 3, 4) > > TIME <- 4:22 > > ID <- rep("PlotA",19) > > m <- lmer(Yvar~TIME+(TIME|ID),family=poisson) > > anova(m) > > summary(m) > > > > How to get the p-value for this case? > > > > Thanks > > Ronaldo > > Unless something has changed recently: > > http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-are-p_002dvalues-not-displ >ayed-when-using-lmer_0028_0029_003f > > HTH, > > Marc Schwartz Hi Marc, thanks for the link. I knowed about this discussion, but I can't use the solution for this example. Look: > Yvar <- c(0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 1, 2, 3, 6, 6, 3, 3, 4) > TIME <- 4:22 > ID <- rep("PlotA",19) > m <- lmer(Yvar~TIME+(TIME|ID),family=poisson) > anova(m) Analysis of Variance Table Df Sum Sq Mean Sq TIME 1 21.674 21.674 > m2 <- update(m,.~.-TIME) > anova(m,m2) Data: Models: m2: Yvar ~ (TIME | ID) m: Yvar ~ TIME + (TIME | ID) Df AIC BIC logLik Chisq Chi Df Pr(>Chisq) m2 4 m 5 23.8628 28.5850 -6.93141 > # From the net > # And an emperical p-value using a function supplied by Douglas Bates > # to the R-help mailing list is another possibility: > mcmcpvalue <- function(samp) + { + ## elementary version that creates an empirical p-value for the + ## hypothesis that the columns of samp have mean zero versus a + ## general multivariate distribution with elliptical contours. + ## differences from the mean standardized by the observed + ## variance-covariance factor + std <- backsolve(chol(var(samp)), +cbind(0, t(samp)) - colMeans(samp), +transpose = TRUE) + sqdist <- colSums(std * std) + sum(sqdist[-1] > sqdist[1])/nrow(samp) + } > > # Required package to perform mcmc-sampling: > require(coda) > > # Perform sampling - NOTE: it takes a minute or two!: > set.seed(12321) # To make the random numbers repeatable > m3 <- mcmcsamp(m, 1) # generate sample Erro: inconsistent degrees of freedom and dimension Erro em t(.Call(glmer_MCMCsamp, GSpt, saveb, n, trans, verbose, deviance)) : error in evaluating the argument 'x' in selecting a method for function 't' What is wrong? Thanks Ronaldo -- Also, the Scots are said to have invented golf. Then they had to invent Scotch whiskey to take away the pain and frustration. -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/lbc | ICQ#: 5692561 | LinuxUser#: 205366 -- Favor NÃO ENVIAR arquivos do Word ou Powerpoint Prefira enviar em PDF, Texto, OpenOffice (ODF), HTML, or RTF. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Add arrows to a filled.contour margin
Hi, I try to put an arrow to a filled.contour plot. I make this: filled.contour(volcano, color = terrain.colors,key.axes=F) arrows(0.95,0,0.95,1,lwd=2) This work, but the problem is that I find the coordinates at random try, for other graphic with other scale is other fight with coordinates. Anybody know a more easy or more generalized way to make this? Somethink like this mtext(arrows(),side=4). Thanks Ronaldo -- The sweeter the apple, the blacker the core -- Scratch a lover and find a foe! -- Dorothy Parker, "Ballad of a Great Weariness" -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/lbc | ICQ#: 5692561 | LinuxUser#: 205366 -- Favor NÃO ENVIAR arquivos do Word ou Powerpoint Prefira enviar em PDF, Texto, OpenOffice (ODF), HTML, or RTF. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to increase the iteration limit in lmer
Hi, I have this message: Warning message: In mer_finalize(ans, verbose) : iteration limit reached without convergence (9) How to increase this limit? I try control=list(maxit=1000) I try maxIter and it dont work. Any idea Thanks Ronaldo -- Opportunities are usually disguised as hard work, so most people don't recognize them. -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/lecc | ICQ#: 5692561 | LinuxUser#: 205366 -- Favor NÃO ENVIAR arquivos do Word ou Powerpoint Prefira enviar em PDF, Texto, OpenOffice (ODF), HTML, or RTF. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help on rKward
Hi, I'm testing rKward and it's become a great GUI for R on linux, mainly for new linux users. I'm not a new linux user and I use Emacs for my own R's script. But I always try new GUIs or IDEs for to recommend to my students. The most dificult for new R and Linux users is: I have installed R on my linux but I dont found the R icon. This happen because R on linux have only the R-Console in your basic installation. After this barrier, users can install JGR, Rcmdr, etc. Anyway rKward is the best way to new Linux users start to use R. Lets go to my specific problem. The problem is the use of rKward for the heavy R user but new Linux user. Heavy R user dont use menus (they use rKward most like a script IDE than R GUI) and normally dont need to use the rKward output, made automatically by using rKward menus or manually using rk.print() and rk.header() function. They normally use sweave or a ascii output with comments. That is my problem? Exist anyway to save my ascii output from rKward to a file without need to use the copy and paste function? Thanks a lot. Inte Ronaldo -- 14ª lei - Geralmente, só quando você puder publicar seus resultados, eles são bons o suficiente para fazer parte de sua dissertação. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Yet Testing rKward
Hi, I continue testing rKward. I dont know how to save the results from a script execution without use copy and paste or using a rkward output system. Now I try to understand how adapt my script do use the rKward output system. Example: I have this script: -- ## Carregar a tabela de riqueza e equitabilidade library(gdata) dadosriq <- read.xls("Panalise.xls",h=T,sheet=2) ## Resumo dos dados summary(dadosriq) -- Using rkward output system I try: -- rk.header("Carregar a tabela de riqueza e equitabilidade") library(gdata) dadosriq <- read.xls("Panalise.xls",h=T,sheet=2) rk.header("Resumo dos dados") rk.print(summary(dadosriq)) -- Ok. The problems: 1) my script become rkward specific and it is not a good idea. 2) I cant print the command in output unless I repeat the command like a string: rk.header("dadosriq <- read.xls("Panalise.xls",h=T,sheet=2)"), but it is also not a good idea. Anyone know if exist a global rkward command to send all (commands e results) to the output? In this way if I'm a rkward user I use this global command, if I'm not a rkward user I comment this command and my script work. This is possible or I need to forget rkward as a linux R script IDE? Thanks Ronaldo -- 8ª lei - Colete seus dados hoje como se você soubesse que seu equipamento vai quebrar amanhã. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help with tapply selection
Hi, I try to create a data.frame from results of a tapply. I have this results from tapply: -- , , tapinom sp 1 1 2 3 4 5 6 7 8 9 10 1 NA NA NA NA NA NA NA NA NA NA 4 NA NA NA NA NA NA NA NA NA 4 5 NA NA NA NA NA NA NA NA NA NA 6 NA NA NA NA NA NA NA NA NA NA 7 NA NA NA NA NA NA NA NA NA NA , , wasm sp 2 1 2 3 4 5 6 7 8 9 10 1 1 NA NA NA NA NA NA NA NA NA 4 4 NA NA NA NA NA NA NA NA NA 5 NA NA NA NA NA NA NA NA NA NA 6 NA NA NA NA NA NA NA NA NA NA 7 7 NA 7 7 7 7 NA NA 7 7 I try to enter in tapply result to make a vector for each name, like this: tapinom sp 1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA The problem is how a access the tapply results? I try using names, but it have no names, I try using [] but without sucess. Thanks Ronaldo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Color on trellis device
Hi, I try to make a xyplot withou colors. I try: pdf(file="test.pdf") trellis.device(color=F) Depth <- equal.count(quakes$depth, number=8, overlap=.1) xyplot(lat ~ long | Depth, data = quakes) dev.off() the graphic is showed without colors in a X device but it dont work saving directly on pdf device. How I made to put color off in trellis device? Thanks Ronaldo -- 2ª lei - Na pesquisa, o que importa é o que está correto, e não quem está correto. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] sum with times
Hi, I have this vector: > A <- c("00:00:36","00:02:18") > A [1] "00:00:36" "00:02:18" I use as.difftime to convert this to time vector based > B <- as.difftime(A) > B Time differences in secs [1] 36 138 attr(,"tzone") [1] "" Now i try to make a sum > sum(B) Time difference of 174 secs The sum is ok, but how to convert this result again do H:M:S format to get the result 00:02:54, that is 2 minutes and 54 seconds. work with times is aways difficult, I try the units parameter in as.difftime but dont work. Thanks Ronaldo -- 8ª lei - Colete seus dados hoje como se você soubesse que seu equipamento vai quebrar amanhã. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] sum with times
Hi, Forget, the chron package work with this Thanks Ronaldo -- 8ª lei - Colete seus dados hoje como se você soubesse que seu equipamento vai quebrar amanhã. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 |ronaldo.r...@unimontes.br |http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Different colour in each bar in lattice package
Hi, I try to plot bars with different colours in a barchart graphic. My idea is make that all X-Levels from trat var with different colour (grey scale). I search for a solution but dont find any. Any help? Thanks dados <- structure(list(Medias = c(0.994169096209855, 0.99416342412449, 0.974683544303797, 0.954430379746835, 0.669047619047619, 0.8475569, 0.994163424124514, 0.99240506329114, 0.929113924050633, 0.70952380952381, 0.9473166, 0.9439193, 0.99746835443038, 0.99746835443038, 0.923809523809524, 0.862973760932945, 0.784046692606905, 0.645569620253165, 0.555035128805621, 0.470886075949367, 0.932944606413993, 0.809338521400778, 0.668354430379747, 0.608040201005025, 0.606060606060606), ICI = c(0.976994567793296, 0.98206380431608, 0.953595979983429, 0.928839427641527, 0.622608688475051, 1, 0.982063775957542, 0.976722631854148, 0.899246653813278, 0.664275771030459, 1, 1, 0.98225705686684, 0.98225705686684, 0.894238146710719, 0.802350976424288, 0.729009506353544, 0.575768730809864, 0.487173600236996, 0.401669070838163, 0.89054916155, 0.762545402476806, 0.607108256850681, 0.545852506856716, 0.546177521647536), ICS = c(0.998541256282513, 0.99811638878729, 0.986325619477418, 0.971104547021077, 0.712411667007983, 1, 0.998116391814118, 0.99754802608, 0.950613606532198, 0.750959759947381, 1, 1, 0.999643506018429, 0.999643506018429, 0.94561548964544, 0.90715403340414, 0.830504883009395, 0.70967681170475, 0.620904467505572, 0.541241164275512, 0.959662136271508, 0.848739648593426, 0.724387494422558, 0.666908727580774, 0.66291862672965), trat = structure(c(5L, 1L, 3L, 2L, 4L, 5L, 1L, 3L, 2L, 4L, 1L, 5L, 2L, 3L, 4L, 5L, 1L, 2L, 4L, 3L, 5L, 1L, 2L, 3L, 4L), .Label = c("O", "P", "Pl", "T", "TN"), class = "factor"), Yvar = structure(c(2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 5L, 5L, 5L, 5L, 5L, 4L, 4L, 4L, 4L, 4L), .Label = c("0BG", "0BP", "0T", "1A", "1D"), class = "factor")), .Names = c("Medias", "ICI", "ICS", "trat", "Yvar"), row.names = c("tratTN", "tratO", "tratPl", "tratP", "tratT", "tratTN1", "tratO1", "tratPl1", "tratP1", "tratT1", "tratO2", "tratTN2", "tratP2", "tratPl2", "tratT2", "tratTN3", "tratO3", "tratP3", "tratT3", "tratPl3", "tratTN4", "tratO4", "tratP4", "tratPl4", "tratT4"), class = "data.frame") library(lattice) dados$Yvar <- as.factor(dados$Yvar) with(dados,barchart(Medias*100~trat|Yvar,col="gray50")) -- 10ª lei - Seu orientador espera que a sua produtividade seja baixa inicialmente e esteja acima da média após um ano. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help on survival analysis
Hi, I need a help in a survival analysis using survreg function with weibull distribution from survival package. Look the data sample: ## Start of script dados <- structure(list(TFD = c(20L, 34L, 1L, 2L, 3L, 3L, 50L, 26L, 1L, 50L, 21L, 3L, 13L, 11L, 22L, 50L, 50L, 1L, 50L, 9L, 50L, 1L, 13L, 50L, 50L, 1L, 6L, 50L, 50L, 50L, 36L, 3L, 46L, 10L, 50L, 1L, 18L, 3L, 36L, 37L, 50L, 7L, 1L, 1L, 7L, 24L, 4L, 50L, 12L, 17L), Censor = c(1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1)), .Names = c("TFD", "Censor"), class = "data.frame", row.names = c(NA, -50L)) summary(dados) TFDCensor Min. : 1.00 Min. :0.00 1st Qu.: 3.00 1st Qu.:0.00 Median :17.50 Median :1.00 Mean :23.08 Mean :0.72 3rd Qu.:50.00 3rd Qu.:1.00 Max. :50.00 Max. :1.00 ### TFD is the time for death attach(dados) m <- survreg(Surv(TFD,Censor)~1) summary(m) #Call: #survreg(formula = Surv(TFD, Censor) ~ 1) #Value Std. Error zp #(Intercept) 3.466 0.250 13.87 9.67e-44 #Log(scale) 0.403 0.144 2.81 4.98e-03 # #Scale= 1.5 # #Weibull distribution #Loglik(model)= -156.2 Loglik(intercept only)= -156.2 #Number of Newton-Raphson Iterations: 5 #n= 50 ### Calculating the mean time for death, the time that 50% of population is dead. mu <- exp(3.466) mu #[1] 32.00845 ### In this example the mean time for death (\mu) is 32.00845. ### Now the alpha calculation based on scale parameter alpha <- 1/1.5 alpha #[1] 0.667 ### Making the curve curve(exp((-mu^(-alpha))*(x^alpha)),from=0,to=50,ylim=c(0,1),col=1,ylab="Survival",xlab="Time") ### Adding lines in graphic to show the point corresponding to the coordinates, y=0.5 (50% of mortality) and x=32 that is the time to death for 50% of population. abline(h=0.5,lty=2) abline(v=mu,lty=2) points(mu,0.5,cex=2) The problem is, I expected that the estimated curve from weibull cross this point(32,0.5) but it is not really. What is the problem with this analysis? Thanks Ronaldo -- 1ª lei - Suas férias começam após a defesa e entrega de sua dissertação. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Using merge
Hi, I have two tables and I need to merge both. I use the merge command, but in this way the name must be exactly. How I can make to compare independently of upper or lower-case? Look: data1<-data.frame(journal=c("Ecology","Environmental Entomology","Neotropical Biology And Conservation")) data2<-data.frame(journal=c("Ecology","Environmental Entomology","Neotropical Biology and Conservation","Sociobiology"),qualis=c("A1","A2","B1","B5")) merge(data1,data2) > merge(data1,data2) journal qualis 1 Ecology A1 2 Environmental Entomology A2 the expected result is: journal qualis 1 Ecology A1 2 Environmental Entomology A2 3 Neotropical Biology And Conservation B1 Look that result is wrong because the "And" and "and" in the name "Neotropical Biology And Conservation" how to fix it automatically? Has any function to make all names lowercase or any other mean to make this to work. Thanks Ronaldo -- 16ª lei - Lembre-se, é a sua dissertação. Você (!) é quem precisa fazê-la. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Using merge
Hi, ignore my e-mail, a just use tolower function. thanks and sorry Ronaldo Em 11-02-2011 11:24, Ronaldo Reis Junior escreveu: > Hi, > > I have two tables and I need to merge both. I use the merge command, > but in this way the name must be exactly. How I can make to compare > independently of upper or lower-case? > > Look: > > data1<-data.frame(journal=c("Ecology","Environmental > Entomology","Neotropical Biology And Conservation")) > > data2<-data.frame(journal=c("Ecology","Environmental > Entomology","Neotropical Biology and > Conservation","Sociobiology"),qualis=c("A1","A2","B1","B5")) > > merge(data1,data2) > > > merge(data1,data2) >journal qualis > 1 Ecology A1 > 2 Environmental Entomology A2 > > the expected result is: > >journal qualis > 1 Ecology A1 > 2 Environmental Entomology A2 > 3 Neotropical Biology And Conservation B1 > > Look that result is wrong because the "And" and "and" in the name > "Neotropical Biology And Conservation" > > how to fix it automatically? Has any function to make all names > lowercase or any other mean to make this to work. > > Thanks > Ronaldo > -- > 16ª lei - Lembre-se, é a sua dissertação. Você (!) é quem precisa fazê-la. > >--Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > > > Prof. Ronaldo Reis Júnior > | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional > | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia > | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil > | `- Fone: (38) 3229-8192 |ronaldo.r...@unimontes.br > |http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 > -- 1ª lei - Suas férias começam após a defesa e entrega de sua dissertação. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with vegan package instalation on linux
Gavin, yes, I have GCC, Gfortran, [root@amandix ~]# gcc --version gcc (Debian 4.5.2-5) 4.5.2 [root@amandix ~]# gfortran --version GNU Fortran (Debian 4.5.2-5) 4.5.2 [root@amandix ~]# make --version GNU Make 3.81 I have another linux installed that I dont have any problem, the installations are similar. In this specific installation I cant install several packages that have the same error (ex. vegan and mapproj). I try to install several dev packages from gnome-dev, but without success. I dont find were is the problem. I try to install the mapproj from debian source to get dependencies but the error is the same. Look [root@amandix ~]# apt-get build-dep r-cran-mapproj Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 23 not upgraded. [root@amandix ~]# apt-get source r-cran-mapproj -b Reading package lists... Done Building dependency tree Reading state information... Done Need to get 31.5 kB of source archives. Get:1 http://http.us.debian.org/debian/ unstable/main r-cran-mapproj 1.1-8.3-1 (dsc) [1069 B] Get:2 http://http.us.debian.org/debian/ unstable/main r-cran-mapproj 1.1-8.3-1 (tar) [24.0 kB] Get:3 http://http.us.debian.org/debian/ unstable/main r-cran-mapproj 1.1-8.3-1 (diff) [6455 B] Fetched 31.5 kB in 1s (24.4 kB/s) dpkg-source: info: extracting r-cran-mapproj in r-cran-mapproj-1.1-8.3 dpkg-source: info: unpacking r-cran-mapproj_1.1-8.3.orig.tar.gz dpkg-source: info: applying r-cran-mapproj_1.1-8.3-1.diff.gz dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): dpkg-buildpackage: source package r-cran-mapproj dpkg-buildpackage: source version 1.1-8.3-1 dpkg-buildpackage: source changed by Chris Lawrence dpkg-buildpackage: host architecture i386 dpkg-source --before-build r-cran-mapproj-1.1-8.3 debian/rules clean test -x debian/rules dh_testroot dh_clean debian/rules build test -x debian/rules mkdir -p "." debian/rules binary test -x debian/rules dh_testroot dh_prep dh_installdirs -A mkdir -p "." dh_installdirsusr/lib/R/site-library R CMD INSTALL -l /root/r-cran-mapproj-1.1-8.3/debian/r-cran-mapproj/usr/lib/R/site-library --clean . * installing *source* package 'mapproj' ... ** libs make[1]: Entering directory `/root/r-cran-mapproj-1.1-8.3' make[1]: *** No rule to make target `aitoff.o', needed by `mapproj.so'. Stop. make[1]: Leaving directory `/root/r-cran-mapproj-1.1-8.3' make[1]: Entering directory `/root/r-cran-mapproj-1.1-8.3' make[1]: Leaving directory `/root/r-cran-mapproj-1.1-8.3' *** arch - Rgnome Warning in file(con, "r") : cannot open file '/usr/lib/R/etc/Rgnome/Makeconf': No such file or directory Error in file(con, "r") : cannot open the connection * removing '/root/r-cran-mapproj-1.1-8.3/debian/r-cran-mapproj/usr/lib/R/site-library/mapproj' make: *** [R_any_arch] Error 1 dpkg-buildpackage: error: debian/rules binary gave error exit status 2 Build command 'cd r-cran-mapproj-1.1-8.3 && dpkg-buildpackage -b -uc' failed. E: Child process failed I try also in a debian list. Any more help are welcome Thanks Ronaldo Em 09-03-2011 12:28, Gavin Simpson escreveu: > On Wed, 2011-03-09 at 11:41 -0300, Ronaldo Reis-Jr. wrote: > >> Hi, >> >> I try to install vegan package on debian linux and I give this error: >> > Have you got a fortran compiler installed on your system? gcc-gfortran > is the package on my Fedora laptop. > > G > > >> = >> * installing *source* package 'vegan' ... >> ** libs >> make: *** No rule to make target `cepin.o', needed by `vegan.so'. Stop. >> *** arch - Rgnome >> Warning in file(con, "r") : >>cannot open file '/usr/lib/R/etc/Rgnome/Makeconf': No such file or >> directory >> Error in file(con, "r") : cannot open the connection >> * removing '/usr/local/lib/R/site-library/vegan' >> >> The downloaded packages are in >> '/tmp/RtmpYgJz5c/downloaded_packages' >> Warning message: >> In install.packages("vegan") : >>installation of package 'vegan' had non-zero exit status >> == >> >> I try to find the problem without success. >> >> Anybody can help-me? >> >> Thanks >> Ronaldo >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > -- 2ª lei - Na pesquisa, o que importa é o que está correto, e nÃ
Re: [R] Problem with vegan package instalation on linux
Hi, I try with --no-multiarch and it work now. I use the same R version in both systems: R version 2.12.2 (2011-02-25) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) Now, how to make the --no-multiarch option default to R install in my problematic system. Thanks very much Ronaldo Em 09-03-2011 13:24, Prof Brian Ripley escreveu: > R CMD INSTALL --no-multiarch -- 1ª lei - Suas férias começam após a defesa e entrega de sua dissertação. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Stress in metaMDS from vegam package
Hi, I have a newbie doubt. I try to use metaMDS in R, it is OK, but the stress that I get is 16.32, in other programs stress is showed like 0.173. I don't find a good explanation about this calculations on books, I think that R show stress em a percentage data (0-100) and other software in a proportional data (0-1), it is correct? Thanks Ronaldo -- 11ª lei - Você deve conhecer mais de sua dissertação do que seu orientador. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Very simple question
Hi, I have a very simple doubt. Look: > teste <- c("A","B","C") > teste2 <- paste(teste[1],teste[2],teste[3],sep="+") > teste2 [1] "A+B+C" > How to make it automatic, like I try to use paste(teste,sep="+") but the paste dont get the teste elements separately to join again in a unique element. Exist any function to associated with paste make this result more automatically. Thanks Ronaldo -- 17ª lei - Seu orientador quer que você se torne famoso, de modo que ele possa, finalmente, se tornar famoso. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Very simple question
Thanks That is it really simple. Ronaldo Em 08-04-2011 07:48, Mario Valle escreveu: > paste(teste, collapse="+") > > ciao! > mario > > On 08-Apr-11 12:44, Ronaldo Reis Junior wrote: >> teste <- c("A","B","C") > -- 1ª lei - Suas férias começam após a defesa e entrega de sua dissertação. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help in cluster MPI and R
Hi, ImountedanMPIclusterwithdebian.I installedthepackagesnecessarytorunusingRinthiscluster,butunsuccessfully, thefunctionsofexampleswere runbutonlyin theserver processorin the cluster.I thinkitlacks an essentialconfigurationofR packagesfor him tocommunicatewith thecluster.AnyoneknowanymorebasictutorialforusingRin thiscluster?Theclusteralreadyexistsand is functioning. Anyhelp iswelcome. Thanks Ronaldo -- 2ª lei - Na pesquisa, o que importa é o que está correto, e não quem está correto. --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228. > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem with object inside a function
Hi all, I have a problem with an object inside a formula in a function that I make. I create an object named qvartemp. This object is OK, look the levels: > print(levels(qvartemp)) [1] "baixomedio" "alto" Now I create a new object with a new formula: > new.form <- as.formula(gsub(qvar,"qvartemp",as.expression(mma$formula))) Look this new object: > print(new.form) Riqueza ~ Biomassa * qvartemp Now here is the problem, I try to update an existing model (mma) changing the formula by the new.form mmaa <- update(mma,new.form) But my function is aborted with this message: Error in eval(expr, envir, enclos) : object "qvartemp" not found If I create this object qvartemp in R section manually it my function work, because it get the object from my workspace (but it is usefull just for testing), but my function dont find this object qvartemp created inside the function. If I run all my function line by line without use the function it work, I think that is because in this case the object is created in my workspace. But when I run a function the object is created only in memory (not in my workspece) and in this case update dont find this object. Anybody can suggest any Idea to fix it? I necessary I send my function and a example. Thanks Ronaldo -- Everywhere is within walking distance if you have the time. -- Steven Wright. -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with object inside a function
Em Dom 20 Abr 2008, Ronaldo Reis Junior escreveu: > Hi all, > > I have a problem with an object inside a formula in a function that I make. > > I create an object named qvartemp. This object is OK, look the levels: > > print(levels(qvartemp)) > > [1] "baixomedio" "alto" > > Now I create a new object with a new formula: > > new.form <- as.formula(gsub(qvar,"qvartemp",as.expression(mma$formula))) > > Look this new object: > > print(new.form) > > Riqueza ~ Biomassa * qvartemp > > Now here is the problem, I try to update an existing model (mma) changing > the formula by the new.form > > mmaa <- update(mma,new.form) > > But my function is aborted with this message: > > Error in eval(expr, envir, enclos) : object "qvartemp" not found > > If I create this object qvartemp in R section manually it my function work, > because it get the object from my workspace (but it is usefull just for > testing), but my function dont find this object qvartemp created inside the > function. > > If I run all my function line by line without use the function it work, I > think that is because in this case the object is created in my workspace. > But when I run a function the object is created only in memory (not in my > workspece) and in this case update dont find this object. > > Anybody can suggest any Idea to fix it? I necessary I send my function and > a example. > > Thanks > Ronaldo Completing the problem, if I use > mmaa <- glm(new.form) instead update(mma,new.form) the function work perfectly, but using update I can generalise my function and I need this. The problem is with update function, It maybe get the object differently, but I dont find the problem. Thanks Ronaldo -- Positive, adj.: Mistaken at the top of one's voice. -- Ambrose Bierce, "The Devil's Dictionary" -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with object inside a function
Em Dom 20 Abr 2008, Duncan Murdoch escreveu: > On 20/04/2008 9:40 AM, Ronaldo Reis Junior wrote: > > Hi all, > > > > I have a problem with an object inside a formula in a function that I > > make. > > > > I create an object named qvartemp. This object is OK, look the levels: > >> print(levels(qvartemp)) > > > > [1] "baixomedio" "alto" > > > > Now I create a new object with a new formula: > >> new.form <- as.formula(gsub(qvar,"qvartemp",as.expression(mma$formula))) > > > > Look this new object: > >> print(new.form) > > > > Riqueza ~ Biomassa * qvartemp > > > > Now here is the problem, I try to update an existing model (mma) changing > > the formula by the new.form > > > > mmaa <- update(mma,new.form) > > > > But my function is aborted with this message: > > > > Error in eval(expr, envir, enclos) : object "qvartemp" not found > > > > If I create this object qvartemp in R section manually it my function > > work, because it get the object from my workspace (but it is usefull just > > for testing), but my function dont find this object qvartemp created > > inside the function. > > > > If I run all my function line by line without use the function it work, I > > think that is because in this case the object is created in my workspace. > > But when I run a function the object is created only in memory (not in my > > workspece) and in this case update dont find this object. > > > > Anybody can suggest any Idea to fix it? I necessary I send my function > > and a example. > > Formulas have attached environments; that's where they look for the > variables they use. You created new.form, but didn't give it the > environment of the old one. > > I think all you need is > > environment(new.form) <- environment(mma$formula) > > Duncan Murdoch Hi Duncan, thanks for your quick reply. I think that is not the problem, because with glm or lm the formula inside the new.form work, only on update it dont work. But I try this solution, I put new.form enclosed in an environment: environment(new.form) <- environment(as.formula(gsub(qvar,"qvartemp",as.expression(mma$formula But the error is the same. Thanks Ronaldo -- Ned, I am a maiden. -- palíndromo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on X11 under Linux (newbie)
Em Seg 28 Abr 2008, Dumblauskas, Jerry escreveu: > Thx > > I verified by typing in plot(1,1) at the R prompt -- sure enough an X > window popped up on my desktop. > > Off to investigate Linux GUI front ends! > > Thx again Hi, at this moment the best IDE to use R on Linux in my opinion are in sequence: 1) emacs+ess 2) jgr 3 rgnome there are some others more complete GUI like Rcommander, pmg, rkward -- . _|_ .-' '-. / \ ^|^ | ejm97 \_/ -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Survival Regression with multiple records per subject
Em Qua 30 Abr 2008, Fabian Hefner escreveu: > Here is an example: > > itm ID exercise time > 1.401869 1 0 1 > 1.324390 1 0 2 > 1.324390 1 0 3 > 1.38 1 0 4 > 1.346761 1 0 5 > 1.315441 1 1 6 > 1.337812 2 0 1 > 1.319915 2 0 2 > 1.351235 2 1 3 > itm is the covariate; > ID is the subject Id; > exercise indicates if the subject is dead=1 or alive=0 > > How can I allocate the multiple records to one subject (for example record > 1-6 are part of subject with ID 1 record 7-9 are part of subject with ID2) > and process a survival regression. Hi, If I got it, the time must be converted to time to death, your table must be: >itm ID exercise time to death > 1.31544111 6 > 1.35123521 3 The problem is your itm covariate, may be it must be converted to de difference between the first value and the last value. Inte Ronaldo -- "Send lawyers, guns and money..." -- Lyrics from a Warren Zevon song -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Errors bar in barchart
Hi, I user barplot2 to make a plot bar with errors bars. In old times I needed to use a sequence of segments commands to make this. Now I try to make the same but using lattice. Is possible to use barplot2 in barchart function? If not, what is the simplest way to put errors bar in barchart? I try to find an example in Lattice book, but dont find anythink like this. Thanks a lot Inté Ronaldo -- You have a tendency to feel you are superior to most computers. -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Errors bar in barchart
Em Sex 02 Mai 2008, Deepayan Sarkar escreveu: > On 5/2/08, Ronaldo Reis Junior <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I user barplot2 to make a plot bar with errors bars. In old times I > > needed to use a sequence of segments commands to make this. > > > > Now I try to make the same but using lattice. Is possible to use > > barplot2 in barchart function? > > > > If not, what is the simplest way to put errors bar in barchart? I try to > > find an example in Lattice book, but dont find anythink like this. > > No there isn't. > > I don't like the idea of error bars on bar charts, and I would suggest > you use them with dot plots instead. There is a demo of this that you > can run using > > > demo("intervals", package = "lattice") > > -Deepayan Thanks, I get it. I dont like this idea too, but some people living in the past (Jethro?) Thanks Ronaldo -- If you wait long enough, it will go away... after having done its damage. If it was bad, it will be back. -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Very simple question on plot
Hi, I try to make a plot like this: Y | | | o | oo | o o | o o |o o o | 0 10 20 30 40 50 60 70 80 90 100 (A) 100 90 80 70 60 50 40 30 20 10 0 (B) or B 100 90 80 70 60 50 40 30 20 10 0 Y | | | o | oo | o o | o o |o o o | 0 10 20 30 40 50 60 70 80 90 100 A A and B are complementary variables. How is the best way to make this plot? Thanks Ronaldo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] change the panel name in xyplot
Hi, I try to change the panel name in a xyplot without success. Look this example from xyplot manual: xyplot(Murder ~ Population | state.region,data=states) The panel title are: Northeast, South, North Central, West, that are factor from state.region. I need do change some names and, for example, put some of these in italic. I dont find how change this. I looking for this in Deepayan Sakar lattice book, but I dont find the way. Any help? Thanks Ronaldo -- "You can't make a program without broken egos." -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8192 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/lecc | ICQ#: 5692561 | LinuxUser#: 205366 -- Favor NÃO ENVIAR arquivos do Word ou Powerpoint Prefira enviar em PDF, Texto, OpenOffice (ODF), HTML, or RTF. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] factors ordered by mean
Hi, How to order the levels os factor not by alphabetic order but by mean of Y. Somethink like this: I have this alphabetic order: > levels(pH) [1] "alto" "baixo" "medio" the order by mean os yvar is: > sort(tapply(Riqueza,pH,mean)) baixomedio alto 11.56667 20.0 26.8 How to make the levels of pH ordered by this mean to the result to see somethink like this: > levels(pH) [1] "baixo" "medio" "alto" I try this to make a function that I need to get ordered levels by this mean and after rename to make a automatic contrasts by comparing models. > levels(pH)[1] <- "baixomedio" > levels(pH)[2] <- "baixomedio" > levels(pH) [1] "baixomedio" "alto" and after this a make a new model to be compared with a model with 3 levels where "baixo" and "medio" is separated. without ordered levels these command is wrong because the levels(pH)[1] is "alto" and not "baixo". Normally I use recode from car package, but for automatization your syntax is a difficult. Thanks Ronaldo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] update don't find an object
Hi, I have a situation here. I try this update: mmaa <- update(mma,biomass~qvartemp) but I have this message: Error in eval(expr, envir, enclos) : object "qvartemp" not found but this object exist: [1] "cont" "i" "levelsord" "mma" "qvar" "qvarmma" [7] "qvartemp" "test" "yvar" but if I use the glm directly it work: mmaa <- glm(biomass~qvartemp) Call: glm(formula = biomass ~ qvartemp) Deviance Residuals: Min 1Q Median 3Q Max -99.500 -57.5216.125 40.688 221.750 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 509.25 21.73 23.434 <2e-16 *** qvartempn5060.08 37.64 1.596 0.1225 qvartempr5101.25 37.64 2.690 0.0123 * qvartempr10 101.42 37.64 2.694 0.0122 * I need to use update because other informations like family, weigths, etc Anybody have any idea about this problem in update? Thanks Ronaldo -- If it were not for the presents, an elopement would be preferable. -- George Ade, "Forty Modern Fables" -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] factors ordered by mean
Em Qua 20 Fev 2008, Henrique Dallazuanna escreveu: > Try this: > factor(pH,levels=names(sort(tapply(Riqueza,pH,mean > Thanks it work Ronaldo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] update don't find an object
Em Qui 21 Fev 2008, David Winsemius escreveu: > Ronaldo Reis Junior <[EMAIL PROTECTED]> wrote in > > news:[EMAIL PROTECTED]: > > I try this update: > > > > mmaa <- update(mma,biomass~qvartemp) > > That does not look like it has proper arguments to update.formula. As > the update() help page suggests: > > ?update.formula > > You should have included the call that created "mma". Assuming that > "mma" is a model object, and the dependent variable in that model was > "biomass", then perhaps: > > mmaa <- update(mma, ~ . + qvartemp) # ... is what you wanted? > > On the other hand, I do not see "biomass" in your list of objects below, > so who knows? If these guesses are wrong, then re-read the posting guide > and provide more detail. > > > but I have this message: > > > > Error in eval(expr, envir, enclos) : object "qvartemp" not found > > > > but this object exist: > > > > [1] "cont" "i" "levelsord" "mma" "qvar" > > "qvarmma" [7] "qvartemp" "test" "yvar" > > > > but if I use the glm directly it work: > > > > mmaa <- glm(biomass~qvartemp) > > I guess "biomass" must exist . More guessing: Is it in one of > those other objects that you attach()ed before the call to glm()? > > > > > Anybody have any idea about this problem in update? > > I doubt that it is a problem in update. David, I don't understand this problem, in console it work, but in script id don't work. Look a example: ### The data set > clippingdata <- structure(list(biomass = c(551L, 457L, 450L, 731L, 499L, 632L, 595L, 580L, 508L, 583L, 633L, 517L, 639L, 615L, 511L, 573L, 648L, 677L, 417L, 449L, 517L, 438L, 415L, 555L, 563L, 631L, 522L, 613L, 656L, 679L), clipping = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 5L, 5L, 5L, 5L, 5L, 5L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("control", "n25", "n50", "r10", "r5"), class = "factor")), .Names = c("biomass", "clipping" ), class = "data.frame", row.names = c(NA, -30L)) > attach(clippingdata) ### copying the variable > clipping2 <- clipping ### recode the variable to n-1 levels > levels(clipping2)[1] <- "controln25" > levels(clipping2)[2] <- "controln25" ### Show the levels > levels(clipping2) [1] "controln25" "n50""r10""r5" ### Make a model > m <- glm(biomass~clipping) ### View the model > m Call: glm(formula = biomass ~ clipping) Coefficients: (Intercept) clippingn25 clippingn50 clippingr10 clippingr5 465.1788.17 104.17 145.50 145.33 Degrees of Freedom: 29 Total (i.e. Null); 25 Residual Null Deviance: 209400 Residual Deviance: 124000 AIC: 346.9 ### making a new formula, I need to make this to generalise the program. > new.form <- as.formula(gsub("clipping","clipping2",as.expression(m$formula))) > new.form biomass ~ clipping2 ### making a new model using this new form > mma <- update(m,new.form) > mma Call: glm(formula = biomass ~ clipping2) Coefficients: (Intercept) clipping2n50 clipping2r10 clipping2r5 509.25 60.08101.42101.25 Degrees of Freedom: 29 Total (i.e. Null); 26 Residual Null Deviance: 209400 Residual Deviance: 147300 AIC: 350.1 ### Comparing model > anova(m,mma,test="F") Analysis of Deviance Table Model 1: biomass ~ clipping Model 2: biomass ~ clipping2 Resid. Df Resid. Dev Df Deviance F Pr(>F) 125 124020 226 147340 -1 -23320 4.7009 0.03987 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 This is all idea of script, it work in console, but in script only the directly use of glm work, the update don't work. But is the same think. I don't find the error. using my script to make all automatic > contstep(yvar="biomass",qvar="clipping",mma=m,test="F") This the result is start: -- Níveis atuais control n25 n50 r5 r10 ### this is the result of print(qvartemp) Resultado do contraste a 5% de significância [1] controln25 controln25 controln25 controln25 controln25 controln25 [7] n50n50n50n50n50n50 [13] r5 r5 r5 r5 r5 r5 [19] controln25 controln25 controln25 controln25 controln25 controln25 [25] r
[R] Script to start Rcmdr
Hi, anybody know any way to make a bash script to start Rcmdr directly widthout need to open R and execute library(Rcmdr)? I try to make this using R CMD BATCH somethink, but dont find the way. Thanks Ronaldo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help in substitute function
Hi, I try to use a substitute function to generalise a equation. I have this: expression(1+2*pred+3*lat) I need to define the equation in function of x1 and x2 variables. Also I try to define who is x1 and x2. I try this: X1 <- "pred" X2 <- "lat" Now I need substitute pred and lat in equation by x1 and x2 defined on X1 and X2 above, I try this way: > substitute(expression(1+2*pred+3*lat),list(as.name(X1)=as.name(x1),as.name(X2)=as.name(x2)) Error: unexpected '=' in "substitute(expression(1+2*pred+3*lat),list(as.name(X1)=" My expected result is: expression(1 + 2 * x1 + 3 * x2) Any help? Thanks Ronaldo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Make playwith a default graphic device
Hi, I looking for a graphic device on Linux with more functionalities than the X11 (). I find the plotAndPlayGTK package and the playwith function. It is a good device. It is possible to make it default in my system. Now I need: > library(plotAndPlayGTK ) Loading required package: RGtk2 Loading required package: cairoDevice > > playwith(plot(1,1)) Error in plot.new() : figure margins too large I got this error above, I dont know why? But in the device I edit call ant it work. But I try to put it default and make a more simple use llike this: plot(1,1) and it use a playwith device to make a plot. It is possible? Thanks Ronaldo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Make playwith a default graphic device
Em Dom 14 Out 2007, Prof Brian Ripley escreveu: > You seem to be under the misapprehension that playwith() is a graphics > device: it is not. > > To set a graphics device as the default, use options(device=). I am not > sure what 'more functionalities' you are looking for: the playwith() uses > the cairoDevice package for its graphics device, and there is also the > Cairo package. > Dear Prof. Ripley, thanks for your explanation. I looking for a linux' device that have a minimal feature like the windows' device. Features like: save as on mouse clic and/or a menu, change graphics' page on clic, etc. Thanks Ronaldo -- He maps spam, eh? -- palíndromo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Package to make stepwise model selection using F or Chisq test
Hi, I looking for a method that use F or Chisq test instead of AIC in a stepwise modelo selection. I try the grasp package using the grasp.step.anova, but It dont work. > library(grasp) Carregando pacotes exigidos: gam Carregando pacotes exigidos: splines Carregando pacotes exigidos: mda Carregando pacotes exigidos: class > data(anorexia,package="MASS") > > m1 <- glm(Postwt ~ Prewt * Treat,data=anorexia) > > m1.grasp <- grasp.step.anova(m1,scope=list(upper=~ Prewt * Treat,lower=~1),trace=1,direction="both") # # FUNCTION: grasp.step.anova # (by Splus, adapted by A. Lehmann from step.gam) # grasp.step.anova is a modified version of step.gam of Splus using ANOVA based on Chi or F tests instead # of AIC criteria # Erro em grasp.step.anova(m.pres, scope = list(upper = ~(ProfSer + NgalhoSer + : objeto "OPTIONS" não encontrado Looking for OPTIONS in the code I found that this need a P.limit in an OPTIONS object. I make it. > OPTIONS <- NULL > OPTIONS$P.limit <- 0.05 > m.pres.step <- grasp.step.anova(m.pres,scope=list(upper=~(ProfSer+NgalhoSer+CTOTAL+DensRamos+Htotal+CAP)^3,lower=~1),trace=1,direction="both") # # FUNCTION: grasp.step.anova # (by Splus, adapted by A. Lehmann from step.gam) # grasp.step.anova is a modified version of step.gam of Splus using ANOVA based on Chi or F tests instead # of AIC criteria # Erro em untangle.scope(object$terms, scope) : The elements of a regimen 1 appear more than once in the initial model > Dont work and grasp manual is incomplete. Anybody know other package to make this? Thanks Ronaldo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.