[R] [R-pkgs] RSiteSearch package?
A new RSiteSearch package is now available on CRAN. This makes it much easier to find things among contributed packages (including all CRAN packages). The capabilities are further described in system.file('doc', 'RSiteSearch.pdf', package='RSiteSearch'). Spencer Graves Sundar Dorai-Raj Romain Francois ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] Randomized-complete blocks design and R
alis villiyam aalisiyan at gmail.com writes: I am new in R.I am trying to analysis of variance for Randomized-complete blocks design. I have 4 treatments and 3 replication, Without intraction.then .I is going to use LSD test or Duncan test for comparison between average values of treatments. I want to know, is there any significant change between treatment and between weeks? Because I did experiment for 8 weeks. Try lme in package nlme, but you need the documentation in the book by Pinheiro/Bates to get started, otherwise there is little chance. Something like (assuming repl is numeric, or a time) summary(lme(effect~treat*repl, data=mydata, random=~1|subject)) Possible followed by a multiple comparison test of the contrasts from package multcomp. If you only do it once, you might get results faster by using SPSS or Systat (I avoid mentioning the three-letter alternative here) Dieter __ 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] levelplot question
Hi Greg and all the others, thanks for your answer. The color-vector has the same length like the at-vector but the recycling cannot be the reason, because only values slightly above my threshold doe not appear blue. I cannot find a good explanation of which colors are assigned to which value ranges. I've made little example: # mat - matrix(seq(1,5, length.out = 12), nrow = 3) mat[1,2] - 3.5 my.at - seq(0.5,5.5) my.col.regions - rainbow(6) graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = my.col.regions) print(graph) windows() plot(1:10) legend(topleft, legend = as.character(my.col.regions), col = my.col.regions, pch = 18) # As you can see the green (position 3 in my.col.regions) disappears completely in the levelplot (look at the color range at the right side!). I guess it might also happen in my case... I've tested several cases and it looks like the length of the color-vector should be one less than the at vector (which would make sense). Then, the rule might apply: [ at[1],at[2] ] = color[1] ( at[2],at[3] ] = color[2] ... ( at[n-1],at[n] ] = color[n-1] Please correct me if I'm wrong!!! Antje __ 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] Hierarchical Diagram of Networks in sna or otherwise?
On Mon, May 4, 2009 at 8:31 PM, jebyrnes byr...@msi.ucsb.edu wrote: Nearly. The algorithm turns up slightly different graphs each time (and set.seed doesn't seem to make it consistent) Hmmm, that should not happen, I'll check it out. and periodically chokes. Can you send me the graph for which this happens? But better than what I had. Hrm. I don't know much about the algorithm graphviz uses for dot. Do you have a reference on hand? No, I don't. Have you checked the graphviz homepage? If it's simple, I'd be willing to take a whack at it. I doubt that it is simple, but I think it would be very useful to have a free implementation. (I would have already ported the graphviz layout algorithms to igraph, but their licenses are not compatible.) Best, Gabor Gábor Csárdi-2 wrote: Jarrett, the 'igraph' package has a layout called layout.reingold.tilford that is designed for trees, there is a slight chance that it is good enough for you. Best, Gabor On Wed, Apr 29, 2009 at 10:11 PM, jebyrnes byr...@msi.ucsb.edu wrote: I've been using sna to work with some networks, and am trying to visualize them easily. My networks are hierarchical (food webs). All of the layout engines I've tried with gplot don't seem to plot hierarchical networks, as one would using dot from graphviz. While I could do all of this by outputting to dotfiles and running it through graphviz, the graphics I get from R are much cleaner, and more easily integrated into my analyses. Is there any good way to diagram a hierarchical network in R, either with the sna library or otherwise? It strikes me that at least the Netindices package can calculate trophic levels. Could this be used for node placement? -Jarrett -- View this message in context: http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23301819.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Gabor Csardi gabor.csa...@unil.ch UNIL DGM __ 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. -- View this message in context: http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23374024.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Gabor Csardi gabor.csa...@unil.ch UNIL DGM __ 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] Heatmap without levelplot
Hi there, as I'm not sure to understand the coloring levelplot uses, I'm looking for another easy way to create a heatmap like this: library(lattice) mat - matrix(seq(1,5, length.out = 12), nrow = 3) mat[1,2] - 3.5 my.at - seq(0.5,5.5, length.out = 6) my.col.regions - rainbow(5) graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = my.col.regions) print(graph) Can anybody help me with some hints or little examples? Antje __ 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] prob in predict(randomForest)
Hi at all, maybe this question is quite simple for a statistician, but for me it is not. After reading a lot of mail in the R-help archive I`m still not quite sure I get it. When applying a randomForest to a new dataset with predict(randomForest) I have the option to get the output as probability (classification problem): predict(myrf,...,type=prob) I would like to know how I have to understand this output. Are this values the probability of an observation belonging to a predicted class? Say, I have a data-point as newdata, my rf-model predicts Class A and the probability is 0,12301. Does this mean that this data-point belongs to class A only with a probability of 12%? Thanks for every hint. TIM Just as a matter of form: I´m using R version 2.8.1, randomForest package 4.5-28, OS: WinXP --- Tim Häring Bavarian State Institute of Forest Research Department of Forest Ecology Am Hochanger 11 D-85354 Freising E-Mail: tim.haer...@lwf.bayern.de http://www.lwf.bayern.de __ 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] Time series ARIMAX and multivariate models
Dear Lillian, I would request you if you provide me the knowledge of how build ARIMAX model in R? It would be great help for me. Thanks Ramanath [[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] smoothing spline in package gam
dear all, i have a little question, but it make me torment long time hope you can help me and give some advices , thanks i use smoothing spline in package gam the model m1=gam(y~ost+wst+park10+sch50+comm+build+suite+y05+y06+y07+y99+y98+s(builarea)+s(age)+s(fl)+s(totfl)+s(cbd)+s(redl)) and summary(m1) can show the s(smoothing) variables' Signif. codes. but i also want to know the Parametric coefficients and their Signif. codes. like ost, wst...etc. is that possible to get the Parametric coefficients' Signif. codes (in package gam) ? thanks~~ _ [[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] About the Transfer Function Model(ARIMAX)
Dear David, Thanks for your reply. I would request you to please provide me an example where The ARIMAX model have been developed with two exogeneous variables. I would be highly obliged if you kindly help me by providing me the same. Regards Ramanath - Original Message - From: David Winsemius dwinsem...@comcast.net To: Ramanath Roy r@decisioncraft.com Cc: r-help@r-project.org Sent: Monday, May 04, 2009 7:35 PM Subject: Re: [R] About the Transfer Function Model(ARIMAX) pages 43-54 of: http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf ... is an article by Uwe Ligges on accesssing source code. On Apr 2, 2009, at 4:20 AM, Ramanath Roy wrote: Dear ALL, I would appreciate if someone help me by letting me know the code of above model in R.I would request you to please let me know how i could make arimax model in auto.arima. David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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] Support Vector Machines
In the R-help of the svm function of the package e1071 it's explained that this function also makes estimation of density. But when i made for example X-rnorm(1000) m-svm(X) I just have a binary classification of X like SVM do whereas i want an estimation of the density which generates our sample X ... I don't know if it's possible and if someone has already use this function to do that. Thanks. David Winsemius wrote: On May 4, 2009, at 8:52 AM, excalibur wrote: This question is still unanswered. Unanswered questions are often those which do not comply with the guidelines in the Posting Guide. Many people have gotten tired of either making up examples or of writing Read the Posting Guide, so they just ignore them. Someone can explain me how use the svm function to make density estimation ? If you post an executable bit of code that shows how you are doing those operations, then I suspect someone will answer. excalibur wrote: Hi, i try to use function svm of package e1071 to estimate a density. But if my data are X=(X1,...,Xn) and m-svm(X) some values of m$SV are less than 0. I don't see how i can get the estimation of the density with this function. Thanks for your help. Rémi David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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. -- View this message in context: http://www.nabble.com/Support-Vector-Machines-tp19069442p23382683.html Sent from the R help mailing list archive at Nabble.com. __ 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] Can't build termstrc package from source
Hi, I'm trying to build the termstrc 1.1 package from its source on R 2.7.2 on Windows XP. However instead of building the package it just zips the entire source into a .tar.gz file. This is the first time I'm trying to build an R package from source. I installed the R toolset for Windows and set RTools as well as Perl MinGW directories in the path. Anybody tried this out? Any file missing in the source? Any help is appreciated. Thanks, Chirantan Visit us at http://www.2pirad.com [[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] Reversing axis label order
Steve Murray wrote: Dear R Users, I am executing the following command to produce a line graph: matplot(aggregate_1986[,1], aggregate_1986[,2:3], type=l, col=2:3) On the x-axis I have values of Latitude (in column 1) ranging from -60 to +80 (left to right on the x-axis). However, I wish to have these values shown in reverse on the x-axis, going from +80 to -60 (ie. North to South in terms of Latitude). I have tried doing this by altering the command as follows: matplot(-aggregate_1986[,1], aggregate_1986[,2:3], type=l, col=2:3) ...but this produces the inverse sign of the latitude values along the axis - ie. it goes from -80 to +60. How do I reverse the display of the axis labels correctly and of course, maintain the associated data values correctly? Hi Steve, Have a look at rev.axis in the plotrix package. Jim __ 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] noisy quantisation
The following creates a point process version of a sinewave (maybe there's a better way): p-amp*cos(2*pi*freq*(1:n)/n ) + 0.5 as.numeric(runif(1:n)p) I get something like this: 1ooo ooo oo o 0 ooo o o o o o ooo ooo In case it's not obvious, this is a noisy version of 1 oooooo 0 oooooo I was wondering if anyone can suggest a way to create a version where I get 0s, 1s, and 2s something like a noisy version of this: 2 oo 1o o o 0 ooo I am looking for a version of the top graph except with 3 levels instead of 2. Thanks very much for any help Bill __ 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] limits
Hey, what is the R function for the mathematical limit ? e.g. to calculate and return the amount that the expression X^2 +X +2 approach as X approach 2 (X- 2) thanks hassan [[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] stepAICc function (based on MASS:::stepAIC.default)
Dear all, I have tried to modify the code of MASS:::stepAIC.default(), dropterm() and addterm() to use AICc instead of AIC for model selection. The code is appended below. Somehow the calculations are still not correct and I would be grateful if anyone could have a look at what might be wrong with this code... Here is a working example: ## require(nlme) model1=lme(distance ~ age + Sex, data = Orthodont, random =~1) stepAICc.Christoph(model1) ## this gives the correct initial AICc value, but wrong values inside the stepAICc (and probably dropterm.AICc) function. All three functions are appended below. Many thanks and best wishes, Christoph ## stepAICc.Christoph=function (object, scope, scale = 0, direction = c(both, backward, forward), trace = 1, keep = NULL, steps = 1000, use.start = FALSE, k = 2, ...) { mydeviance - function(x, ...) { dev - deviance(x) if (!is.null(dev)) dev else extractAIC(x, k = 0)[2L] } cut.string - function(string) { if (length(string) 1L) string[-1L] - paste(\n, string[-1L], sep = ) string } re.arrange - function(keep) { namr - names(k1 - keep[[1L]]) namc - names(keep) nc - length(keep) nr - length(k1) array(unlist(keep, recursive = FALSE), c(nr, nc), list(namr, namc)) } step.results - function(models, fit, object, usingCp = FALSE) { change - sapply(models, [[, change) rd - sapply(models, [[, deviance) dd - c(NA, abs(diff(rd))) rdf - sapply(models, [[, df.resid) ddf - c(NA, abs(diff(rdf))) AICc - sapply(models, [[, AICc) heading - c(Stepwise Model Path \nAnalysis of Deviance Table, \nInitial Model:, deparse(as.vector(formula(object))), \nFinal Model:, deparse(as.vector(formula(fit))), \n) aod - if (usingCp) data.frame(Step = change, Df = ddf, Deviance = dd, `Resid. Df` = rdf, `Resid. Dev` = rd, Cp = AICc, check.names = FALSE) else data.frame(Step = change, Df = ddf, Deviance = dd, `Resid. Df` = rdf, `Resid. Dev` = rd, AICc = AICc, check.names = FALSE) attr(aod, heading) - heading class(aod) - c(Anova, data.frame) fit$anova - aod fit } Terms - terms(object) object$formula - Terms if (inherits(object, lme)) object$call$fixed - Terms else if (inherits(object, gls)) object$call$model - Terms else object$call$formula - Terms if (use.start) warning('use.start' cannot be used with R's version of glm) md - missing(direction) direction - match.arg(direction) backward - direction == both | direction == backward forward - direction == both | direction == forward if (missing(scope)) { fdrop - numeric(0) fadd - attr(Terms, factors) if (md) forward - FALSE } else { if (is.list(scope)) { fdrop - if (!is.null(fdrop - scope$lower)) attr(terms(update.formula(object, fdrop)), factors) else numeric(0) fadd - if (!is.null(fadd - scope$upper)) attr(terms(update.formula(object, fadd)), factors) } else { fadd - if (!is.null(fadd - scope)) attr(terms(update.formula(object, scope)), factors) fdrop - numeric(0) } } models - vector(list, steps) if (!is.null(keep)) keep.list - vector(list, steps) if (is.list(object) (nmm - match(nobs, names(object), 0)) 0) n - object[[nmm]] else n - length(residuals(object)) fit - object bAIC- extractAIC(fit, scale, k = k, ...) edf - bAIC[1L] #extracts the number of parameters, k=edf bAIC - bAIC[2L]+((2*edf*(edf+1))/(n-edf-1)) if (is.na(bAIC)) stop(AICc is not defined for this model, so stepAIC cannot proceed) nm - 1 Terms - terms(fit) if (trace) { cat(Start: AICc=, format(round(bAIC, 2)), \n, cut.string(deparse(as.vector(formula(fit, \n\n, sep = ) utils::flush.console() } models[[nm]] - list(deviance = mydeviance(fit), df.resid = n - edf, change = , AICc = bAIC) if (!is.null(keep)) keep.list[[nm]] - keep(fit, bAIC) usingCp - FALSE while (steps 0) { steps - steps - 1 AICc - bAIC ffac - attr(Terms, factors) if (!is.null(sp - attr(Terms, specials)) !is.null(st - sp$strata)) ffac - ffac[-st, ] scope - factor.scope(ffac, list(add = fadd, drop = fdrop)) aod - NULL change - NULL if (backward length(scope$drop)) { aod - dropterm.AICc(fit, scope$drop, scale = scale, trace = max(0, trace - 1), k = k, ...) rn - row.names(aod) row.names(aod) - c(rn[1L], paste(-, rn[-1L], sep = ))
[R] JGR
Dear R User I am using JGR on a Linux Ubuntu Computer with 2 Cpus When Opening JGR, one Cpu goes up to 100% even if no calculation is yet started Did any of you already noticed this strange behaviour? Thanks for your help Andrea __ 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 rgl package
Dear R People: Here is something strange. I'm using Ubuntu 9.04 with R 2.9.0. I need to have the rgl package. Here are my results from installing: install.packages(rgl) Warning in install.packages(rgl) : argument 'lib' is missing: using '/usr/local/lib/R/site-library' --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rgl_0.84.tar.gz' Content type 'application/x-gzip' length 1670659 bytes (1.6 Mb) opened URL == downloaded 1.6 Mb * Installing *source* package 'rgl' ... checking for gcc... gcc -std=gnu99 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for gcc... (cached) gcc -std=gnu99 checking whether we are using the GNU C compiler... (cached) yes checking whether gcc -std=gnu99 accepts -g... (cached) yes checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed checking for libpng-config... yes configure: using libpng-config configure: using libpng dynamic linkage checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/local/lib/R/site-library/rgl' The downloaded packages are in /tmp/RtmpiJh20a/downloaded_packages Warning message: In install.packages(rgl) : installation of package 'rgl' had non-zero exit status So presumably there is not an X11. But when I put in capabilities, it seems to be there. capabilities() jpeg png tifftcltk X11 aqua http/ftp sockets TRUE TRUE TRUE TRUE TRUEFALSE TRUE TRUE libxml fifo clediticonv NLS profmemcairo TRUE TRUE TRUE TRUE TRUE TRUE TRUE Has anyone run into this, please? What are the solutions, please? thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __ 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 rgl package
On 05/05/2009 5:55 AM, Erin Hodgess wrote: Dear R People: Here is something strange. I'm using Ubuntu 9.04 with R 2.9.0. I need to have the rgl package. Here are my results from installing: install.packages(rgl) Warning in install.packages(rgl) : argument 'lib' is missing: using '/usr/local/lib/R/site-library' --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rgl_0.84.tar.gz' Content type 'application/x-gzip' length 1670659 bytes (1.6 Mb) opened URL == downloaded 1.6 Mb * Installing *source* package 'rgl' ... checking for gcc... gcc -std=gnu99 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for gcc... (cached) gcc -std=gnu99 checking whether we are using the GNU C compiler... (cached) yes checking whether gcc -std=gnu99 accepts -g... (cached) yes checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed checking for libpng-config... yes configure: using libpng-config configure: using libpng dynamic linkage checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/local/lib/R/site-library/rgl' The downloaded packages are in /tmp/RtmpiJh20a/downloaded_packages Warning message: In install.packages(rgl) : installation of package 'rgl' had non-zero exit status So presumably there is not an X11. But when I put in capabilities, it seems to be there. capabilities() jpeg png tifftcltk X11 aqua http/ftp sockets TRUE TRUE TRUE TRUE TRUEFALSE TRUE TRUE libxml fifo clediticonv NLS profmemcairo TRUE TRUE TRUE TRUE TRUE TRUE TRUE Has anyone run into this, please? What are the solutions, please? Sounds as though you don't have the development libraries for X11, or perhaps the rgl configure script isn't finding them. Do you have libx11-dev installed? Duncan Murdoch __ 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] Can't build termstrc package from source
Chirantan Kundu wrote: Hi, I'm trying to build the termstrc 1.1 package from its source on R 2.7.2 on Windows XP. However instead of building the package it just zips the entire source into a .tar.gz file. This is the first time I'm trying to build an R package from source. I installed the R toolset for Windows and set RTools as well as Perl MinGW directories in the path. Anybody tried this out? Any file missing in the source? Any help is appreciated. It's hard to tell what you did wrong when you don't tell what you did. I suspect you need to study the difference between R CMD build R CMD INSTALL R CMD check R CMD build --binary -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ 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 rgl package
On Tue, May 5, 2009 at 10:55 AM, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: Here is something strange. I'm using Ubuntu 9.04 with R 2.9.0. I need to have the rgl package. Here are my results from installing: install.packages(rgl) Warning in install.packages(rgl) : [] checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/local/lib/R/site-library/rgl' So presumably there is not an X11. But when I put in capabilities, it seems to be there. R will have X11 capabilities if you have the X11 _binary_ library installed. To compile a package from source that needs to link with the X11 library you need the development headers. They come in another package. From the command line, do: sudo apt-get install libx11-dev and that should pull them from the Ubuntu repository. You'll need the root password for this. It's possible you may need some other development headers once you get past the X11 problem! Barry __ 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] Support Vector Machines
On May 5, 2009, at 3:49 AM, excalibur wrote: In the R-help of the svm function of the package e1071 it's explained that this function also makes estimation of density. But when i made for example X-rnorm(1000) m-svm(X) I just have a binary classification of X like SVM do whereas i want an estimation of the density which generates our sample X ... I don't know if it's possible and if someone has already use this function to do that. Use str() to look at the object returned by svm. The example in svm's help page uses the svm object's index variable although there are other components that are available for extraction. The fitted vector looks to have similar binary properties to index and the SV vector appears to be a distance measure. -- David Thanks. David Winsemius wrote: On May 4, 2009, at 8:52 AM, excalibur wrote: This question is still unanswered. Unanswered questions are often those which do not comply with the guidelines in the Posting Guide. Many people have gotten tired of either making up examples or of writing Read the Posting Guide, so they just ignore them. Someone can explain me how use the svm function to make density estimation ? If you post an executable bit of code that shows how you are doing those operations, then I suspect someone will answer. excalibur wrote: Hi, i try to use function svm of package e1071 to estimate a density. But if my data are X=(X1,...,Xn) and m-svm(X) some values of m$SV are less than 0. I don't see how i can get the estimation of the density with this function. Thanks for your help. Rémi David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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. -- View this message in context: http://www.nabble.com/Support-Vector-Machines-tp19069442p23382683.html Sent from the R help mailing list archive at Nabble.com. __ 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. David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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] noisy quantisation
William Simpson william.a.simpson at gmail.com writes: p-amp*cos(2*pi*freq*(1:n)/n ) + 0.5 I was wondering if anyone can suggest a way to create a version where I get 0s, 1s, and 2s something like a noisy version of this: 2 oo 1o o o 0 ooo # It's always polite to add the trivial parts that # make the example run out of the box amp = 1 freq = 5 n = 100 p = 0.1 # Well, this is not a noisy version, but one with added spikes # If that's ok for you, take it p = amp*cos(2*pi*freq*(1:n)/n ) + 0.5* as.numeric(runif(1:n)p) plot(p,type=l) # Note: the example must be modified for other values of amp pquant = ((p+1)*3) %/% 3 -1 lines(pquant) #- Dieter __ 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] Heatmap without levelplot
Antje niederlein-rstat at yahoo.de writes: as I'm not sure to understand the coloring levelplot uses, I'm looking for another easy way to create a heatmap like this: library(lattice) mat - matrix(seq(1,5, length.out = 12), nrow = 3) mat[1,2] - 3.5 my.at - seq(0.5,5.5, length.out = 6) my.col.regions - rainbow(5) graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = my.col.regions) print(graph) Looks fine to me, so what's wrong? Maybe have a look at RColorBrewer to get more pleasing colors. Dieter __ 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 rgl package
On 5 May 2009 at 04:55, Erin Hodgess wrote: | Dear R People: | | Here is something strange. I'm using Ubuntu 9.04 with R 2.9.0. | | I need to have the rgl package. Here are my results from installing: So run sudo apt-get install r-cran-rgl to install the pre-build binary. If you must or want to build it yourself, use the packaging system to get the build-dependencies installed: sudo apt-get build-dep r-cran-rgl | install.packages(rgl) | Warning in install.packages(rgl) : | argument 'lib' is missing: using '/usr/local/lib/R/site-library' | --- Please select a CRAN mirror for use in this session --- | Loading Tcl/Tk interface ... done | trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rgl_0.84.tar.gz' | Content type 'application/x-gzip' length 1670659 bytes (1.6 Mb) | opened URL | == | downloaded 1.6 Mb | | * Installing *source* package 'rgl' ... | checking for gcc... gcc -std=gnu99 | checking for C compiler default output file name... a.out | checking whether the C compiler works... yes | checking whether we are cross compiling... no | checking for suffix of executables... | checking for suffix of object files... o | checking whether we are using the GNU C compiler... yes | checking whether gcc -std=gnu99 accepts -g... yes | checking for gcc -std=gnu99 option to accept ISO C89... none needed | checking how to run the C preprocessor... gcc -std=gnu99 -E | checking for gcc... (cached) gcc -std=gnu99 | checking whether we are using the GNU C compiler... (cached) yes | checking whether gcc -std=gnu99 accepts -g... (cached) yes | checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed | checking for libpng-config... yes | configure: using libpng-config | configure: using libpng dynamic linkage | checking for X... no | configure: error: X11 not found but required, configure aborted. You don't have X11 headers. Run the second command above if you really want to build the package. | ERROR: configuration failed for package 'rgl' | ** Removing '/usr/local/lib/R/site-library/rgl' | | The downloaded packages are in | /tmp/RtmpiJh20a/downloaded_packages | Warning message: | In install.packages(rgl) : | installation of package 'rgl' had non-zero exit status | | So presumably there is not an X11. But when I put in capabilities, | it seems to be there. | | capabilities() | jpeg png tifftcltk X11 aqua http/ftp sockets | TRUE TRUE TRUE TRUE TRUEFALSE TRUE TRUE | libxml fifo clediticonv NLS profmemcairo | TRUE TRUE TRUE TRUE TRUE TRUE TRUE | That means you are using an R binary capable of _running_ under X11. This says nothing about compiling. | Has anyone run into this, please? What are the solutions, please? As (almost) always: get the proper -dev packages for headers and libs. Dirk | | thanks, | Erin | | -- | Erin Hodgess | Associate Professor | Department of Computer and Mathematical Sciences | University of Houston - Downtown | mailto: erinm.hodg...@gmail.com | | __ | 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. -- Three out of two people have difficulties with fractions. __ 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 rgl package
Dear Erin, On Tue, May 5, 2009 at 5:55 AM, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: Here is something strange. I'm using Ubuntu 9.04 with R 2.9.0. I need to have the rgl package. Here are my results from installing: install.packages(rgl) Warning in install.packages(rgl) : argument 'lib' is missing: using '/usr/local/lib/R/site-library' --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rgl_0.84.tar.gz' Content type 'application/x-gzip' length 1670659 bytes (1.6 Mb) opened URL == downloaded 1.6 Mb * Installing *source* package 'rgl' ... checking for gcc... gcc -std=gnu99 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for gcc... (cached) gcc -std=gnu99 checking whether we are using the GNU C compiler... (cached) yes checking whether gcc -std=gnu99 accepts -g... (cached) yes checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed checking for libpng-config... yes configure: using libpng-config configure: using libpng dynamic linkage checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/local/lib/R/site-library/rgl' I had the same problem a few days ago, and followed the recommendations of this message: http://tolstoy.newcastle.edu.au/R/e6/help/09/03/9250.html which fixed it for me. HTH, Jay *** G. Jay Kerns, Ph.D. Associate Professor Department of Mathematics Statistics Youngstown State University Youngstown, OH 44555-0002 USA Office: 1035 Cushwa Hall Phone: (330) 941-3310 Office (voice mail) -3302 Department -3170 FAX E-mail: gke...@ysu.edu http://www.cc.ysu.edu/~gjkerns/ __ 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] levelplot question
Antje niederlein-rstat at yahoo.de writes: thanks for your answer. The color-vector has the same length like the at-vector but the recycling cannot be the reason, because only values slightly above my threshold doe not appear blue. I cannot find a good explanation of which colors are assigned to which value ranges. This has nothing to do with the plotting, the question should be How are float converted to integers. You had asked for that before; check my earlier reply. You implicitly assume that there is a round() function involved, but something like floor() is used. Make sure that all your numbers are integers. Dieter __ 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] Can't build termstrc package from source
Thanks, Peter. R CMD build --binary did it for me. On Tue, May 5, 2009 at 3:36 PM, Peter Dalgaard p.dalga...@biostat.ku.dkwrote: Chirantan Kundu wrote: Hi, I'm trying to build the termstrc 1.1 package from its source on R 2.7.2 on Windows XP. However instead of building the package it just zips the entire source into a .tar.gz file. This is the first time I'm trying to build an R package from source. I installed the R toolset for Windows and set RTools as well as Perl MinGW directories in the path. Anybody tried this out? Any file missing in the source? Any help is appreciated. It's hard to tell what you did wrong when you don't tell what you did. I suspect you need to study the difference between R CMD build R CMD INSTALL R CMD check R CMD build --binary -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 Visit us at http://www.2pirad.com [[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] RMySQL insert statements?
Heya Folks, I can not find anything on executing insert statement through RMySQL, can someone please enlighten me? All i've found so far on getting data into a database is the write table functionality. Reading all data into memory appending additional information and writing that into a table is fine on my test environment, but won't be possible on the production environment because of the amount of data it will contain. Mazzel, Martijn. __ 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] noisy quantisation
If this helps, here is what I have currently mean.p- .5 contrast-1 amp- contrast*mean.p freq- 3 n- 100 p-amp*cos(2*pi*freq*(1:n)/n ) + mean.p plot(p) dens-as.numeric(runif(1:n)p) plot(p, type=l) points(dens, col=red) I would like some dots having y-value=0.5 in the middle of the plot. These will reduce the error of approximation. Thanks for any help. Bill __ 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] Lattice: use levelplot as panel for wireframe
Hi, I want to draw a figure similar to http://dsarkar.fhcrc.org/lattice/book/images/Figure_13_07_stdBW.png from http://lmdvr.r-forge.r-project.org/figures/figures.html (figure 13.7) . However instead of using a contour plot as a panel for the wireframe I want to use a levelplot. Can somebody help me with this? Thanks in advance for any help, Kind regards, Anton Bossenbroek __ 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] noisy quantisation; Bernoulli scheme
If I am right, the original version was a sinusoidally-modulated (nonstationary) Bernoulli process. I want 3 possible values, not 2, which makes it a Bernoulli scheme http://en.wikipedia.org/wiki/Bernoulli_scheme Not sure how to the create a sinusoidally modulated Bernoulli scheme with values 0, 0.5, 1. Bill __ 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] Lattice: use levelplot as panel for wireframe
Hi, I want to draw a figure similar to http://dsarkar.fhcrc.org/lattice/book/images/Figure_13_07_stdBW.png from http://lmdvr.r-forge.r-project.org/figures/figures.html (figure 13.7) . However instead of using a contour plot as a panel for the wireframe I want to use a levelplot. Can somebody help me with this? Thanks in advance for any help, Kind regards, Anton Bossenbroek __ 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] Working with R from Remote desktop
Hi Friends, Kindly let me know whether is it possible to install R project in a Server (Remote) desktop, which can be accessed by many users by logging in with their credentials... Another concern is if i want to work with huge dataset (millions of records) what should be the system configuration? (currently i am getting an error : Cannot allocate vector of size 16.7 Mb) Regards, Madana -- View this message in context: http://www.nabble.com/Working-with-R-from-Remote-desktop-tp23385242p23385242.html Sent from the R help mailing list archive at Nabble.com. [[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] Find cyclically identical binary sequences
Dear R-helpers, I need to generate all the binary sequences of length n (here n = 8) that start with 1 and have no fewer than two of each digit, and are not cyclic permutations of each other. Here is what I have done: len - 8 df - as.data.frame(numeric(2^(len - 1)) %o% numeric(len)) require(partitions) for (i in 1:2^(len - 1)) df[i, ] - binary(i, dim = len)[[1]] df - df[which(df[, 1] == 1), ] df - df[which(rowSums(df) 1), ] df - df[which(rowSums(df) len - 1), ] The following are cyclic permutations of each other: df[which(rowSums(df) == 3), ][c(2, 15), ] I would like to retain the larger of the two (if considered a binary number). Can someone suggest an algorithm? Thanks, Michael _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ [[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] Working with R from Remote desktop
Madan Mohan wrote: Hi Friends, Kindly let me know whether is it possible to install R project in a Server (Remote) desktop, which can be accessed by many users by logging in with their credentials... Just install it, that's it. Another concern is if i want to work with huge dataset (millions of records) what should be the system configuration? (currently i am getting an error : Cannot allocate vector of size 16.7 Mb) It depends on your definition of huge. The error messsage just tells you about the last (but not final, since R cannot know about that) memory allocation, hence meaningless. See ?Memory to get a point to start. Uwe Ligges Regards, Madana __ 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] limits
Dear Hassam, Take a look at the section 5.8 in [1]. HTH, Jorge [1] http://cran.r-project.org/web/packages/Ryacas/vignettes/Ryacas.pdf On Tue, May 5, 2009 at 5:39 AM, Hassan Mohamed hassan_hany_fa...@yahoo.comwrote: Hey, what is the R function for the mathematical limit ? e.g. to calculate and return the amount that the expression X^2 +X +2 approach as X approach 2 (X- 2) thanks hassan [[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. [[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] Optim function in the loop
Hard to say without seeing Linn() and maybe other relevant data. Uwe Ligges Rstarer wrote: Thanks for the reply. optim(initpar,Linn,NULL,method=BFGS,hessian=TRUE,control=list(trace=1,REPORT=1,maxit=300)) The optim is to minimize the negative likelihood function which is performed in function Linn, Every time the code stops right after optim, for example, the output looks like: iter 16 value 42.818394 iter 16 value 42.818394 final value 42.818394 converged It seems from the code that the loop should continue to run, at least calculate u values... but it does not... Thank you. Hi all, I wrote the following lines of codes try to do some iterations to find the global optimal values, but the function does not execute properly. Every time codes stop after one iteration right after executing the optim() function. Does anyone could have me to take a look? Thanks. if (count0){ k=k+0.05; mu0=c(83+k,0,0) Sigma0= diag(0.4,3) initpar=c(.1+10*k,10*k,10*k,10*k) # initial parameters for Phi[1,1], the 2 Q’s and R est=optim(initpar,Linn,NULL,method=BFGS,hessian=TRUE,control=list(trace=1,REPORT=1,maxit=300)) stderr=sqrt(diag(solve(est$hessian))) estimate=est$par u=cbind(estimate,stderr) if (u[1]0 u[2]0 u[3]0 u[4]0){ print(mu0=);print(mu0); print(initpar=);print(initpar) #break } else {count=-1; } } __ 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] JGR
r...@quantide.com wrote: Dear R User I am using JGR on a Linux Ubuntu Computer with 2 Cpus When Opening JGR, one Cpu goes up to 100% even if no calculation is yet started Did any of you already noticed this strange behaviour? Does it take very long? On the first start it builds some databases and that takes some time if you have installed many packages. Uwe Ligges Thanks for your help Andrea __ 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@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] Cox Proportional Hazard with missing covariate data
Dear friends, I have used R for some time now and have a tricky question about the coxph-function: To sum it up, I am not sure whether I can use coxph in conjunction with missing covariate data in a model with time-variant covariates. The point is: I know how old every piece that I oberserve is, but do not have fully historical information about the corresponding covariates. Maybe you have some advice for me, although this problem might only be 70% R and 30% statistically-related. Here's a detailled explanation: SITUATION OBJECTIVE: I want to analyze the effect of environmental effects (i.e. temperature and humidity) on the lifetime of some wear-parts. The study should be conducted on a yearly basis, meaning that I have collected empirical data on every wearpart at the end of every year. DATA: I have collected the following data: - Status of the wear-part: Equals 0 if part is still alive, equals 1 if part has died (my event variable) - Environmental data: Temperature and humidity have been measured at each of the wear-parts on a yearly basis (because each wear-part is at a different location, I have different data for each wear-part) PROBLEM: I started collecting data between 2001 and 2007. In 2001, a vast amount of of wearparts has already been in use. I DO KNOW for every part how long it has been used (even if it was employed before 2001), but I DO NOT have any information about environmental conditions like temperature or humidity before 2001 (I call this semi-left-censored). Of course, one could argue that I should simply exclude these parts from my analysis, but I don't want to loose valuable information, also because the amount of new parts that have been employed between 2001 and 2007 is rather small. Additionally, I cannot make any assumption about the underlying lifetime distribution. Therefore I have to use a non-parametrical model for estimation (most likely cox). QUESTION: From an econometric perspective, is it possible to use Cox Proportional Hazard model in this setting? As mentioned before, I have time-variant covariates for each wearpart, as well as what I call semi-left-censored data that I want to use. If not, what kind of analysis would you suggest? Thanks a lot for your great help, I really appreciate it. All the best Philipp __ 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] limits
Hassan Mohamed wrote: Hey, what is the R function for the mathematical limit ? e.g. to calculate and return the amount that the expression X^2 +X +2 approach as X approach 2 (X- 2) So you want some software that can do symbolic calculations? In that case use other software. R is designed for numerical analyses. Uwe Ligges thanks hassan [[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@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] Splitting a vector into equal groups
utkarshsinghal wrote: Hi All, I have vector of length 52, say, x=sample(30,52,replace=T). I want to sort x and split into five *nearly equal groups*. Note that the observations are repeated in x so in case of a tie I want both the observations to fall in same group. This seems a very common task to do, but still I couldn't find an R function to do this. Any help would be highly appreciated. See ?cut for groups equal in in its range or ?co.intervals in package lattice for intervals somewhat equal in number of observations. Uwe Ligges Regards Utkarsh [[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@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] prob in predict(randomForest)
In short, yes. Andy From: Haring, Tim (LWF) Hi at all, maybe this question is quite simple for a statistician, but for me it is not. After reading a lot of mail in the R-help archive I`m still not quite sure I get it. When applying a randomForest to a new dataset with predict(randomForest) I have the option to get the output as probability (classification problem): predict(myrf,...,type=prob) I would like to know how I have to understand this output. Are this values the probability of an observation belonging to a predicted class? Say, I have a data-point as newdata, my rf-model predicts Class A and the probability is 0,12301. Does this mean that this data-point belongs to class A only with a probability of 12%? Thanks for every hint. TIM Just as a matter of form: I´m using R version 2.8.1, randomForest package 4.5-28, OS: WinXP -- - Tim Häring Bavarian State Institute of Forest Research Department of Forest Ecology Am Hochanger 11 D-85354 Freising E-Mail: tim.haer...@lwf.bayern.de http://www.lwf.bayern.de __ 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. Notice: This e-mail message, together with any attachme...{{dropped:12}} __ 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] Support Vector Machines
svm() in the e1071 package is an interface to the libsvm code. Look at the link provided in the help page for that function. You will have to read up how density estimation is achieved via one-class SVM. Andy From: excalibur In the R-help of the svm function of the package e1071 it's explained that this function also makes estimation of density. But when i made for example X-rnorm(1000) m-svm(X) I just have a binary classification of X like SVM do whereas i want an estimation of the density which generates our sample X ... I don't know if it's possible and if someone has already use this function to do that. Thanks. David Winsemius wrote: On May 4, 2009, at 8:52 AM, excalibur wrote: This question is still unanswered. Unanswered questions are often those which do not comply with the guidelines in the Posting Guide. Many people have gotten tired of either making up examples or of writing Read the Posting Guide, so they just ignore them. Someone can explain me how use the svm function to make density estimation ? If you post an executable bit of code that shows how you are doing those operations, then I suspect someone will answer. excalibur wrote: Hi, i try to use function svm of package e1071 to estimate a density. But if my data are X=(X1,...,Xn) and m-svm(X) some values of m$SV are less than 0. I don't see how i can get the estimation of the density with this function. Thanks for your help. Rémi David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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. -- View this message in context: http://www.nabble.com/Support-Vector-Machines-tp19069442p23382683.html Sent from the R help mailing list archive at Nabble.com. __ 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. Notice: This e-mail message, together with any attachme...{{dropped:12}} __ 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] Can't build termstrc package from source
Thanks, Uwe. I've managed to get it done with R CMD BUILD -binary. 2009/5/5 Uwe Ligges lig...@statistik.tu-dortmund.de I guess you asked R to: R CMD build ... which builds the source package, but you need R CMD INSTALL ... in order to install the package or R CMD INSTALL --build ... in order to install *and* build a binary package. See the manual R Installation and Administration. Uwe Ligges Chirantan Kundu wrote: Hi, I'm trying to build the termstrc 1.1 package from its source on R 2.7.2 on Windows XP. However instead of building the package it just zips the entire source into a .tar.gz file. This is the first time I'm trying to build an R package from source. I installed the R toolset for Windows and set RTools as well as Perl MinGW directories in the path. Anybody tried this out? Any file missing in the source? Any help is appreciated. Thanks, Chirantan Visit us at http://www.2pirad.com [[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. Visit us at http://www.2pirad.com [[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] Create Pie chart from .csv file
Hi all, I am looking to create a pie chart from a given column in a .csv file. My class variables are as follows: entry_type, uniquekey, types, title,url, abstract, journal, author, month, year, howpublished So say I want to export a pie chart that groups together all entries under 'types' e.g. 3 x statistics 2x education etc. Im looking to have a piechart represent this graphically that shows which type of entry is in most frequently. Preferably I'd like to export to a PDF chart and while I can do this by typing variables directly into the R console, I cannot manage it from a .csv file. If you cannot help me with this specific problem, just knowing how to create a generic pie chart would be a great help. This is part of my final software project which is due in one week. I would very much appreciate any help. Many thanks in advance -- View this message in context: http://www.nabble.com/Create-Pie-chart-from-.csv-file-tp23387025p23387025.html Sent from the R help mailing list archive at Nabble.com. __ 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] JGR
The point is that one Cpu stays at 100% for all time JGR is up. Any ideas? Andrea Uwe Ligges wrote: r...@quantide.com wrote: Dear R User I am using JGR on a Linux Ubuntu Computer with 2 Cpus When Opening JGR, one Cpu goes up to 100% even if no calculation is yet started Did any of you already noticed this strange behaviour? Does it take very long? On the first start it builds some databases and that takes some time if you have installed many packages. Uwe Ligges Thanks for your help Andrea __ 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@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] Cox Proportional Hazard with missing covariate data
Hi, Arthur, thanks a lot for your super-fast reply! In fact I am using the time when the part has been used for the first time, so your example should work in my case. Moreover, as I have time-variant covariates, the example should look like this in my specific case: start stopstatus temphumid 5 6 0 32 43 6 7 1 34 42 Just two more things: (1) I am quite a newbie to cox-regression, so I wonder what you think about the approach that I mentioned above? Don't worry, I won't nail you down to this, just want to make sure I am not totally off track! (2) I don't think that you'd call this left-truncated observations, because I DO know the time when the part was used for the first time, I just don't have covariate values for its whole time of life, e.g. just the last two years in the example above. Left truncation in my eyes would mean that I did not even observe a specific part, e.g. because it has died before the study started. Again, thanks a lot, I'll be happy to provide valuable help on this list as soon as my R-skills are advancing. All the best Philipp Arthur Allignol wrote: Hi, In fact, you have left-truncated observations. What timescale do you use, time 0 is the study entry, or when the wear-part has been used for the first time? If it is the latter, you can specify the age of the wear part at study entry in Surv(). For example, if a wear part has been used for 5 years before study entry, and dies 2 years after, the data will look like that: start stop status 57 1 Hope this helps, Arthur Allignol Philipp Rappold wrote: Dear friends, I have used R for some time now and have a tricky question about the coxph-function: To sum it up, I am not sure whether I can use coxph in conjunction with missing covariate data in a model with time-variant covariates. The point is: I know how old every piece that I oberserve is, but do not have fully historical information about the corresponding covariates. Maybe you have some advice for me, although this problem might only be 70% R and 30% statistically-related. Here's a detailled explanation: SITUATION OBJECTIVE: I want to analyze the effect of environmental effects (i.e. temperature and humidity) on the lifetime of some wear-parts. The study should be conducted on a yearly basis, meaning that I have collected empirical data on every wearpart at the end of every year. DATA: I have collected the following data: - Status of the wear-part: Equals 0 if part is still alive, equals 1 if part has died (my event variable) - Environmental data: Temperature and humidity have been measured at each of the wear-parts on a yearly basis (because each wear-part is at a different location, I have different data for each wear-part) PROBLEM: I started collecting data between 2001 and 2007. In 2001, a vast amount of of wearparts has already been in use. I DO KNOW for every part how long it has been used (even if it was employed before 2001), but I DO NOT have any information about environmental conditions like temperature or humidity before 2001 (I call this semi-left-censored). Of course, one could argue that I should simply exclude these parts from my analysis, but I don't want to loose valuable information, also because the amount of new parts that have been employed between 2001 and 2007 is rather small. Additionally, I cannot make any assumption about the underlying lifetime distribution. Therefore I have to use a non-parametrical model for estimation (most likely cox). QUESTION: From an econometric perspective, is it possible to use Cox Proportional Hazard model in this setting? As mentioned before, I have time-variant covariates for each wearpart, as well as what I call semi-left-censored data that I want to use. If not, what kind of analysis would you suggest? Thanks a lot for your great help, I really appreciate it. All the best Philipp __ 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@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 rgl package
(off list) On 5 May 2009 at 05:15, Erin Hodgess wrote: | I also needed libglu1-mesa-dev, but now all is well. a) You still haven't explained why you need to rebuild it when sudo apt-get install r-cran-rgl gets you a binary b) Yes, as sudo apt-get build-dep r-cran-rgl would have found out for you. We do _a lot of work_ for R on Debian/Ubuntu. Use it, you even have a money-back guarantee. And ... c) This rgl header business has been discussed at least a hundred times on the R-help list. Use RSiteSearch() Dirk -- Three out of two people have difficulties with fractions. __ 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] Find cyclically identical binary sequences (corrected)
Dear R-helpers, I need to generate all the binary sequences of length n (here n = 8) that start with 1 and have no fewer than two of each digit, and are not cyclic permutations of each other. Here is what I have done: len - 8 df - as.data.frame(numeric(2^(len - 1)) %o% numeric(len)) require(wle) for (i in 1:2^(len - 1)) df[i, ] - binary(i, dim = len)[[1]] df - df[which(df[, 1] == 1), ] df - df[which(rowSums(df) 1), ] df - df[which(rowSums(df) len - 1), ] The following are cyclic permutations of each other: df[which(rowSums(df) == 3), ][c(2, 15), ] I would like to retain the larger of the two (if considered a binary number). Can someone suggest an algorithm? Thanks, Michael _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ __ 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] Support Vector Machines
I see that index is giving me the group for the classification problem. But my problem is not the same. I had a sample X-rnorm(1000) for example. I don't want to make classification (i have only one group in fact) but i want to estimate the density which generates my sample (like i can do with others methods like kernel density estimation, wavelets estimations, splines ...). So, logically, i hope i will find an approximation of the Gaussian density. But i don't see how i can obtain this density estimation with the function svm. Thanks David Winsemius wrote: On May 5, 2009, at 3:49 AM, excalibur wrote: In the R-help of the svm function of the package e1071 it's explained that this function also makes estimation of density. But when i made for example X-rnorm(1000) m-svm(X) I just have a binary classification of X like SVM do whereas i want an estimation of the density which generates our sample X ... I don't know if it's possible and if someone has already use this function to do that. Use str() to look at the object returned by svm. The example in svm's help page uses the svm object's index variable although there are other components that are available for extraction. The fitted vector looks to have similar binary properties to index and the SV vector appears to be a distance measure. -- David Thanks. David Winsemius wrote: On May 4, 2009, at 8:52 AM, excalibur wrote: This question is still unanswered. Unanswered questions are often those which do not comply with the guidelines in the Posting Guide. Many people have gotten tired of either making up examples or of writing Read the Posting Guide, so they just ignore them. Someone can explain me how use the svm function to make density estimation ? If you post an executable bit of code that shows how you are doing those operations, then I suspect someone will answer. excalibur wrote: Hi, i try to use function svm of package e1071 to estimate a density. But if my data are X=(X1,...,Xn) and m-svm(X) some values of m$SV are less than 0. I don't see how i can get the estimation of the density with this function. Thanks for your help. Rémi David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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. -- View this message in context: http://www.nabble.com/Support-Vector-Machines-tp19069442p23382683.html Sent from the R help mailing list archive at Nabble.com. __ 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. David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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. -- View this message in context: http://www.nabble.com/Support-Vector-Machines-tp19069442p23386300.html Sent from the R help mailing list archive at Nabble.com. __ 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] calibration plot
Hi, I have a binary variable and corresponding predicted probability (using logistic regression on some explanatoey variables); I want to check that the model is well-calibrated using a calibration plot. how can I have the calibration plot for my data? thanks. [[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] ERPs analysis
Good morning to Everyone, I'm an Italian PhD student that is working on ERPs experiment (cognitive psychology) and I would like to know if there are R packages for this kind of analysis. I'm using BrainAmp to record the data and this program gives me three different files (an *.eeg, an *.vmrk and *.vhdr). Thank You in advance. Patrik __ 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] text mining in italian
Hello everybody, I'm trying to do text mining on a serie of texts in italian. I would like to know if it is possible to find the italian synonyms and/or if something like WordNet database for English exists also for italian. Thank you very much in advance. Regards, Laura _ [[elided Hotmail spam]] [[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] View cluster results of large data sets
Hi all, I am trying to run a cluster analysis with a relatively large data set (545 samples) and obviously am having trouble viewing the results using standard plot() method. Is there a way to plot the results of a large cluster analysis in a window with a scroll bar. Any recommendations would be appreciated because I have looked around for a solution to no avail. Thanks Wade Wall __ 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] Heatmap without levelplot
Hi Uwe, I tried to explain my problem with the given example. I don't see any documentation which tells me that the length of col.regions should be one less than at. (At least I assume now that it should be this way...) If it's equal or longer some colors (in the middle of the color-vector) are simply not used. Just try the example below with rainbow(5) and rainbow(6) and compare the results... both plot will use 5 colors! Sorry, but this behaviour is not really self-explaining to me... maybe I'm to blind to find the documentation which says that only one color less will ensure the usage of all colors. (It is so important for me because I need to display a heatmap with colors let's say * all lower data outliers green, * all higher data outliers blue and * everything else within the color range yellow to red. I've seen that some values do not get blue or green though they are outliers... I've attached one graph, I've generated - maybe it helps to understand) Any wrong assumption? Ciao, Antje Uwe Ligges schrieb: Antje wrote: Hi there, as I'm not sure to understand the coloring levelplot uses, I'm looking for another easy way to create a heatmap like this: library(lattice) mat - matrix(seq(1,5, length.out = 12), nrow = 3) mat[1,2] - 3.5 my.at - seq(0.5,5.5, length.out = 6) my.col.regions - rainbow(5) graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = my.col.regions) print(graph) Can anybody help me with some hints or little examples? Dear Antje, since you are asking the same question again now, maybe you can explain what you are going to get? In fact, I do not undertsand where your problem is. R places the colors according to the values in your matrix very well including the legend and I thought up to today that the plot is self explaining. Best wishes, Uwe Ligges Antje __ 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@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] calibration plot
Dear Abbas, Take a look at the results of require(Hmisc) require(Design) apropos(calibrate) ?calibrate ?plot.calibrate HTH, Jorge On Tue, May 5, 2009 at 9:41 AM, abbas tavassoli tavassoli...@yahoo.comwrote: Hi, I have a binary variable and corresponding predicted probability (using logistic regression on some explanatoey variables); I want to check that the model is well-calibrated using a calibration plot. how can I have the calibration plot for my data? thanks. [[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. [[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] calibration plot
I believe something like: scatter.smooth(est.prob, as.numeric(y == level of interest)) would be close. You may want to use a larger span than default. Andy From: abbas tavassoli Hi, I have a binary variable and corresponding predicted probability (using logistic regression on some explanatoey variables); I want to check that the model is well-calibrated using a calibration plot. how can I have the calibration plot for my data? thanks. [[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. Notice: This e-mail message, together with any attachme...{{dropped:12}} __ 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] Create Pie chart from .csv file
I am looking to create a pie chart from a given column in a .csv file. My class variables are as follows: entry_type, uniquekey, types, title,url, abstract, journal, author, month, year, howpublished So say I want to export a pie chart that groups together all entries under 'types' e.g. 3 x statistics 2x education etc. Im looking to have a piechart represent this graphically that shows which type of entry is in most frequently. Preferably I'd like to export to a PDF chart and while I can do this by typing variables directly into the R console, I cannot manage it from a .csv file. If you cannot help me with this specific problem, just knowing how to create a generic pie chart would be a great help. Split the problem up into different stages. 1. Read in your data form the csv file. ?read.csv 2. Plot something. ?pie if you really must, but a bar chart will almost certainly be better. See ?barplot and ?barchart (lattice package). 3. Export the graph to PDF. ?pdf Regards, Richie. Mathematical Sciences Unit HSL ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} __ 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] Stepwise logistic regression with significance testing - stepAIC
Hello R-Users,  I have one binary dependent variable and a set of independent variables (glm(formula,â¦,family=âbinomialâ) ) and I am using the function stepAIC (âMASSâ) for choosing an optimal model. However I am not sure if stepAIC considers significance properties like Likelihood ratio test and Wald test (see example below).   y - rbinom(30,1,0.4) x1 - rnorm(30) x2 - rnorm(30) x3 - rnorm(30) xdata - data.frame(x1,x2,x3) fit1 - glm(y~ . ,family=binomial,data=xdata) stepAIC(fit1,trace=FALSE)  Call: glm(formula = y ~ x3, family = binomial, data = xdata)  Coefficients: (Intercept)          x3    -0.3556      0.8404  Degrees of Freedom: 29 Total (i.e. Null); 28 Residual Null Deviance:     40.38 Residual Deviance: 37.86       AIC: 41.86 fit - glm( stepAIC(fit1,trace=FALSE)$formula ,family=binomial) my.summ - summary(fit) # Wald Test print(my.summ$coeff[,4]) (Intercept)         x3  0.3609638  0.1395215 my.anova - anova(fit,test=Chisq) #LR Test print(my.anova$P[2]) [1] 0.1121783   Is there an alternative function or a possible way of checking if the added variable and the new model are significant within the regression steps?  Thanks in advance for your help  Regards  Peter-Heinz Fox [[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] FOURIER INTEGRALS IN R
Ok thanks.. No, my function is not smooth. Actually, I am dealing with an integral having the following form, for example: \int cos(tx) (1-t^2)^3 \exp(0.5*t^2) dt I want to estimate this Fourier Cosine integral for a given value of x. Thanks for the help. AA On Tue, May 5, 2009 2:34 am, andrew wrote: integrate offers some one-dimensional algorithms, but you need to start with a smooth function to get it to converge properly. With a cosine integral, there may be certain routines that offer better value for money: the Clenshaw-Curtis integration, or perhaps the FFT. You would have to recast your problem by doing some sort of substitution. Perhaps post some latex code to show the exact type of integral you are wanting to calculate. Regards, On May 5, 6:32 am, Achilleas Achilleos ma...@bristol.ac.uk wrote: Hi, I am wondering whether there exist any function in R (any package) that calculates Fourier Integrals. Particularly, I am interested for estimation of a Cosine Fourier integral... I would be much obliged if you could help me on this.. Thanks. Andreas -- __ r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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. -- A Achilleos ma...@bristol.ac.uk __ 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] Stepwise logistic Regression with significance testing - stepAIC
Hello R-Users,  I have one binary dependent variable and a set of independent variables (glm(formula,â¦,family=âbinomialâ) ) and I am using the function stepAIC (âMASSâ) for choosing an optimal model. However I am not sure if stepAIC considers significance properties like Likelihood ratio test and Wald test (see example below).   y - rbinom(30,1,0.4) x1 - rnorm(30) x2 - rnorm(30) x3 - rnorm(30) xdata - data.frame(x1,x2,x3) fit1 - glm(y~ . ,family=binomial,data=xdata) stepAIC(fit1,trace=FALSE)  Call: glm(formula = y ~ x3, family = binomial, data = xdata)  Coefficients: (Intercept)          x3    -0.3556      0.8404  Degrees of Freedom: 29 Total (i.e. Null); 28 Residual Null Deviance:     40.38 Residual Deviance: 37.86       AIC: 41.86 fit - glm( stepAIC(fit1,trace=FALSE)$formula ,family=binomial) my.summ - summary(fit) # Wald Test print(my.summ$coeff[,4]) (Intercept)         x3  0.3609638  0.1395215 my.anova - anova(fit,test=Chisq) #LR Test print(my.anova$P[2]) [1] 0.1121783   Is there an alternative function or a possible way of checking if the added variable and the new model are significant within the regression steps?  Thanks in advance for your help  Regards  Peter-Heinz Fox [[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] Re : Support Vector Machines
there is a SVM function in svmpath by Trevor Hastie. Before use it take time to read this http://www-stat.stanford.edu/~hastie/Papers/svmpath.pdf If you install then svmpath library ! run the attach source file. Justin BEM BP 1917 Yaoundé Tél (237) 99597295 (237) 22040246 De : excalibur servien.rem...@yahoo.fr À : r-help@r-project.org Envoyé le : Mardi, 5 Mai 2009, 8h49mn 49s Objet : Re: [R] Support Vector Machines In the R-help of the svm function of the package e1071 it's explained that this function also makes estimation of density. But when i made for example X-rnorm(1000) m-svm(X) I just have a binary classification of X like SVM do whereas i want an estimation of the density which generates our sample X ... I don't know if it's possible and if someone has already use this function to do that. Thanks. David Winsemius wrote: On May 4, 2009, at 8:52 AM, excalibur wrote: This question is still unanswered. Unanswered questions are often those which do not comply with the guidelines in the Posting Guide. Many people have gotten tired of either making up examples or of writing Read the Posting Guide, so they just ignore them. Someone can explain me how use the svm function to make density estimation ? If you post an executable bit of code that shows how you are doing those operations, then I suspect someone will answer. excalibur wrote: Hi, i try to use function svm of package e1071 to estimate a density. But if my data are X=(X1,...,Xn) and m-svm(X) some values of m$SV are less than 0. I don't see how i can get the estimation of the density with this function. Thanks for your help. Rémi David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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. -- View this message in context: http://www.nabble.com/Support-Vector-Machines-tp19069442p23382683.html Sent from the R help mailing list archive at Nabble.com. __ 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@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] Stepwise logistic regression with significance testing - stepAIC
Hello R-Users,  I have one binary dependent variable and a set of independent variables (glm(formula,â¦,family=âbinomialâ) ) and I am using the function stepAIC (âMASSâ) for choosing an optimal model. However I am not sure if stepAIC considers significance properties like Likelihood ratio test and Wald test (see example below).   y - rbinom(30,1,0.4) x1 - rnorm(30) x2 - rnorm(30) x3 - rnorm(30) xdata - data.frame(x1,x2,x3) fit1 - glm(y~ . ,family=binomial,data=xdata) stepAIC(fit1,trace=FALSE)  Call: glm(formula = y ~ x3, family = binomial, data = xdata)  Coefficients: (Intercept)          x3    -0.3556      0.8404  Degrees of Freedom: 29 Total (i.e. Null); 28 Residual Null Deviance:     40.38 Residual Deviance: 37.86       AIC: 41.86 fit - glm( stepAIC(fit1,trace=FALSE)$formula ,family=binomial) my.summ - summary(fit) # Wald Test print(my.summ$coeff[,4]) (Intercept)         x3  0.3609638  0.1395215 my.anova - anova(fit,test=Chisq) #LR Test print(my.anova$P[2]) [1] 0.1121783   Is there an alternative function or a possible way of checking if the added variable and the new model are significant within the regression steps?  Thanks in advance for your help  Regards  Peter-Heinz Fox [[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] FOURIER INTEGRALS IN R
Your integrand is smooth. What are the limits of integration: 0 to 1 or 0 to infinity? Main challenge is that it is increasingly oscillatory as x and/or t increase. You can find the zeros of the cosine function and add up the integrals between successive zeros. In what context does this inttegral arise? It must have been studied well using asymptotic approximation and such. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of A Achilleos Sent: Tuesday, May 05, 2009 10:18 AM To: r-help@r-project.org Subject: Re: [R] FOURIER INTEGRALS IN R Ok thanks.. No, my function is not smooth. Actually, I am dealing with an integral having the following form, for example: \int cos(tx) (1-t^2)^3 \exp(0.5*t^2) dt I want to estimate this Fourier Cosine integral for a given value of x. Thanks for the help. AA On Tue, May 5, 2009 2:34 am, andrew wrote: integrate offers some one-dimensional algorithms, but you need to start with a smooth function to get it to converge properly. With a cosine integral, there may be certain routines that offer better value for money: the Clenshaw-Curtis integration, or perhaps the FFT. You would have to recast your problem by doing some sort of substitution. Perhaps post some latex code to show the exact type of integral you are wanting to calculate. Regards, On May 5, 6:32 am, Achilleas Achilleos ma...@bristol.ac.uk wrote: Hi, I am wondering whether there exist any function in R (any package) that calculates Fourier Integrals. Particularly, I am interested for estimation of a Cosine Fourier integral... I would be much obliged if you could help me on this.. Thanks. Andreas -- __ r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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. -- A Achilleos ma...@bristol.ac.uk __ 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@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] Cox Proportional Hazard with missing covariate data
(1) Makes sense. Another approach is to use the time since study entry and include the age of the part in the model. A related discussion here: http://tolstoy.newcastle.edu.au/R/e2/help/07/02/9831.html (2) It is left-truncation. A part is observed only if it has survived until study entry. Of course, if you reset the clock at study entry, there's no delayed entries anymore. Philipp Rappold wrote: Hi, Arthur, thanks a lot for your super-fast reply! In fact I am using the time when the part has been used for the first time, so your example should work in my case. Moreover, as I have time-variant covariates, the example should look like this in my specific case: start stopstatus temphumid 5 6 0 32 43 6 7 1 34 42 Just two more things: (1) I am quite a newbie to cox-regression, so I wonder what you think about the approach that I mentioned above? Don't worry, I won't nail you down to this, just want to make sure I am not totally off track! (2) I don't think that you'd call this left-truncated observations, because I DO know the time when the part was used for the first time, I just don't have covariate values for its whole time of life, e.g. just the last two years in the example above. Left truncation in my eyes would mean that I did not even observe a specific part, e.g. because it has died before the study started. Again, thanks a lot, I'll be happy to provide valuable help on this list as soon as my R-skills are advancing. All the best Philipp Arthur Allignol wrote: Hi, In fact, you have left-truncated observations. What timescale do you use, time 0 is the study entry, or when the wear-part has been used for the first time? If it is the latter, you can specify the age of the wear part at study entry in Surv(). For example, if a wear part has been used for 5 years before study entry, and dies 2 years after, the data will look like that: start stop status 57 1 Hope this helps, Arthur Allignol Philipp Rappold wrote: Dear friends, I have used R for some time now and have a tricky question about the coxph-function: To sum it up, I am not sure whether I can use coxph in conjunction with missing covariate data in a model with time-variant covariates. The point is: I know how old every piece that I oberserve is, but do not have fully historical information about the corresponding covariates. Maybe you have some advice for me, although this problem might only be 70% R and 30% statistically-related. Here's a detailled explanation: SITUATION OBJECTIVE: I want to analyze the effect of environmental effects (i.e. temperature and humidity) on the lifetime of some wear-parts. The study should be conducted on a yearly basis, meaning that I have collected empirical data on every wearpart at the end of every year. DATA: I have collected the following data: - Status of the wear-part: Equals 0 if part is still alive, equals 1 if part has died (my event variable) - Environmental data: Temperature and humidity have been measured at each of the wear-parts on a yearly basis (because each wear-part is at a different location, I have different data for each wear-part) PROBLEM: I started collecting data between 2001 and 2007. In 2001, a vast amount of of wearparts has already been in use. I DO KNOW for every part how long it has been used (even if it was employed before 2001), but I DO NOT have any information about environmental conditions like temperature or humidity before 2001 (I call this semi-left-censored). Of course, one could argue that I should simply exclude these parts from my analysis, but I don't want to loose valuable information, also because the amount of new parts that have been employed between 2001 and 2007 is rather small. Additionally, I cannot make any assumption about the underlying lifetime distribution. Therefore I have to use a non-parametrical model for estimation (most likely cox). QUESTION: From an econometric perspective, is it possible to use Cox Proportional Hazard model in this setting? As mentioned before, I have time-variant covariates for each wearpart, as well as what I call semi-left-censored data that I want to use. If not, what kind of analysis would you suggest? Thanks a lot for your great help, I really appreciate it. All the best Philipp __ 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@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] Bristol mirror GPG problem ubuntu repository
Hello, I am getting a GPG error with the ubuntu repository at the bristol UK mirror. When my source.list has this line: deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu/ intrepid/ On an apt-get update you get this: W: GPG error: http://www.stats.bris.ac.uk intrepid/ Release: The following signatures were invalid: BADSIG D67FC6EAE2A11821 Vincent Goulet vincent.gou...@act.ulaval.ca Whereas if I use another mirror e.g.: deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu/ intrepid/ I don't get such an error. It could be a problem this end but I think it is more likely that something is going wrong with the GPG signing at bristol. Dan -- ** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.bre...@icr.ac.uk ** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}} __ 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] setting trellis auto.key color values
I'm working with Lattice graphics and I would like very much to color code the auto.key fill color with the same corresponding colors that I use in the panels. I've looked on the web for clues, and on the CRAN-R help sites searching on trellis auto.key color and variations, unfortunately the responses there are not very specific. Would someone please explain I have the Book, if you can point me to the pages that explain this I'd appreciate that too graph.sets - list(axis.text = list(cex = 0.65), par.ylab.text = list(cex = 1.25), par.xlab.text = list(cex = 1.25)) barchart(gator_IR$MEAN ~ gator_IR$Hydro | as.factor(gator_IR$IR_ID),layout=c(4,1),col = c(3:5), groups=gator_IR$Rain, ylim=c(0,1), par.settings = graph.sets, main = Alligator Nesting Performance, ylab= Mean HSI, auto.key = list(top, columns=3, col=c(3:5)) this script creates the graph nicely, with the qualification that the color for the key titles are the correct, but the filling colors are default pastels. Where do I change them ? Windows XP with R 2.8.1 Thank you. Steve Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortugas National Park 950 N Krome Ave (3rd Floor) Homestead, Florida 33034 steve_fried...@nps.gov Office (305) 224 - 4282 Fax (305) 224 - 4147 __ 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] Plotting pairs of bars
Dear all, I have a matrix called combine86 which looks as follows: combine86 Sim Mean Obs Mean Sim Sum Obs Sum AMAZON 1172.0424 1394.44604 553204 659573 NILE 262.4440 164.23921 67973 41881 CONGO682.8007 722.63971 205523 214624 MISSISSIPPI 363.0758 142.59883 124535 49054 AMUR 143.585789.30434 36040 22594 PARANA 702.3793 388.03030 162952 89635 YENISEI 208.1396 174.52722 83464 70509 OB 197.0399 162.82697 79013 63991 LENA 118.110077.49638 48307 32161 NIGER374.8258 212.25714 66719 37145 ZAMBEZI 500. 485.87610 57000 54904 YANGTZE 358.4172 256.80246 58422 41602 For each of the rivers (which are the row names of this matrix), I wish to plot a bar for Simulated Mean and another for the Observed Mean. So far I've only been able to get R to stack the bars (using 'barplot) on top of one another, which isn't really what I want! I was hoping more for a pairing of bars (one 'Sim' and one 'Mean') followed by a gap, then the next pair of bars for the next river, a gap, and so on. Is this possible to do in R? If so, how?! Many thanks, Steve _ [[elided Hotmail spam]] __ 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] Sampling a matrix with different probability distributions
I need to sample a matrix according to different distributions, instead of just randomly. Here is some code that will hopefully clarify what I need: I have a matrix M of 1287 interactions between species in rows and species in columns, according to their abundance: pla- c(10, 9, 6, 5, 3) #abundance of pla species pol- c(14, 10, 9, 4, 2) #abundance of pol species M-pla%*%t(pol) #matrix of 1287 interactions according to pla and pol abundance M [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 126 Thanks to help from people in this forum, I was able to randomly sample 800 interactions from matrix M and obtain a subset of the interactions in a smaller matrix called reduced.M: M.index - 1:length(M) reduced.M - matrix(table( factor( sample(rep(M.index,M),800), M.index)),nr=5) reduced.M [,1] [,2] [,3] [,4] [,5] [1,] 77 62 56 25 15 [2,] 83 53 51 21 11 [3,] 57 34 28 18 10 [4,] 51 31 21 144 [5,] 27 21 1965 Now I need to sample again, not randomly, but according to different distributions. For example, I need to sample according to the abundance of species pla, (pla vector written above). The result should be that I sample my first row more intensely than my second row, and the last row should be the least intensely sampled, in proportion to my row species abundance. In the same token, I want to sample with a uniform distribution as well. How do I do this? Thanks, as usual! Silvia. -- View this message in context: http://www.nabble.com/Sampling-a-matrix-with-different-probability-distributions-tp23390324p23390324.html Sent from the R help mailing list archive at Nabble.com. __ 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] levelplot question
The function that is doing the color assignments is level.colors in the lattice package. Looking at the code confirms that the number of colors should be 1 less than the length of the at variable (the documentation implies that it should be 1 more, looks like a documentation bug to me). It is possible that at one time the author intended to prepend -Inf and append Inf to the at vector so that it did not need to span the entire range of the data, but that was not implemented. I think I would prefer that fix to changing the documentation. The level.colors function uses the cut function to decide on which color to use, by default cut will put a value that matches a cutpoint in the group to the left, so to answer you original question 3.5 goes into the (2.5,3.5] range rather than the (3.5,4.5] group. level.colors does not allow for changing this (hard coded), so if you want the other behaiviour, you either need to rewrite level.colors, or add a very small number to your data to shift 3.5 and the like into the right bin. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: Antje [mailto:niederlein-rs...@yahoo.de] Sent: Tuesday, May 05, 2009 1:00 AM To: Greg Snow; r-h...@stat.math.ethz.ch Subject: Re: [R] levelplot question Hi Greg and all the others, thanks for your answer. The color-vector has the same length like the at-vector but the recycling cannot be the reason, because only values slightly above my threshold doe not appear blue. I cannot find a good explanation of which colors are assigned to which value ranges. I've made little example: # mat - matrix(seq(1,5, length.out = 12), nrow = 3) mat[1,2] - 3.5 my.at - seq(0.5,5.5) my.col.regions - rainbow(6) graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = my.col.regions) print(graph) windows() plot(1:10) legend(topleft, legend = as.character(my.col.regions), col = my.col.regions, pch = 18) # As you can see the green (position 3 in my.col.regions) disappears completely in the levelplot (look at the color range at the right side!). I guess it might also happen in my case... I've tested several cases and it looks like the length of the color- vector should be one less than the at vector (which would make sense). Then, the rule might apply: [ at[1],at[2] ] = color[1] ( at[2],at[3] ] = color[2] ... ( at[n-1],at[n] ] = color[n-1] Please correct me if I'm wrong!!! Antje __ 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] setting trellis auto.key color values
Set the colors in graph.sets and not auto.key. graph.sets - list(axis.text = list(cex = 0.65), par.ylab.text = list(cex = 1.25), par.xlab.text = list(cex = 1.25), superpose.polygon = list(col = 3:5)) Then remove the col = 3:5 from auto.key and barchart. Also, you can simplify your code by removing gator_IR$ and including data = gator_IR. I.e. barchart(MEAN ~ Hydro | as.factor(IR_ID), data = gator_IR, layout = c(4, 1), groups = Rain, ylim = c(0, 1), ...) HTH, --sundar On Tue, May 5, 2009 at 8:32 AM, steve_fried...@nps.gov wrote: I'm working with Lattice graphics and I would like very much to color code the auto.key fill color with the same corresponding colors that I use in the panels. I've looked on the web for clues, and on the CRAN-R help sites searching on trellis auto.key color and variations, unfortunately the responses there are not very specific. Would someone please explain I have the Book, if you can point me to the pages that explain this I'd appreciate that too graph.sets - list(axis.text = list(cex = 0.65), par.ylab.text = list(cex = 1.25), par.xlab.text = list(cex = 1.25)) barchart(gator_IR$MEAN ~ gator_IR$Hydro | as.factor(gator_IR$IR_ID),layout=c(4,1),col = c(3:5), groups=gator_IR$Rain, ylim=c(0,1), par.settings = graph.sets, main = Alligator Nesting Performance, ylab= Mean HSI, auto.key = list(top, columns=3, col=c(3:5)) this script creates the graph nicely, with the qualification that the color for the key titles are the correct, but the filling colors are default pastels. Where do I change them ? Windows XP with R 2.8.1 Thank you. Steve Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortugas National Park 950 N Krome Ave (3rd Floor) Homestead, Florida 33034 steve_fried...@nps.gov Office (305) 224 - 4282 Fax (305) 224 - 4147 __ 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@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] Create Pie chart from .csv file
Sorry for mailing to you personally... for types read.csv(file.choose()) freqTable = table(types) pie(freqTable) ##example for some data temp = data.frame(types = 1:10) pie(table(temp)) Thomas Roth PS: use barplot instead of pie DonkeyRhubarb schrieb: Hi all, I am looking to create a pie chart from a given column in a .csv file. My class variables are as follows: entry_type, uniquekey, types, title,url, abstract, journal, author, month, year, howpublished So say I want to export a pie chart that groups together all entries under 'types' e.g. 3 x statistics 2x education etc. Im looking to have a piechart represent this graphically that shows which type of entry is in most frequently. Preferably I'd like to export to a PDF chart and while I can do this by typing variables directly into the R console, I cannot manage it from a .csv file. If you cannot help me with this specific problem, just knowing how to create a generic pie chart would be a great help. This is part of my final software project which is due in one week. I would very much appreciate any help. Many thanks in advance __ 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] Heatmap without levelplot
The image function in base graphics does the same type of plot, just different names and structure of the data (and the documentation says that the number of breaks should be 1 more than the number of colors). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Antje Sent: Tuesday, May 05, 2009 1:12 AM To: r-h...@stat.math.ethz.ch Subject: [R] Heatmap without levelplot Hi there, as I'm not sure to understand the coloring levelplot uses, I'm looking for another easy way to create a heatmap like this: library(lattice) mat - matrix(seq(1,5, length.out = 12), nrow = 3) mat[1,2] - 3.5 my.at - seq(0.5,5.5, length.out = 6) my.col.regions - rainbow(5) graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = my.col.regions) print(graph) Can anybody help me with some hints or little examples? Antje __ 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@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 modify a function in a R package calling other (invisible?) functions
Hey hey kids! I'm facing this rough problem: I have to modify a function in a R package (namely, homals) but I'm not able to do it from the R interface, since this function recalls other functions which looks like invisible... I downloaded the source package from CRAN, http://cran.r-project.org/src/contrib/homals_0.9-10.tar.gz http://cran.r-project.org/src/contrib/homals_0.9-10.tar.gz how can I work it out? Yours, KtK:-D -- View this message in context: http://www.nabble.com/how-to-modify-a-function-in-a-R-package-calling-other-%28invisible-%29-functions-tp23390639p23390639.html Sent from the R help mailing list archive at Nabble.com. [[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] A question about using “by” in GAM model fitting of interaction between smooth terms and factor
I am a little bit confusing about the following help message on how to fit a GAM model with interaction between factor and smooth terms from http://rss.acs.unt.edu/Rdoc/library/mgcv/html/gam.models.html: “Sometimes models of the form: E(y)=b0+f(x)z need to be estimated (where f is a smooth function, as usual.) The appropriate formula is: y~z+s(x,by=z) - the by argument ensures that the smooth function gets multiplied by covariate z, but GAM smooths are centred (average value zero), so the z+ term is needed as well (f is being represented by a constant plus a centred smooth). If we'd wanted: E(y)=f(x)z then the appropriate formula would be: y~z+s(x,by=z)-1.” When I tried two scripts, I found they gave the same results. That is, the codes “y~z+s(x,by=z)” and “y~z+s(x,by=z)-1” gave the same results. The following is my result: ### “anova(model1,model2,test=Chisq) Analysis of Deviance Table Model 1: FLBS ~ SES + s(FAFR, by = SES) + s(byear, by = SES) + s(FAFR, byear, by = SES) Model 2: FLBS ~ SES + s(FAFR, by = SES) + s(byear, by = SES) + s(FAFR, byear, by = SES) - 1 Resid. Df Resid. Dev Df Deviance P(|Chi|) 1 1.2076e+03 1458.4 2 1.2076e+03 1458.4 1.9099e-11 5.030e-10 2.074e-10” ### Is this in conflict with above statement that “If we'd wanted: E(y)=f(x)z then the appropriate formula would be: y~z+s(x,by=z)-1.”? Also, if you are familiar with GAM modelling, please have a look at my modelling process. That is, I want to study how one factor together with two smooth terms will influence the response. In model2, I also fitted the interaction between two smooth terms, together with the interaction of this interaction with factor. Is model 2 reasonable? I find it is rather complicated to interpret the plot of model 2. Thank you very much for helping! -- View this message in context: http://www.nabble.com/A-question-about-using-%E2%80%9Cby%E2%80%9D-in-GAM-model-fitting-of-interaction-between-smooth-terms-and-factor-tp23390342p23390342.html Sent from the R help mailing list archive at Nabble.com. __ 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] Stepwise logistic regression with significance testing - stepAIC
There is not a meaningful alternative way since the way you propose is not meaningful. The Wald tests have some know problems even in the well defined cases. Both types of tests are designed to test a predefined hypothesis, not a conditional hypothesis on the stepwise procedure. It is best to use other approaches than stepwise selection (it has been shown to give biased results) such as the lasso. If you need to use stepwise, then you should bootstrap the entire selection process to get better estimates/standard errors. Frank Harrell's book and package go into more detail on this and provide some tools to help (as well as the other packages that can be used). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Peter-Heinz Fox Sent: Tuesday, May 05, 2009 8:02 AM To: r-help@r-project.org Subject: [R] Stepwise logistic regression with significance testing - stepAIC Hello R-Users, I have one binary dependent variable and a set of independent variables (glm(formula,…,family=”binomial”) ) and I am using the function stepAIC (“MASS”) for choosing an optimal model. However I am not sure if stepAIC considers significance properties like Likelihood ratio test and Wald test (see example below). y - rbinom(30,1,0.4) x1 - rnorm(30) x2 - rnorm(30) x3 - rnorm(30) xdata - data.frame(x1,x2,x3) fit1 - glm(y~ . ,family=binomial,data=xdata) stepAIC(fit1,trace=FALSE) Call: glm(formula = y ~ x3, family = binomial, data = xdata) Coefficients: (Intercept) x3 -0.3556 0.8404 Degrees of Freedom: 29 Total (i.e. Null); 28 Residual Null Deviance: 40.38 Residual Deviance: 37.86 AIC: 41.86 fit - glm( stepAIC(fit1,trace=FALSE)$formula ,family=binomial) my.summ - summary(fit) # Wald Test print(my.summ$coeff[,4]) (Intercept) x3 0.3609638 0.1395215 my.anova - anova(fit,test=Chisq) #LR Test print(my.anova$P[2]) [1] 0.1121783 Is there an alternative function or a possible way of checking if the added variable and the new model are significant within the regression steps? Thanks in advance for your help Regards Peter-Heinz Fox [[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] Re : Re : Support Vector Machines
Of course SVM is for supervise learning method (classification or regression). You cannot use a boat to fly man ! Justin BEM BP 1917 Yaoundé Tél (237) 99597295 (237) 22040246 Envoyé le : Mardi, 5 Mai 2009, 16h07mn 10s Objet : Re : [R] Support Vector Machines Thank you. I will look this later but I think i've saw this function and i'm not sure that we can make density estimation with this but only classification. : Objet: Re : [R] Support Vector Machines Cc: R Maillist r-h...@stat.math.ethz.ch Date: Mardi 5 Mai 2009, 16h43 there is a SVM function in svmpath by Trevor Hastie. Before use it take time to read this http://www-stat.stanford.edu/~hastie/Papers/svmpath.pdf If you install then svmpath library ! run the attach source file. Justin BEM BP 1917 Yaoundé Tél (237) 99597295 (237) 22040246 À : r-help@r-project.org Envoyé le : Mardi, 5 Mai 2009, 8h49mn 49s Objet : Re: [R] Support Vector Machines In the R-help of the svm function of the package e1071 it's explained that this function also makes estimation of density. But when i made for example X-rnorm(1000) m-svm(X) I just have a binary classification of X like SVM do whereas i want an estimation of the density which generates our sample X ... I don't know if it's possible and if someone has already use this function to do that. Thanks. David Winsemius wrote: On May 4, 2009, at 8:52 AM, excalibur wrote: This question is still unanswered. Unanswered questions are often those which do not comply with the guidelines in the Posting Guide. Many people have gotten tired of either making up examples or of writing Read the Posting Guide, so they just ignore them. Someone can explain me how use the svm function to make density estimation ? If you post an executable bit of code that shows how you are doing those operations, then I suspect someone will answer. excalibur wrote: Hi, i try to use function svm of package e1071 to estimate a density. But if my data are X=(X1,...,Xn) and m-svm(X) some values of m$SV are less than 0. I don't see how i can get the estimation of the density with this function. Thanks for your help. Rémi David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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. -- View this message in context: http://www.nabble.com/Support-Vector-Machines-tp19069442p23382683.html Sent from the R help mailing list archive at Nabble.com. __ 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. [[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] method for calculating grey level occurrence matrices (GLCM) with R
hello, does anybody know a method for calculating grey-level co-occurrence matrices (GLCM) for RGB-pictures with R? (unfortunately i haven't found a solution for this problem neither via (scholar)google nor via r-project helplist) thank you very much! best regards Hans-Joachim Klemmt -- -- Dr. Hans-Joachim Klemmt Forstoberrat Organisationsprogrammierer IHK Bayerische Landesanstalt für Wald und Forstwirtschaft zugewiesen an Lehrstuhl für Waldwachstumskunde Technische Universität München Am Hochanger 13 85354 Freising Tel.: 08161/ 7147-14 Fax : 08161/ 7147-21 eMail: h-j.kle...@lrz.tum.de Skype: hajo_klemmt __ 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] smoothing spline in package gam
Strangely, summary.gam(m1) should give you significance results of parametric terms such as ost, wst, park10, sch50, comm, build and suite. These results should be located above the summary results for smooth terms. Please using summary.gam(m1) to have a look if there is the information you need. Good luck! 楊 詩韻 wrote: dear all, i have a little question, but it make me torment long time hope you can help me and give some advices , thanks i use smoothing spline in package gam the model m1=gam(y~ost+wst+park10+sch50+comm+build+suite+y05+y06+y07+y99+y98+s(builarea)+s(age)+s(fl)+s(totfl)+s(cbd)+s(redl)) and summary(m1) can show the s(smoothing) variables' Signif. codes. but i also want to know the Parametric coefficients and their Signif. codes. like ost, wst...etc. is that possible to get the Parametric coefficients' Signif. codes (in package gam) ? thanks~~ _ [[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. -- View this message in context: http://www.nabble.com/smoothing-spline-in-package-gam-tp23382805p23390437.html Sent from the R help mailing list archive at Nabble.com. __ 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] Stepwise logistic regression with significance testing - stepAIC
Greg Snow wrote: There is not a meaningful alternative way since the way you propose is not meaningful. The Wald tests have some know problems even in the well defined cases. Both types of tests are designed to test a predefined hypothesis, not a conditional hypothesis on the stepwise procedure. It is best to use other approaches than stepwise selection (it has been shown to give biased results) such as the lasso. If you need to use stepwise, then you should bootstrap the entire selection process to get better estimates/standard errors. For bootstrapping the stepAIC procedure you may have a look at package bootStepAIC. Best, Dimitris Frank Harrell's book and package go into more detail on this and provide some tools to help (as well as the other packages that can be used). Hope this helps, -- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 __ 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] Plotting pairs of bars
Look at the beside argument to the barplot function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Steve Murray Sent: Tuesday, May 05, 2009 9:52 AM To: r-help@r-project.org Subject: [R] Plotting pairs of bars Dear all, I have a matrix called combine86 which looks as follows: combine86 Sim Mean Obs Mean Sim Sum Obs Sum AMAZON 1172.0424 1394.44604 553204 659573 NILE 262.4440 164.23921 67973 41881 CONGO682.8007 722.63971 205523 214624 MISSISSIPPI 363.0758 142.59883 124535 49054 AMUR 143.585789.30434 36040 22594 PARANA 702.3793 388.03030 162952 89635 YENISEI 208.1396 174.52722 83464 70509 OB 197.0399 162.82697 79013 63991 LENA 118.110077.49638 48307 32161 NIGER374.8258 212.25714 66719 37145 ZAMBEZI 500. 485.87610 57000 54904 YANGTZE 358.4172 256.80246 58422 41602 For each of the rivers (which are the row names of this matrix), I wish to plot a bar for Simulated Mean and another for the Observed Mean. So far I've only been able to get R to stack the bars (using 'barplot) on top of one another, which isn't really what I want! I was hoping more for a pairing of bars (one 'Sim' and one 'Mean') followed by a gap, then the next pair of bars for the next river, a gap, and so on. Is this possible to do in R? If so, how?! Many thanks, Steve _ [[elided Hotmail spam]] __ 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@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] setting trellis auto.key color values
Sundar, Thanks for the assistance. Much appreciated. Steve Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortugas National Park 950 N Krome Ave (3rd Floor) Homestead, Florida 33034 steve_fried...@nps.gov Office (305) 224 - 4282 Fax (305) 224 - 4147 Sundar Dorai-Raj sdorai...@gmail. com To steve_fried...@nps.gov 05/05/2009 09:08 cc AM MSTr-help@r-project.org Subject Re: [R] setting trellis auto.key color values Set the colors in graph.sets and not auto.key. graph.sets - list(axis.text = list(cex = 0.65), par.ylab.text = list(cex = 1.25), par.xlab.text = list(cex = 1.25), superpose.polygon = list(col = 3:5)) Then remove the col = 3:5 from auto.key and barchart. Also, you can simplify your code by removing gator_IR$ and including data = gator_IR. I.e. barchart(MEAN ~ Hydro | as.factor(IR_ID), data = gator_IR, layout = c(4, 1), groups = Rain, ylim = c(0, 1), ...) HTH, --sundar On Tue, May 5, 2009 at 8:32 AM, steve_fried...@nps.gov wrote: I'm working with Lattice graphics and I would like very much to color code the auto.key fill color with the same corresponding colors that I use in the panels. I've looked on the web for clues, and on the CRAN-R help sites searching on trellis auto.key color and variations, unfortunately the responses there are not very specific. Would someone please explain I have the Book, if you can point me to the pages that explain this I'd appreciate that too graph.sets - list(axis.text = list(cex = 0.65), par.ylab.text = list(cex = 1.25), par.xlab.text = list(cex = 1.25)) barchart(gator_IR$MEAN ~ gator_IR$Hydro | as.factor(gator_IR$IR_ID),layout=c(4,1),col = c(3:5), groups=gator_IR$Rain, ylim=c(0,1), par.settings = graph.sets, main = Alligator Nesting Performance, ylab= Mean HSI, auto.key = list(top, columns=3, col=c(3:5)) this script creates the graph nicely, with the qualification that the color for the key titles are the correct, but the filling colors are default pastels. Where do I change them ? Windows XP with R 2.8.1 Thank you. Steve Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortugas National Park 950 N Krome Ave (3rd Floor) Homestead, Florida 33034 steve_fried...@nps.gov Office (305) 224 - 4282 Fax (305) 224 - 4147 __ 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@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] Hierarchical Diagram of Networks in sna or otherwise?
No worries. I've actually switched to using Rgraphviz from bioconductor, and the results are pretty great (after the initial head-pounding to get it setup). Gábor Csárdi-2 wrote: On Mon, May 4, 2009 at 8:31 PM, jebyrnes byr...@msi.ucsb.edu wrote: Nearly. The algorithm turns up slightly different graphs each time (and set.seed doesn't seem to make it consistent) Hmmm, that should not happen, I'll check it out. and periodically chokes. Can you send me the graph for which this happens? But better than what I had. Hrm. I don't know much about the algorithm graphviz uses for dot. Do you have a reference on hand? No, I don't. Have you checked the graphviz homepage? If it's simple, I'd be willing to take a whack at it. I doubt that it is simple, but I think it would be very useful to have a free implementation. (I would have already ported the graphviz layout algorithms to igraph, but their licenses are not compatible.) Best, Gabor Gábor Csárdi-2 wrote: Jarrett, the 'igraph' package has a layout called layout.reingold.tilford that is designed for trees, there is a slight chance that it is good enough for you. Best, Gabor On Wed, Apr 29, 2009 at 10:11 PM, jebyrnes byr...@msi.ucsb.edu wrote: I've been using sna to work with some networks, and am trying to visualize them easily. My networks are hierarchical (food webs). All of the layout engines I've tried with gplot don't seem to plot hierarchical networks, as one would using dot from graphviz. While I could do all of this by outputting to dotfiles and running it through graphviz, the graphics I get from R are much cleaner, and more easily integrated into my analyses. Is there any good way to diagram a hierarchical network in R, either with the sna library or otherwise? It strikes me that at least the Netindices package can calculate trophic levels. Could this be used for node placement? -Jarrett -- View this message in context: http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23301819.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Gabor Csardi gabor.csa...@unil.ch UNIL DGM __ 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. -- View this message in context: http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23374024.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Gabor Csardi gabor.csa...@unil.ch UNIL DGM __ 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. -- View this message in context: http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23391709.html Sent from the R help mailing list archive at Nabble.com. __ 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] Sampling a matrix with different probability distributions
The sample function has a prob argument that can be used to sample with unequal probabilities. It sounds like you can just pass in the species abundance vector to prob and it will do what you want. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Silvia Lomascolo Sent: Tuesday, May 05, 2009 9:52 AM To: r-help@r-project.org Subject: [R] Sampling a matrix with different probability distributions I need to sample a matrix according to different distributions, instead of just randomly. Here is some code that will hopefully clarify what I need: I have a matrix M of 1287 interactions between species in rows and species in columns, according to their abundance: pla- c(10, 9, 6, 5, 3) #abundance of pla species pol- c(14, 10, 9, 4, 2) #abundance of pol species M-pla%*%t(pol) #matrix of 1287 interactions according to pla and pol abundance M [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 126 Thanks to help from people in this forum, I was able to randomly sample 800 interactions from matrix M and obtain a subset of the interactions in a smaller matrix called reduced.M: M.index - 1:length(M) reduced.M - matrix(table( factor( sample(rep(M.index,M),800), M.index)),nr=5) reduced.M [,1] [,2] [,3] [,4] [,5] [1,] 77 62 56 25 15 [2,] 83 53 51 21 11 [3,] 57 34 28 18 10 [4,] 51 31 21 144 [5,] 27 21 1965 Now I need to sample again, not randomly, but according to different distributions. For example, I need to sample according to the abundance of species pla, (pla vector written above). The result should be that I sample my first row more intensely than my second row, and the last row should be the least intensely sampled, in proportion to my row species abundance. In the same token, I want to sample with a uniform distribution as well. How do I do this? Thanks, as usual! Silvia. -- View this message in context: http://www.nabble.com/Sampling-a-matrix- with-different-probability-distributions-tp23390324p23390324.html Sent from the R help mailing list archive at Nabble.com. __ 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@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] quick square root axes
Dear R users, while I enjoy the built-in log argument to the plot() function, I wished it would be as easy to create more general custom transformed axes such as sqrt(), logit, etc... for example, instead of plot(x=exp(rnorm(10)), y=(1:10)^4, log = xy), sth. along the lines of plot(x=exp(rnorm(10)), y=(1:10)^4, trans = list(x = log, y = sqrt)) to encode the desired transfomation. This involves just transforming the xy values and creating nice tick marks at the appropriate positions. Before trying to write my own function, I wanted to see if that functionality already exists in another package ? Thanks! Markus . [[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] big databases
Dear all, I have a .dta database which is about 400 MB. I cannot open it though I have no problem to import smaller ones (80 MB or even 174 MB). I tried to modify some options with --max-mem-size=2047M --max-vsize=2047M. But it does not seem to be enough. I do not know the exact meaning of these options : vsize seems to be made for vectors. I have got Monte Carlo simulations running in another R window. Can MCMC simulations take enough memory so as to prevent me from opening this database ? Thank you very much for any help. Best Regards [[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] Sampling a matrix with different probability distributions
Greg Snow-2 wrote: The sample function has a prob argument that can be used to sample with unequal probabilities. It sounds like you can just pass in the species abundance vector to prob and it will do what you want. It might be that my question is even more basic than it sounds: I have tried what you say, but I may just be writing it wrong as I get an error message. I wrote: reduced.M - matrix(table( factor( sample(rep(M.index,M),800), M.index prob=pla)),nr=5) but I get and error message saying that the prob argument is unused. I have also tried prob=unif, or directly prob=c(10, 9, 6, 5, 3), but I get the same error message. Any hints as to how I am passing the prob argument wrong? This is probably too basic... Thanks, Silvia. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Silvia Lomascolo Sent: Tuesday, May 05, 2009 9:52 AM To: r-help@r-project.org Subject: [R] Sampling a matrix with different probability distributions I need to sample a matrix according to different distributions, instead of just randomly. Here is some code that will hopefully clarify what I need: I have a matrix M of 1287 interactions between species in rows and species in columns, according to their abundance: pla- c(10, 9, 6, 5, 3) #abundance of pla species pol- c(14, 10, 9, 4, 2) #abundance of pol species M-pla%*%t(pol) #matrix of 1287 interactions according to pla and pol abundance M [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 126 Thanks to help from people in this forum, I was able to randomly sample 800 interactions from matrix M and obtain a subset of the interactions in a smaller matrix called reduced.M: M.index - 1:length(M) reduced.M - matrix(table( factor( sample(rep(M.index,M),800), M.index)),nr=5) reduced.M [,1] [,2] [,3] [,4] [,5] [1,] 77 62 56 25 15 [2,] 83 53 51 21 11 [3,] 57 34 28 18 10 [4,] 51 31 21 144 [5,] 27 21 1965 Now I need to sample again, not randomly, but according to different distributions. For example, I need to sample according to the abundance of species pla, (pla vector written above). The result should be that I sample my first row more intensely than my second row, and the last row should be the least intensely sampled, in proportion to my row species abundance. In the same token, I want to sample with a uniform distribution as well. How do I do this? Thanks, as usual! Silvia. -- View this message in context: http://www.nabble.com/Sampling-a-matrix- with-different-probability-distributions-tp23390324p23390324.html Sent from the R help mailing list archive at Nabble.com. __ 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@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. -- View this message in context: http://www.nabble.com/Sampling-a-matrix-with-different-probability-distributions-tp23390324p23392352.html Sent from the R help mailing list archive at Nabble.com. __ 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] quick square root axes
On 5/5/2009 1:05 PM, Markus Loecher wrote: Dear R users, while I enjoy the built-in log argument to the plot() function, I wished it would be as easy to create more general custom transformed axes such as sqrt(), logit, etc... for example, instead of plot(x=exp(rnorm(10)), y=(1:10)^4, log = xy), sth. along the lines of plot(x=exp(rnorm(10)), y=(1:10)^4, trans = list(x = log, y = sqrt)) to encode the desired transfomation. This involves just transforming the xy values and creating nice tick marks at the appropriate positions. Before trying to write my own function, I wanted to see if that functionality already exists in another package ? I don't know of such a thing, but it may well exist. If you do write your own, the hardest part will be picking the nice tick marks. They should be approximately evenly spaced, but at nice round values of the original variable: that's hard to do in general. R has the pretty() function for the linear scale, and doesn't do too badly on log axes, but you'll need to work out your own rules for the sqrt or other scales. Duncan Murdoch __ 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] Heatmap without levelplot
Antje wrote: Hi Uwe, I tried to explain my problem with the given example. I don't see any documentation which tells me that the length of col.regions should be one less than at. (At least I assume now that it should be this way...) If it's equal or longer some colors (in the middle of the color-vector) are simply not used. Just try the example below with rainbow(5) and rainbow(6) and compare the results... both plot will use 5 colors! Sorry, but this behaviour is not really self-explaining to me... maybe I'm to blind to find the documentation which says that only one color less will ensure the usage of all colors. Well, of you have 5 at locations (i.e. breaks), then you have 4 intervals in between and that's the amount of colors that is sensible. (It is so important for me because I need to display a heatmap with colors let's say * all lower data outliers green, * all higher data outliers blue and * everything else within the color range yellow to red. I've seen that some values do not get blue or green though they are outliers... I've attached one graph, I've generated - maybe it helps to understand) Any wrong assumption? Maybe: Say you want everything below -1 be considered as a lower outlier and all above 1 is a higher outlier, then you can say: levelplot(matrix(c(1,2,0,-2), nrow=2), at = c(-Inf, seq(-1, 1, length=10), Inf), col.regions = c(rgb(0,1,0), hcl(seq(20, 80, length=10), c=400), rgb(0,0,1))) Then below -1 is green (rgb(0,1,0)), above 1 is blue (rgb(0,0,1)) and in between we have 10 regions from -1 to 1 each with a color between some kind of yellow and red in hcl() space. Uwe Ligges Ciao, Antje Uwe Ligges schrieb: Antje wrote: Hi there, as I'm not sure to understand the coloring levelplot uses, I'm looking for another easy way to create a heatmap like this: library(lattice) mat - matrix(seq(1,5, length.out = 12), nrow = 3) mat[1,2] - 3.5 my.at - seq(0.5,5.5, length.out = 6) my.col.regions - rainbow(5) graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = my.col.regions) print(graph) Can anybody help me with some hints or little examples? Dear Antje, since you are asking the same question again now, maybe you can explain what you are going to get? In fact, I do not undertsand where your problem is. R places the colors according to the values in your matrix very well including the legend and I thought up to today that the plot is self explaining. Best wishes, Uwe Ligges Antje __ 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@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] quick square root axes
On 5 May 2009, at 19:28, Duncan Murdoch wrote: On 5/5/2009 1:05 PM, Markus Loecher wrote: Dear R users, while I enjoy the built-in log argument to the plot() function, I wished it would be as easy to create more general custom transformed axes such as sqrt(), logit, etc... for example, instead of plot(x=exp(rnorm(10)), y=(1:10)^4, log = xy), sth. along the lines of plot(x=exp(rnorm(10)), y=(1:10)^4, trans = list(x = log, y = sqrt)) to encode the desired transfomation. This involves just transforming the xy values and creating nice tick marks at the appropriate positions. Before trying to write my own function, I wanted to see if that functionality already exists in another package ? Have you tried ggplot2? I think Hadley has given a lot of thinking on this sort of issues. http://had.co.nz/ggplot2/ http://had.co.nz/ggplot2/coord_trans.html baptiste I don't know of such a thing, but it may well exist. If you do write your own, the hardest part will be picking the nice tick marks. They should be approximately evenly spaced, but at nice round values of the original variable: that's hard to do in general. R has the pretty() function for the linear scale, and doesn't do too badly on log axes, but you'll need to work out your own rules for the sqrt or other scales. Duncan Murdoch __ 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. _ Baptiste Auguié School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag __ 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] quick square root axes
If you do write your own, the hardest part will be picking the nice tick marks. They should be approximately evenly spaced, but at nice round values of the original variable: that's hard to do in general. R has the pretty() function for the linear scale, and doesn't do too badly on log axes, but you'll need to work out your own rules for the sqrt or other scales. This seems like a nice (if smallish) research problem... Hadley -- http://had.co.nz/ __ 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] documenting quirky behavior of as.POSIXct, as.POSIX.lt regarding AM/PM, possibly other cases
I wanted to put this on the R Wiki, but found the suitable pages were read-only. I wanted to get it out in public to save people work. I was converting dates like 2009/03/26 01:00:00 AM using as.POSIXct. I found that using a format of %Y/%m/%d %I:%M:%S %p did not work correctly to distinguish AM from PM. Both were converted into the same timestamp. Indeed, what I found worked was affixing a space after the string timestamp to produce 2009/03/26 01:00:00 AM or 2009/03/26 01:00:00 PM . That works. Didn't see this documented in the associated pages anywhere. I wonder if the help system might benefit from user comments like for instance PHP has? __ 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] Error building package: LaTeX error when creating PDF version
I recently came across the same problem reported here: http://tolstoy.newcastle.edu.au/R/e6/help/09/04/12383.html The fix was to edit $R_HOME/etc/Renviron and change R_PDFLATEXCMD=${R_PDFLATEXCMD-${PDFLATEX-'/usr/texbin/pdflatex'}} to R_PDFLATEXCMD=${R_PDFLATEXCMD-${PDFLATEX-'pdflatex'}} with similar modifications to the other TeX-related commands. Patrick __ 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 2.9 and XML
After I installed R 2.9.0 my XML package cannot load; I get an error This application has failed to start because iconv.dll was not found. Re-installing the application may fix this problem. I already re-installed both but the problem persists. Does anyone know what is going on? I would appreciate any help. Thanks a lot I had this problem (after installing XML through install.packages() ) and worked around it by making a copy of Riconv.dll (in the R-2.9.0/biin directory) and naming it iconv.dll. The XML package seems to be working now, but I'd like to know if there's a better way. Ian Kennedy __ 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] re shape package - use one cast() instead of many
I have a data set that I'm trying to melt and cast in a specific way using the reshape package. (I'll use the ff_d dataset from reshape so I don't have to post a toy data set here. ) Lets say I'm looking for the interaction of treatment with each type of variable in ff_d. Using the command below gets me this. Subject will get a column and each treatment type by each variable will also get a column with values for each. cast(ff_d, subject~treatment+variable) subject 1_potato 1_buttery 1_grassy 1_rancid 1_painty 2_potato 2_buttery 3_painty 13 1818 18 18 18 1818 18 ... Now, if I want to look at just the the values for each variable by subject I can run the following command. cast(ff_d, subject~variable) subject potato buttery grassy rancid painty 13 54 54 54 54 54 ... What I'm wondering now, is run one cast() call and get both of these in one data.frame? Essentially, the values for each separate condition and interactions between them? cast() doesn't let me repeat variable names as that's what I first tried. Right now, i'm just running two separate cast() calls and cbinding/merging them together. Is there a better way? -- View this message in context: http://www.nabble.com/reshape-package---use-one-cast%28%29-instead-of-many-tp23394916p23394916.html Sent from the R help mailing list archive at Nabble.com. __ 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] re shape package - use one cast() instead of many
Thanks for your help! I wasn't sure what the margins variable did, but I'm beginning to understand. I'm almost there, but with my data (and with ff_d) I tried to margin over two variable names, however it only does one of them. So with ff_d I set margins=c(treatment,variable); however I only ever get 1_(all) 2_(all) and 3_(all)... never something like (all)_painty. (This also happens for margins=TRUE) To further exemplify, with my data I have the call to cast() as: cast(data.melted,Subject~CogStat+Animacy,mean,margins=c(CogStat,Animacy)) which results in: Subject COG_aCOG_i COG_(all)nCOG_anCOG_i nCOG_(all) 1 100 794. 676.5556 728.0833 810.7778 798.4103 800.7292 ... I would like additionally to get (all)_i (all)_a. It seems to just apply the margin to the first part of the formula before + (i.e. I can change it to Animacy+CogStat and get a_COG,a_nCOG, a_(all), etc.) hadley wrote: On Tue, May 5, 2009 at 3:03 PM, jwg20 jason.gulli...@gmail.com wrote: I have a data set that I'm trying to melt and cast in a specific way using the reshape package. (I'll use the ff_d dataset from reshape so I don't have to post a toy data set here. ) Lets say I'm looking for the interaction of treatment with each type of variable in ff_d. Using the command below gets me this. Subject will get a column and each treatment type by each variable will also get a column with values for each. cast(ff_d, subject~treatment+variable) subject 1_potato 1_buttery 1_grassy 1_rancid 1_painty 2_potato 2_buttery 3_painty 1 3 18 18 18 18 18 18 18 18 ... Now, if I want to look at just the the values for each variable by subject I can run the following command. cast(ff_d, subject~variable) subject potato buttery grassy rancid painty 1 3 54 54 54 54 54 ... What I'm wondering now, is run one cast() call and get both of these in one data.frame? Essentially, the values for each separate condition and interactions between them? cast() doesn't let me repeat variable names as that's what I first tried. Right now, i'm just running two separate cast() calls and cbinding/merging them together. Is there a better way? Have a look at the margins argument. Hadley -- http://had.co.nz/ __ 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. -- View this message in context: http://www.nabble.com/reshape-package---use-one-cast%28%29-instead-of-many-tp23394916p23395785.html Sent from the R help mailing list archive at Nabble.com. __ 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] self organizing map advice for categorical data
George Chen schrieb: Hello, Could anybody offer any advice about implementing a Kohonen self organizing map for categorical data? Specifically I am wondering if there are any pre-existent packages that can deal with categorical data and/or how one would compare the input vector of categoricals with the self organizing map nodes. Thanks in advance. George Chen Yes, there is a very nice one with excellent graphics, see article: Ron Wehrens, Lutgarde M. C. Buydens (2007) Self- and Super-organizing Maps in R: The kohonen Package. Journal of Statistical Software 21(5). http://www.jstatsoft.org/v21/i05 Hope it helps Thomas Petzoldt __ 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] ellipse
Dear all, I'm using the ellipse package and I would like to verify if the confidence region that I build with this package can be equivalent to an Union Intersection Test. I used different value for the t-statistic but I can not find the right equivalence. Does someone know how to choose the right value? Thanks a lot. Antonio -- Antonio Lucadamo, Dipartimento di Scienze Economiche e Metodi Quantitativi Università del Piemonte Orientale A. Avogadro via Perrone, 18 - 28100 Novara fax: +39 0321 375305 phone:+39 0321 375338 mobile phone: +39 3385973881 skype contact: antonio.lucadamo __ 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] illegal levels in yaImpute() / AsciiGridImpute()
I'm using randomForest in yaImpute to create a yai-type object which associates L with landscape features. Then I use the sp() package to impute L to a landscape consisting of four ascii files) I keep getting the message NA's generated due to illegal level(s) when I do the imputation. It's probably because one of the landscape features (as, for aspect/slope) is stored in numeric form but is treated as a factor when the yai object is created. as is also stored in numeric form in the ascii grids, of course. I included an xtypes argument in the AsciiGridImpute statement, but that did not help. Some relevant statements are: xfiles - list(DEM_10 = dem_10.asc, EASTING = easting.asc, NORTHING = northing.asc, as = asp_slop.asc) AsciiGridImpute(yai_ob, xfiles, outfiles, xtypes=list(numeric, numeric, integer, character)) Any insights will be appreciated. I'd particularly like to know how to gain access to the invisible list, VALUE, containing unexpectedNA's, illegal levels, and other information that would help me to troubleshoot the issue. Dr. Seth W. Bigelow Biologist, USDA-FS Sierra Nevada Research Center 1731 Research Park Drive, Davis California [[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] yacas
Hi, as I find problems with yacas package... is there any R function equivalent to the yacas function Factor ? the factor function which i found in the R help is not the same. it doesn't factor an algebraic expression.. thanks hassan [[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.