Re: [R] Identify and plotting symbols.
On Thu, 20 Sep 2007, Rolf Turner wrote: > I have been trying, unsuccessfully, to use identify() to (simply) return > a list of the indices of points clicked on and overplot (with say a > solid dot) each clicked-on point so that I can see where I've been. > I.e. I don't want to see the indices printed on the screen; I just want > the points I've already selected to be highlighted. > > I tried > > ind <- identify(x,y,labels=rep("\021",length(x)),offset=0) > > Two problems: > > (1) Instead of getting a solid dot --- which I thought I should > get from "\021", I got a small rectangle outlined in dotted lines. > (Which I would've thought I'd get from "\177".) Why did you think so? What glyphs (if any) you get from non-ASCII characters depends on the OS, locale, graphics device and font, none of which we know. (It can be even more specific than that: it may depend on what font variants you have installed, as on both X11 and Windows there can be multiple fonts of the same name with different encodings.) In particular in a UTF-8 locale (and you seem latterly to be using MacOS X which has UTF-8 locales), you probably need to select characters by Unicode points, e.g. \u2022 or \u22c5. > I seem to get the dotted rectangle no matter what 3 digit string I > use in "\xxx". I am surprised: does "\088" not give "H" ? > (2) Despite setting offset=0 the superimposed symbol is not > actually superimposed, but is jittered off the location of the existing > point by a small amount. Ah, what do you mean by 'superimposed'? What you should find is the appropriate edge of the bounding box of the character is on the point identified. See the 'value' section of the help page for what is meant by 'appropriate edge'. > Another minor annoyance is having to use rep("\021",length(x)) rather > than simply "\021". I.e. the vector supplied for labels does not get > ``recycled'' the way col and pch etc. are recycled. Which is as documented, and contrasts with e.g. text() which says its 'labels' argument is recycled. > Is there any way of resolving these difficulties? Yes, use identify(plot=FALSE) in a loop and manage the plotting yourself. Something like myidentify <- function(x, y, pch=19, n, ...) { res <- integer(0) for(i in seq_len(n)) { ans <- identify(x, y, plot=FALSE, n=1, ...) if(length(ans) == 0) break points(x[ans], y[ans], pch=pch) res <- c(res, ans) } res } and you can refine this by using xy.coords and not allowing repeats. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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] SHLIB problem under Vista
This is a known problem with your compiler installation, discussed in the R-admin manual. From the version in R-patched: There are known problems with one of the compilers sets in this toolset on Windows Vista: see the workaround below. (With that workaround it has been used on both 32- and 64-bit versions of Vista.) ... On Vista systems you will need to add c:\Rtools\MinGW\libexec\gcc\mingw\3.4.5 to the path. This is not relevant to the recommended compiler set for R 2.6.0. On Wed, 19 Sep 2007, Anand Patil wrote: > Hi all, > > > I'd like to distribute an R package that compiles some (small) C functions > every time it's sourced. The relevant code in the top level R script is as > follows: > > system("R CMD SHLIB Selma_extensions.c") > if (.Platform$OS.type=="windows") { >slash = '\\' >dyn.load("Selma_extensions.dll") > } > if (.Platform$OS.type=="unix") { >slash = '/' >dyn.load("Selma_extensions.so") > } Hmm, all the information you need is already in .Platform, $file.sep and $dynlib.ext: the latter varies by OS.type. > This works fine on a Mac, but I tried it under Windows Vista, after > installing RTools and telling it to put itself on the system path, and got > the following: > > making Selma_extensions.d from Selma_extensions.c > gcc.exe: installation problem, cannot exec `cc1': No such file or directory > make: *** [Selma_extensions.d] Error 1 > Error in dyn.load(x, as.logical(local), as.logical(now)) : >unable to load shared library > 'C:/Users/anand/Desktop/Selma/Selma_extensions.dll': > LoadLibrary failure: The specified module could not be found. > > Can this be fixed without requiring the user to do anything? The fix requires 'the user' to read the documentation. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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] SEM - standardized path coefficients? - significant style
Dear John Being an R user is like having Christmas every day and having a direct line to Santa for present suggestions. How about if path.diagram.sem had the ability to print non-significant paths in, for example dotted style? I had a go myself but couldn't see how to get (summary(model)$coeff)$"Pr(>|z|)" into the loop. Very best wishes Steve Powell proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org | www.mojakarijera.com | www.psih.org -Original Message- From: John Fox [mailto:[EMAIL PROTECTED] Sent: 19 September 2007 13:55 To: 'Steve Powell' Cc: [EMAIL PROTECTED] Subject: RE: [R] SEM - standardized path coefficients? Dear Steve, My intention was to provide this flexibility via the parameters argument to path.diagram.sem(), but it isn't implemented. Here's a version that should do what you want: - snip path.diagram.sem <- function (model, out.file, min.rank = NULL, max.rank = NULL, same.rank = NULL, variables = model$var.names, parameters, ignore.double = TRUE, edge.labels = c("names", "values"), size = c(8, 8), node.font = c("Helvetica", 14), edge.font = c("Helvetica", 10), rank.direction = c("LR", "TB"), digits = 2, ...) { if (!missing(out.file)) { handle <- file(out.file, "w") on.exit(close(handle)) } else handle <- stdout() edge.labels <- match.arg(edge.labels) rank.direction <- match.arg(rank.direction) cat(file = handle, paste("digraph \"", deparse(substitute(model)), "\" {\n", sep = "")) cat(file = handle, paste(" rankdir=", rank.direction, ";\n", sep = "")) cat(file = handle, paste(" size=\"", size[1], ",", size[2], "\";\n", sep = "")) cat(file = handle, paste(" node [fontname=\"", node.font[1], "\" fontsize=", node.font[2], " shape=box];\n", sep = "")) cat(file = handle, paste(" edge [fontname=\"", edge.font[1], "\" fontsize=", edge.font[2], "];\n", sep = "")) cat(file = handle, " center=1;\n") if (!is.null(min.rank)) { min.rank <- paste("\"", min.rank, "\"", sep = "") min.rank <- gsub(",", "\" \"", gsub(" ", "", min.rank)) cat(file = handle, paste(" {rank=min ", min.rank, "}\n", sep = "")) } if (!is.null(max.rank)) { max.rank <- paste("\"", max.rank, "\"", sep = "") max.rank <- gsub(",", "\" \"", gsub(" ", "", max.rank)) cat(file = handle, paste(" {rank=max ", max.rank, "}\n", sep = "")) } if (!is.null(same.rank)) { for (s in 1:length(same.rank)) { same <- paste("\"", same.rank[s], "\"", sep = "") same <- gsub(",", "\" \"", gsub(" ", "", same)) cat(file = handle, paste(" {rank=same ", same, "}\n", sep = "")) } } latent <- variables[-(1:model$n)] for (lat in latent) { cat(file = handle, paste(" \"", lat, "\" [shape=ellipse]\n", sep = "")) } ram <- model$ram ram[names(model$coeff), 5] <- model$coeff rownames(ram)[model$fixed] <- ram[model$fixed, 5] names <- rownames(ram) values <- round(ram[, 5], digits) heads <- ram[, 1] to <- ram[, 2] from <- ram[, 3] labels <- if (!missing(parameters)){ if (is.numeric(parameters)) round(parameters, digits) else parameters } else if (edge.labels == "names") names else values direction <- ifelse((heads == 2), " dir=both", "") for (par in 1:nrow(ram)) { if ((!ignore.double) || (heads[par] == 1)) cat(file = handle, paste(" \"", variables[from[par]], "\" -> \"", variables[to[par]], "\" [label=\"", labels[par], "\"", direction[par], "];\n", sep = "")) } cat(file = handle, "}\n") } - snip E.g., continuing the example in ?path.diagram, path.diagram(sem.dhp, min.rank='RIQ, RSES, RParAsp, FParAsp, FSES, FIQ', max.rank='ROccAsp, REdAsp, FEdAsp, FOccAsp', parameters=standardized.coefficients(sem.dhp)$"Std. Estimate") I'll put the updated path.diagram.sem() in the sem package when I have a chance. I hope this helps, John John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox > -Original Message- > From: Steve Powell [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 19, 2007 3:33 AM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: [R] SEM - standardized path coefficients? > > Dear list members, > In sem, std.coef() will give me standardized coefficients from a sem > model. > But is there a trick so that path.diagram can use
[R] Ambiguities in vector
Hello all you helpful people out there! I am stil R Beginner using R 2.5.1 on a Apple Power Book G4 with Mac OS X 10.4.10 . Perhaps you haven´t understood my question in the mail yesterday. So I will try to describe my problem in a different way You see the tables. I would like to test the variables between the tables. But for some variables in some species , I have more than 1 possibility. Example: if the variable is leaf form coded by numbers. The species Anth-crin could have the form round or elliptic coded with 1 and 2. So there is written 12. But the two numbers should be treated separately. Is there a possibility in R to have a classe with ambiguities? Or do I have to recode my variables in a different way to handle this? I really hope you understand now what I mean. If not please ask me. I would be very pleased, if somebody could help me. Here are the two tables: MalTabChi X1 X4 X6 X8 X10 X14 X21 X24 X29 X38 X43 X50 X67 X76 X78 X80 X82 X84 Anth_cap 1 1 1 1651 45124 12 6 5652 4 1 1 Anth_crin 12 1 1 2 7651 45 2562 25 56 56 3452 23 1 2 Anth_eck 12 1 12 175 12514 452 56 452 34 1 12 Anth_gram 2 1 1 1651 2525 23 25 45 5 452 23 1 12 Anth_insi 2 1 1 2 63514 222 45 45 45 12 3 1 23 Anth_laxi 12 1 1 127 4515 245 235 46 56 3452 23 1 12 Anth_sing 1 1 2 17 234514 129 2345 12 46 45 23 2 1 1 Aski_albo_ari 3 1 1 2652 46 2 34 15 34 553 4 1 1 Aski_alt 13 1 1 26524 23 15 46 552 34 3 1 Aski_and 1 1 2 26525 1 36 453 3 3 1 Aski_capi 3 1 1 2 63525 235 45 453 3 1 1. FemTabChi X1 X4 X6 X8 X10 X14 X21 X24 X29 X38 X43 X50 X67 X76 X78 X80 X82 X84 Anth_cap 1 11 244 1 5 6 142 6 56 52 23 1 1 Anth_crin1 11 2 475 1 45 612 455 342 3 1 23 Anth_eck 1 11 245 1 45 612 56 46 3452 3 1 12 Anth_gram1 11 2 5 2 5 4 56 56 52 3 1 1 Anth_insi1 11 235 1 426 252 45 52 3 1 234 Anth_laxi1 11 2 475 1 56 6 242 45 345 21 23 1 1 Anth_sing1 11 2 47 24 1 22422 44 52 12 1 1 Aski_albo_ari2 11 245 2 4 2 34 15 45 53 4 1 1 Aski_alt12 11 245 2 4895 15 465 52 3 3 1 Aski_and 1 11 245 2 5 25951 46 25 52 23 1 1 Aski_capi 23 11 2 2345 2 5 2459 2355 465 343 3 1 1 Aski_chart 12 11 245 2 4292 15 4 25 52 34 3 1 Aski_deli2 11 245 12 4 625 465 33 4 1 1.. Greetings Birgit Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] [[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] RE : Must be easy, but haven't found the function (numerical integration)
Hello Ravi, I was also trying to write down such a calculation but I did not manage (I didn't use diff(x)). Thank you for the solution. Ptit Bleu. Ravi Varadhan wrote: > > Here is a simple trapezoidal rule integrator: > > x <- time > y <- value > > area <- sum(diff(x)*(y[-1]+y[-length(y)]))/2 > > 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: [EMAIL PROTECTED] > > Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html > > > > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On > Behalf Of Ptit_Bleu > Sent: Tuesday, September 18, 2007 11:24 AM > To: r-help@r-project.org > Subject: Re: [R] RE : Must be easy, but haven't found the function > (numerical integration) > > > Thanks to all. > > cumsum can be helpful but the solution given by David seems to match my > request. > I will test it as soon as possible (before the end of the week, I hope). > > Have a nice end of day, > Ptit Bleu. > > > > GOUACHE David wrote: >> >> try : >> >> library(Bolsatd) >> ?sintegral >> >> or: >> >> library(caTools) >> ?trapz >> >> David Gouache >> Arvalis - Institut du Végétal >> Station de La Minière >> 78280 Guyancourt >> Tel: 01.30.12.96.22 / Port: 06.86.08.94.32 >> >> >> -Message d'origine- >> De : Ptit_Bleu [mailto:[EMAIL PROTECTED] >> Envoyé : lundi 17 septembre 2007 12:09 >> À : [EMAIL PROTECTED] >> Objet : [R] Must be easy,but haven't found the function (numerical >> integration) >> >> >> Hi, >> >> I have a data frame of 2 columns with the following types : >> data$day char >> data$value num >> >> And I plot my data with : >> plot(strptime(donnees$day,format="%Y-%m-%d %H:%M:%S"),donnees$value, >> type="l") >> >> And I'd just like to get the numerical value of the integration of this >> graph. >> I looked at ?integrate but, as far as I understood (that is, not very >> much, >> due to my poor english), it seems that it doesn't work with values in >> data >> frame. >> >> Could you please help me to do this ? >> >> Thanks in advance, >> Have a nice week, >> Ptit Bleu. >> -- >> View this message in context: >> > http://www.nabble.com/Must-be-easy%2C-but-haven%27t-found-the-function-%28nu > merical-integration%29-tf4465684.html#a12732936 >> 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. >> >> > > -- > View this message in context: > http://www.nabble.com/Must-be-easy%2C-but-haven%27t-found-the-function-%28nu > merical-integration%29-tf4465684.html#a12759423 > 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/Must-be-easy%2C-but-haven%27t-found-the-function-%28numerical-integration%29-tf4465684.html#a12792420 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] problem with generalized singular value decomposition using LAPACK
Hi All, I'm trying to run generalized singular value decomposition (GSVD) function from LAPACK library. Basically my problem is that I can not run it for large matrices, I get a memory error. I'm using R 2.5.1. I tried this on intel centos5 machines with 2 GB memory and 8 GB memory. I have unlimited max memory,cpu time and virtual memory. LAPACK is already compiled for R (libRlapack.so ) and using dyn.load and .Fortran functions it's possible to call LAPACK functions(I don't if it's the best way to do it) . I pasted the function below. As I said, it's not possible to run GSVD on large matrices. Here is couple of examples: > res=GSVD( matrix(1:35000,5000,6), matrix(1:35000,5000,6) ) #runs without problems > res=GSVD( matrix(1:36000,6000,6), matrix(1:36000,6000,6) ) Error: cannot allocate vector of size 274.7 Mb when tried with 8gig machine: res=GSVD(matrix(1:36000,6000,6), matrix(1:36000,6000,6) ) #runs without problems > res=GSVD(matrix(1:42000,7000,6), matrix(1:36000,6000,6) ) Error: cannot allocate vector of size 373.8 Mb when I tried this with equivalent built-in matlab GSVD function, I get a similar memory error as well. matlab also uses LAPACK for this. Is there a workaround for this problem without increasing the memory? Does using .Fortran makes it worse (memory wise)? I need to work with matrices 4 times larger than the ones I tried. I would be grateful if anyone can help on these issues Best, Altuna # function GSVD<-function(A,B) { # A=U*E1*Q' # B=V*E2*Q' dyn.load("/usr/local/lib/R/lib/libRlapack.so") #is.loaded("dggsvd") # returns TRUE z <- .Fortran("dggsvd", as.character('N'), as.character('N'), as.character('Q'), as.integer(nrow(A)), as.integer(ncol(A)), as.integer(nrow(B)), integer(1), integer(1), as.double(A), as.integer(nrow(A)), as.double(B), as.integer(nrow(B)), double(ncol(A)), double(ncol(A)), double(nrow(A)*nrow(A)), as.integer(nrow(A)), double(nrow(B)*nrow(B)), as.integer(nrow(B)), double(ncol(A)*ncol(A)), as.integer(ncol(A)), double(max(c(3*ncol(A),nrow(A),nrow(B)))+ncol(A)), integer(ncol(A)), integer(1),dup=FALSE) K=z[7][[1]] L=z[8][[1]] U=z[15][[1]] V=z[17][[1]] Q=z[19][[1]] ALPHA=z[13][[1]] BETA=z[14][[1]] R=matrix(z[9][[1]],ncol(A),nrow=nrow(A),byrow=FALSE) U=matrix(U,ncol=nrow(A),nrow=nrow(A),byrow=FALSE) V=matrix(V,ncol=nrow(B),nrow=nrow(B),byrow=FALSE) Q=matrix(Q,ncol=ncol(A),nrow=ncol(A),byrow=FALSE) D1=mat.or.vec(nrow(A),K+L) D2=mat.or.vec(nrow(B),K+L) oR=mat.or.vec((K+L),ncol(A)) if(K > 0) { if(K==1) { D1[1:K,1:K] =rep(1,K) } else { diag(D1[1:K,1:K])=rep(1,K) } diag(D1[(K+1):(K+L),(K+1):(K+L)])=ALPHA[(K+1):(K+L)] diag(D2[1:L,(K+1):(K+L)])=BETA[(K+1):(K+L)] } if(K ==0) { diag(D1[(K+1):(K+L),(K+1):(K+L)])=ALPHA[(K+1):(K+L)] diag(D2[1:L,(K+1):(K+L)])=BETA[(K+1):(K+L)] } Ci=ALPHA[(K+1):(K+L)] S=BETA[(K+1):(K+L)] oR[(1):(K+L),(ncol(A)-K-L+1):(ncol(A))]=R[(1):(K+L),(ncol(A)-K-L+1):(ncol(A))] return(list(U=U,V=V,Q=Q,D1=D1,D2=D2,oR=oR,C=Ci,S=S,K=K,L=L)) } __ 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] Smooth line in graph
Both worked, thanks! N. Fernandez > Katharine Mullen: > > require(splines) > x<-1:5 > y <- c(0.31, 0.45, 0.84, 0.43, 0.25) > yy <-predict(interpSpline(x, y)) > plot(x, y) > lines(yy) > > Greg Snow: > lines(spline(x,y, method='n', n=250)) __ 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] R
I am going to fit my model with R-2.5.1.tar my model is y=fixed effect+b(x) and I have three column in my data file (y a x) and about 20 observation(y) but I had some problems. I was wondering If you could help me the error massage is: > res <- read.table("pro.sdf") > fm <- glm(y=A+x,data=res) Error: NA/NaN/Inf in foreign function call (arg 4) In addition: Warning messages: 1: - not meaningful for factors in: Ops.factor(y, mu) 2: - not meaningful for factors in: Ops.factor(eta, offset) 3: - not meaningful for factors in: Ops.factor(y, mu) thank you sincerely M.Sahebhonar Send instant messages to your online friends http://uk.messenger.yahoo.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] R
On 20-Sep-07 08:45:43, mohammad sahebhonar wrote: > I am going to fit my model with R-2.5.1.tar > my model is y=fixed effect+b(x) and I have three column in my > data file (y a x) and about 20 observation(y) > but I had some problems. I was wondering If you could help me > the error massage is: >> res <- read.table("pro.sdf") >> fm <- glm(y=A+x,data=res) > Error: NA/NaN/Inf in foreign function call (arg 4) > In addition: Warning messages: > 1: - not meaningful for factors in: Ops.factor(y, mu) > 2: - not meaningful for factors in: Ops.factor(eta, offset) > 3: - not meaningful for factors in: Ops.factor(y, mu) > thank you > sincerely > M.Sahebhonar > > Send instant messages to your online friends > http://uk.messenger.yahoo.com > [[alternative HTML version deleted]] There are two points to investigate in your description above. 1. You describe your datafile as having three columns "y", "a", "x", but in your formular you wrote "A+x". If the column-name is "a" then "A+x" will not work since "a" and "A" are different names. Either the column name in the datafile really is "A", and there is no problem (you simply typed it wrong above), or it is really "a" and you should use "y ~ a+x" (see below). 2. The way to specify a model formula to glm (also lm, etc.) is to write the formula as y ~ A+x (or y ~ a+x, depending on which one is correct) Do not use "y = a+x"! Best woishes, Ted. E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 20-Sep-07 Time: 10:50:24 -- XFMail -- __ 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] combine mathematical expressions with plain text
Hello, I would like to create a mtext. The argument 'text' should combine the mathematical expressions 'bar' with the plain text ' = 3.07'. Is that possible? mtext(text=expression(bar(x)) ...) ' = 3.07' Thanks for any ideas Tobias -- View this message in context: http://www.nabble.com/combine-mathematical-expressions-with-plain-text-tf4486503.html#a12793991 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] Smooth line in graph
Sorry, I answered too quickly. It worked with the "simplified" example I provided but not with non-regular intervals in x: x<-c(-45,67,131,259,347) y <- c(0.31, 0.45, 0.84, 0.43, 0.25) plot(x,y) lines(spline(x,y, method='n', n=250)) #or: lines(predict(interpSpline(x, y))) Produce the same decrease between first two points and the shape is quite different to that produced by sigmaplot -I need comparable figures. Changing "method" and "n" arguments did not help. Sorry for bothering. Any other suggestion? Greg Snow escribió: > Try: > > >> lines(spline(x,y, method='n', n=250)) >> > > __ 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 generalized singular value decomposition using LAPACK
> I'm trying to run generalized singular value decomposition (GSVD) > function from LAPACK library. Basically my problem is that I can not run > it for large matrices, I get a memory error. I'm using R 2.5.1. I tried > this on intel centos5 machines with 2 GB memory and 8 GB memory. I have > unlimited max memory,cpu time and virtual memory. > >> res=GSVD( matrix(1:35000,5000,6), matrix(1:35000,5000,6) ) #runs >> without > problems >> res=GSVD( matrix(1:36000,6000,6), matrix(1:36000,6000,6) ) > Error: cannot allocate vector of size 274.7 Mb Did you examine R's internal memory limits, e.g. ?memory for help... that should help. [You should, most likely, be able to allocate a ~274MB vector on a 2GB machine... but you might have to coerce R into taking that much memory from the system, rather than trying to be conservative.] --elijah __ 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] combine mathematical expressions with plain text
plot(0,0,"n") mtext( expression( bar(x) == 3.07) ) but you can also simply 'paste' things: text(0,0,labels=expression(paste(bar(omega), " = 1")),srt=90) __ 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] Need help on "date"
This mail is continuation of my previous one. i have some raw data from Excel which was carried to R: data = read.delim(file="clipboard", header=T) > data Date Price 1 09/01/05 365 2 09/02/05 360 3 09/03/05 360 4 09/05/05 370 5 09/06/05 370 6 09/08/05 365 7 09/09/05 365 8 09/10/05 365 9 09/12/05 365 10 09/13/05 360 11 09/14/05 360 12 09/15/05 360 and, using the input from R-help I exctracted day, month, and year, from "Date" year = as.numeric(format(as.Date(data[,1],"%m/%d/%y"),"%Y")) month = as.numeric(format(as.Date(data[,1],"%m/%d/%y"),"%m")) day = as.numeric(format(as.Date(data[,1],"%m/%d/%y"),"%d")) Now I want to create a date-variable and put it in actual data: library(date) data1 = cbind(mdy.date(month, day, year), data[,-1]) > data1 [,1] [,2] [1,] 16680 365 [2,] 16681 360 [3,] 16682 360 [4,] 16684 370 [5,] 16685 370 [6,] 16687 365 [7,] 16688 365 [8,] 16689 365 [9,] 16691 365 [10,] 16692 360 [11,] 16693 360 [12,] 16694 360 However this is not that thing what I wanted, first column has been jumbled, it is not in actual date format. Can anyone tell me what should i do here? Regards, On 9/18/07, Arun Kumar Saha <[EMAIL PROTECTED]> wrote: > > Dear all, > > I have a variable 'x' like that: > > > x > [1] "2005-09-01" > > Here, 2005 represents year, 09 month and 01 day. > > Now I want to create three variables naming: y, m, and d such that: > > y = 2005 > m = 09 > d = 01 > > can anyone tell me how to do that? > > 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] combine mathematical expressions with plain text
Hi, have you tried: mtext(expression(bar(x) == 3.07), ...) or mtext(bquote(bar(x) == 3.07), ...) ? Fernando Mayer. squall44 escreveu: > Hello, > > I would like to create a mtext. The argument 'text' should combine the > mathematical expressions 'bar' with the plain text ' = 3.07'. Is that > possible? > > mtext(text=expression(bar(x)) ...) > ' = 3.07' > > Thanks for any ideas > Tobias __ 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] Need help on "date"
Since this is a time series you might want to look at the zoo package: Lines <- "Date Price 09/01/05 365 09/02/05 360 09/03/05 360 09/05/05 370 09/06/05 370 09/08/05 365 09/09/05 365 09/10/05 365 09/12/05 365 09/13/05 360 09/14/05 360 09/15/05 360 " library(zoo) # replace with #z <- read.zoo("myfile.dat", header = TRUE,format = "%m/%d/%Y") z <- read.zoo(textConnection(Lines), header = TRUE, format = "%m/%d/%Y") plot(z) vignette("zoo") # info on zoo vignette("zoo-quickref") # more info on zoo On 9/20/07, Arun Kumar Saha <[EMAIL PROTECTED]> wrote: > This mail is continuation of my previous one. i have some raw data from > Excel which was carried to R: > > data = read.delim(file="clipboard", header=T) > > data > Date Price > 1 09/01/05 365 > 2 09/02/05 360 > 3 09/03/05 360 > 4 09/05/05 370 > 5 09/06/05 370 > 6 09/08/05 365 > 7 09/09/05 365 > 8 09/10/05 365 > 9 09/12/05 365 > 10 09/13/05 360 > 11 09/14/05 360 > 12 09/15/05 360 > > and, using the input from R-help I exctracted day, month, and year, from > "Date" > > year = as.numeric(format(as.Date(data[,1],"%m/%d/%y"),"%Y")) > month = as.numeric(format(as.Date(data[,1],"%m/%d/%y"),"%m")) > day = as.numeric(format(as.Date(data[,1],"%m/%d/%y"),"%d")) > > Now I want to create a date-variable and put it in actual data: > > library(date) > data1 = cbind(mdy.date(month, day, year), data[,-1]) > > data1 > [,1] [,2] > [1,] 16680 365 > [2,] 16681 360 > [3,] 16682 360 > [4,] 16684 370 > [5,] 16685 370 > [6,] 16687 365 > [7,] 16688 365 > [8,] 16689 365 > [9,] 16691 365 > [10,] 16692 360 > [11,] 16693 360 > [12,] 16694 360 > > However this is not that thing what I wanted, first column has been jumbled, > it is not in actual date format. > > Can anyone tell me what should i do here? > > Regards, > > > > > > > On 9/18/07, Arun Kumar Saha <[EMAIL PROTECTED]> wrote: > > > > Dear all, > > > > I have a variable 'x' like that: > > > > > x > > [1] "2005-09-01" > > > > Here, 2005 represents year, 09 month and 01 day. > > > > Now I want to create three variables naming: y, m, and d such that: > > > > y = 2005 > > m = 09 > > d = 01 > > > > can anyone tell me how to do that? > > > > 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. > __ 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] referencing packages?
Hi I know how to referenc R in a scientific paper - but is there a standardised way to reference packages? Thanks Rainer -- NEW EMAIL ADDRESS AND ADDRESS: [EMAIL PROTECTED] [EMAIL PROTECTED] WILL BE DISCONTINUED END OF MARCH Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Plant Conservation Unit Department of Botany University of Cape Town Rondebosch 7701 South Africa Tel:+27 - (0)21 650 5776 (w) Fax:+27 - (0)86 516 2782 Fax:+27 - (0)21 650 2440 (w) Cell: +27 - (0)83 9479 042 Skype: RMkrug email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ 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] referencing packages?
use citation("pkg-name") On Thu, 20 Sep 2007, Rainer M. Krug wrote: > Hi > > I know how to referenc R in a scientific paper - but is there a > standardised way to reference packages? > > Thanks > > Rainer > > -- > NEW EMAIL ADDRESS AND ADDRESS: > > [EMAIL PROTECTED] > > [EMAIL PROTECTED] WILL BE DISCONTINUED END OF MARCH > > Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation > Biology (UCT) > > Plant Conservation Unit > Department of Botany > University of Cape Town > Rondebosch 7701 > South Africa > > Tel: +27 - (0)21 650 5776 (w) > Fax: +27 - (0)86 516 2782 > Fax: +27 - (0)21 650 2440 (w) > Cell: +27 - (0)83 9479 042 > > Skype:RMkrug > > email:[EMAIL PROTECTED] > [EMAIL PROTECTED] > > __ > 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] referencing packages?
Thanks a million Rainer Katharine Mullen wrote: > use citation("pkg-name") > > On Thu, 20 Sep 2007, Rainer M. Krug wrote: > >> Hi >> >> I know how to referenc R in a scientific paper - but is there a >> standardised way to reference packages? >> >> Thanks >> >> Rainer >> >> -- >> NEW EMAIL ADDRESS AND ADDRESS: >> >> [EMAIL PROTECTED] >> >> [EMAIL PROTECTED] WILL BE DISCONTINUED END OF MARCH >> >> Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation >> Biology (UCT) >> >> Plant Conservation Unit >> Department of Botany >> University of Cape Town >> Rondebosch 7701 >> South Africa >> >> Tel: +27 - (0)21 650 5776 (w) >> Fax: +27 - (0)86 516 2782 >> Fax: +27 - (0)21 650 2440 (w) >> Cell:+27 - (0)83 9479 042 >> >> Skype: RMkrug >> >> email: [EMAIL PROTECTED] >> [EMAIL PROTECTED] >> >> __ >> 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. -- NEW EMAIL ADDRESS AND ADDRESS: [EMAIL PROTECTED] [EMAIL PROTECTED] WILL BE DISCONTINUED END OF MARCH Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Plant Conservation Unit Department of Botany University of Cape Town Rondebosch 7701 South Africa Tel:+27 - (0)21 650 5776 (w) Fax:+27 - (0)86 516 2782 Fax:+27 - (0)21 650 2440 (w) Cell: +27 - (0)83 9479 042 Skype: RMkrug email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ 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] Cutting & pasting help examples into script window
Hi All, When I cut & paste help file examples into a script window, about half the time it pastes as a single long line. The steps I follow are: 1. Open a help file e.g. ?data.frame. 2. Select the examples at the bottom. 3. Choose File: Copy. 4. Return to the console. 5. Choose File: New script. 6. Choose File: Paste or do CTRL-V. The examples frequently paste as a single long line. I came across this in 2.6.0 beta on Windows XP & thought it was related to the cut/paste changes in that version. I went back to 2.5.1 and at first it worked fine, verifying my suspicion that it was a 2.6.0 problem. I double-checked my steps before posting, and to my surprise found that in both versions this problem is intermittent. I thought it might be a menu vs. keyboard CTRL-V difference, but found it happens with both, and in both versions. I have also fiddled with sizing or moving the Help window but that doesn't seem to be related. I did discover that may be a problem on the paste side of things, as so far it *always* pastes into Notepad correctly. Any ideas? Thanks, Bob P.S. What would really be slick would be to select the example in Help, right-click and choose Run Line or Selection. Perhaps in version 2.7. ;-) . = Bob Muenchen (pronounced Min'-chen), Manager, Statistical Consulting Center U of TN Office of Information Technology Stokely Management Center, Suite 200 916 Volunteer Blvd., Knoxville, TN 37996-0520 Voice: (865) 974-5230 FAX: (865) 974-4810 Email: [EMAIL PROTECTED] Web: http://oit.utk.edu/scc Map: http://www.utk.edu/maps News: http://listserv.utk.edu/archives/statnews.html = __ 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] SEM - singularity error
Good morning, I am trying to develop a structural equation model of snake abundance using habitat variables. In attempting to estimate the model using the "sem" package in R version 2.4.0, I receive the following error message: "Error in solve.default(C) : system is computationally singular: reciprocal condition number = 1.75349e-16" MAIN PROBLEM: I am hoping to discover why I am receiving the aforementioned error message and how to successfully estimate the model. OTHER INFORMATION: 1. I believe the model is over-identified rather than under-identified (based on my understanding of the t-rule). I have observed data for 10 variables (9 exogenous, 1 endogenous). 2. I am not certain that I have used the proper tool to estimate the covariance matrix. In this case, I used the "VAR" function. 3. I am most concerned that I have improperly coded the RAM file. For example, in a case where I have three exogenous indicators of one exogenous latent variable, I specify a start value of 1 for one of the exogenous indicators. I am not sure if this is proper or necessary. 4. I am new to SEM; this is the first model I have ever tried to estimate. R CODE: Below is the r-code I have used to estimate the structural equation model -- # LOADING R PACKAGES library(sem) # READING IN THE CSV FILES thsi.2006<-read.csv("thsi_ab_env_space_sem.csv") thsi<-thsi.2006 # MAKING "RAM" FILE 2 model2.nlc <-specify.model() Moist->slope, NA, 1 Moist->sand, lamda21, NA Moist->clay, lamda31, NA Hab->isol, NA, 1 Hab->edgedist_a, lamda52, NA Hab->ag10, lamda62, NA Hab->urb10, lamda72, NA Hab->rd10, lamda82, NA Hab->y, lamda92, NA Moist->this, gamma11, NA Hab->this, gamma12, NA slope<->slope, theta11, NA sand<->sand, theta22, NA clay<->clay, theta33, NA isol<->isol, theta44, NA edgedist_a<->edgedist_a, theta55, NA ag10<->ag10, theta66, NA urb10<->urb10, theta77, NA rd10<->rd10, theta88, NA y<->y, the99, NA Moist<->Moist, phi11, NA Hab<->Hab, phi22, NA this<->this, theps11, NA model2.nlc end # MAKING S (COVARIANCE MATRIX) thsi.var <- var(thsi) # MAKING UNSCALED SEM MODEL sem2<-sem(ram=model2.nlc, S=thsi.var, N=22) I am also attaching a jpeg diagram of the model I am trying to estimate. Please let me know if there is any additional information that I should add to this posting. Thank you so much for your time. Nicolette Cagle -- Ecology Ph.D. Candidate Duke University Durham, NC 27708 www.duke.edu/~nlc4__ 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 find "p"(proportion) in binomial(n, p)?
Hi, I got a problem. I am trying to find "p" in binomial. X~bin(n, p) I want to find value "p", so that Pr(X <= k) <= alpha. Here, n, k are known. Thank you for helping me with this! Catherine _ [[replacing trailing 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] The Survey package again
Good afternoon! 1 I have a bit of a problem with the Survey package, but one that is more theoretical than practical. If for example on wishes to use some additional information which comprises of 4 variables with 7, 5,5 and 5 categories (resulting in 875 post-strata if the whole crossing were to be constructed) and if only the marginal distribution of each variable is known, would it be better to rake or to calibrate? 2 Is calibrating affected by the cells with 0 frequency, as raking is? 3 when a sample is already stratified and one wishes to post stratify by other variables, do the new weights take account of the fact that the sample is stratified and that sampling weights could be determined; and what is the algorithm for determining these new weights; are the new weights determined for each strata taking account of the sampling weights for each strata ? Thank you and have a good day! - [[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] Identify and plotting symbols.
Rolf Turner auckland.ac.nz> writes: ... > I tried > > ind <- identify(x,y,labels=rep("\021",length(x)),offset=0) Have you tried "\225" or "\244" or "\370" (which can be previewed by typing > "\225" etc), and clicking just above the plotted datapoints? D L McArthur, UCLA Sch of Medicine dmca ucla.edu __ 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] ggplot and xlim/ylim
Hello everyone, I am (happily) using ggplot2 for all my plotting now and I wondered is there is an easy way to specify xlim and ylim somewhere when using the ggplot syntax, as opposed to the qplot syntax. Eg. qplot(data=mtcars,y=wt, x=qsec,xlim=c(0,30)) <-> ggplot(mtcars, aes(y=wt, x=qsec)) + geom_point() + ??? Indeed the ggplot syntax is in general more flexible and powerful and I usually rely on it in scripts. It would be nice to know how to use xlim/ylim with this syntax. Thank you in advance. JiHO --- http://jo.irisson.free.fr/ __ 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] Cutting & pasting help examples into script window
On Thursday 20 September 2007 15:08:45 Muenchen, Robert A (Bob) wrote: MR > Hi All, MR > MR > When I cut & paste help file examples into a script window, about half MR > the time it pastes as a single long line. MR > MR > Any ideas? MR > MR > Thanks, MR > Bob MR > MR > P.S. What would really be slick would be to select the example in Help, MR > right-click and choose Run Line or Selection. Perhaps in version 2.7. MR > ;-) . What I do not understand is why you not just type example(yourcommand)? Stefan __ 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] Comprehensive New Learning Resource for R
Hi Folks, I have created a website with over 70 R tutorials on a wide range of subjects. The site is aimed at data analysts who have an idea about what they would like to do, but don't know how to do it in R. The site should be particularly useful for users of statistical packages like SAS, SPSS, Stata, and Systat who would like to get up and running in R quickly. However, I think that it will also be useful for even veteran R users. The URL is http://www.statmethods.net Topics are organized around these headings: * The R Interface * Data Input * Data Management * Basic Statistics * Advanced Statistics * Basic Graphs * Advanced Graphs Topic range from GUIs to creating publication quality output, from database access to date values, from t-tests to generalized linear models, from barcharts to interactive multivariate graphics. I hope that you find this useful. Please feel free to link to the site. Feedback is always welcome. Sincerely, Rob Kabacoff, Ph.D. [EMAIL PROTECTED] www.statmethods.net __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Package Survey
Hello, How I use the function as.svrepdesign without memory.size problems? desenho_npc_JK <- as.svrepdesign(desenho_npc,type="JKn") Error: cannot allocate vector of size 161.3 Mb In addition: Warning messages: 1: Reached total allocation of 1022Mb: see help(memory.size) 2: Reached total allocation of 1022Mb: see help(memory.size) 3: Reached total allocation of 1022Mb: see help(memory.size) 4: Reached total allocation of 1022Mb: see help(memory.size) Many thanks, --- Rita Sousa Departamento de Metodologia e Sistemas de Informação INE - DP: Instituto Nacional de Estatística - Delegação do Porto Tel.: 22 6072016 (Extensão: 4116) --- [[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] Must be easy, but haven't found the function (numerical integration)
Ptit Bleu. try the 'adapt' function for multi-dimensional numerical integration. library(adapt) Adaptive Numerical Integration in 220 Dimensions John Checked by AVG Free Edition. 11:53 __ 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] Cutting & pasting help examples into script window
Stephan Grosse replied: > > What I do not understand is why you not just type example(yourcommand)? > > Stefan That's a good question. I want to play around with variations of the examples rather than run them exactly as they are. Thanks, Bob __ 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] comparing survival curves(weighted log rank test)
hie I know I can use the log rank test for comparing survival curves but my problem is that the G(rho) by fleming & harrington(1982) which is the one in R seems to be inadequate are they any other test ie fleming & harrington (1991) as there are some some differences on the survival curves I need to compare. if some one can suggest a weighted log rank in R i will be very greatful - [[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] ggplot and xlim/ylim
Hi Jiho, To figure this out, you need to think about exactly what you are doing when you change the limits - what part of the plot are you changing? You are changing the scales, and if you have a look at http://had.co.nz/ggplot2/scale_continuous.html, you'll see you need something like: + scale_y_continuous(limits=c(0,10) Remember, you can also modify qplot in the same way as ggplot: qplot(...) + geom_point() + ... Regards, Hadley On 9/20/07, jiho <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I am (happily) using ggplot2 for all my plotting now and I wondered > is there is an easy way to specify xlim and ylim somewhere when using > the ggplot syntax, as opposed to the qplot syntax. Eg. > > qplot(data=mtcars,y=wt, x=qsec,xlim=c(0,30)) > > <-> > > ggplot(mtcars, aes(y=wt, x=qsec)) + geom_point() + ??? > > Indeed the ggplot syntax is in general more flexible and powerful and > I usually rely on it in scripts. It would be nice to know how to use > xlim/ylim with this syntax. > > Thank you in advance. > > JiHO > --- > http://jo.irisson.free.fr/ > > __ > 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. > -- 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.
Re: [R] Package Survey
On Thu, 20 Sep 2007, Rita Sousa wrote: How I use the function as.svrepdesign without memory.size problems? desenho_npc_JK <- as.svrepdesign(desenho_npc,type="JKn") Error: cannot allocate vector of size 161.3 Mb There is currently no easy way to affect the amount of memory that this uses, unless you can divide the data into pieces -- for example, use only some variables, or create separate design objects for strata. The surveyNG package, which can handle very large designs, does not yet do replicate-weight analyses. One question is how big the design actually is. 161.3Mb looks like a vector of length 21 million If this is the number of observations in the study then you need a larger computer. If it is the total number of replicate weights then you may just be able to increase the memory limit for R on your computer using the memory.size() function, as the warning method suggests. -thomas In addition: Warning messages: 1: Reached total allocation of 1022Mb: see help(memory.size) 2: Reached total allocation of 1022Mb: see help(memory.size) 3: Reached total allocation of 1022Mb: see help(memory.size) 4: Reached total allocation of 1022Mb: see help(memory.size) Many thanks, --- Rita Sousa Departamento de Metodologia e Sistemas de Informa??o INE - DP: Instituto Nacional de Estat?stica - Delega??o do Porto Tel.: 22 6072016 (Extens?o: 4116) --- [[alternative HTML version deleted]] Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle__ 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] Comprehensive New Learning Resource for R
On 20.09.2007, at 09:24, Rob Kabacoff wrote: > I hope that you find this useful. Please feel free to link to the > site. Very nicely done from what I saw by browsing the site a little. Good colors, good content, easy to navigate. Thanks! You might want to add self-organizing maps as a cross-over of clustering and visualization. Maybe statistical learning methods as well. Regards, Wiebke __ 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] Comprehensive New Learning Resource for R
Also use of T and F is bad form since its possible to define variables T and F. Use TRUE and FALSE. On 9/20/07, Ted Harding <[EMAIL PROTECTED]> wrote: > Excellent! Thanks. Just what I need for referring > friends to. > > However, your very first feedback: > > Under http://www.statmethods.net/input/datatypes.html > you have: > > ##Vectors > > a <- c(1,2,5.3,6,-2,4) # numberic vector > b <- c("one","two","three") # character vector > c <- c(T,T,T,F,T,F) #logical vector > > ##Refer to elements of a vector using subscripts. > > a[2,4] # 2nd and 4th elements of vector > > ## Err, no! a[c(2,4)] of course! > > More {when|if} I spot them! > Best wishes, > Ted. > > On 20-Sep-07 13:24:22, Rob Kabacoff wrote: > > Hi Folks, > > > > I have created a website with over 70 R tutorials on a wide range of > > subjects. The site is aimed at data analysts who have an idea about > > what they would like to do, but don't know how to do it in R. The site > > should be particularly useful for users of statistical packages like > > SAS, SPSS, Stata, and Systat who would like to get up and running in R > > quickly. However, I think that it will also be useful for even veteran > > R users. > > > > The URL is http://www.statmethods.net > > > > Topics are organized around these headings: > > * The R Interface > > * Data Input > > * Data Management > > * Basic Statistics > > * Advanced Statistics > > * Basic Graphs > > * Advanced Graphs > > > > Topic range from GUIs to creating publication quality output, from > > database access to date values, from t-tests to generalized linear > > models, from barcharts to interactive multivariate graphics. > > > > I hope that you find this useful. Please feel free to link to the site. > > > > Feedback is always welcome. > > > > Sincerely, > > > > Rob Kabacoff, Ph.D. > > [EMAIL PROTECTED] > > www.statmethods.net > > > > __ > > 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. > > > E-Mail: (Ted Harding) <[EMAIL PROTECTED]> > Fax-to-email: +44 (0)870 094 0861 > Date: 20-Sep-07 Time: 15:17:14 > -- XFMail -- > > __ > 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] warnings although R CMD check runs without any problem
Can you give examples? Uwe Christian Kohler wrote: > Dear list members, > > as I am new to R, I would kindly like to ask for your help. > > I checked a package with the 'R CMD check' command and all worked out > well, (only 'OK' status). Loading its vignette afterwards with > 'source("package.Rcheck/inst/doc/vignette.R")' yields a message saying > that several (well, in my case more than 50) warnings still exist and > can be viewed via the 'warnings()' command. > > My question now is: why are there still warnings even though the check > has been passed without any problems? Generally speaking, would it be > possible to submit this package e.g. to the Bioconductor project, even > if these warnings still exist? > > > Thanks in advance, > Christian > > > __ 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] Comprehensive New Learning Resource for R
Excellent! Thanks. Just what I need for referring friends to. However, your very first feedback: Under http://www.statmethods.net/input/datatypes.html you have: ##Vectors a <- c(1,2,5.3,6,-2,4) # numberic vector b <- c("one","two","three") # character vector c <- c(T,T,T,F,T,F) #logical vector ##Refer to elements of a vector using subscripts. a[2,4] # 2nd and 4th elements of vector ## Err, no! a[c(2,4)] of course! More {when|if} I spot them! Best wishes, Ted. On 20-Sep-07 13:24:22, Rob Kabacoff wrote: > Hi Folks, > > I have created a website with over 70 R tutorials on a wide range of > subjects. The site is aimed at data analysts who have an idea about > what they would like to do, but don't know how to do it in R. The site > should be particularly useful for users of statistical packages like > SAS, SPSS, Stata, and Systat who would like to get up and running in R > quickly. However, I think that it will also be useful for even veteran > R users. > > The URL is http://www.statmethods.net > > Topics are organized around these headings: > * The R Interface > * Data Input > * Data Management > * Basic Statistics > * Advanced Statistics > * Basic Graphs > * Advanced Graphs > > Topic range from GUIs to creating publication quality output, from > database access to date values, from t-tests to generalized linear > models, from barcharts to interactive multivariate graphics. > > I hope that you find this useful. Please feel free to link to the site. > > Feedback is always welcome. > > Sincerely, > > Rob Kabacoff, Ph.D. > [EMAIL PROTECTED] > www.statmethods.net > > __ > 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. E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 20-Sep-07 Time: 15:17:14 -- XFMail -- __ 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] warnings although R CMD check runs without any problem
Dear list members, as I am new to R, I would kindly like to ask for your help. I checked a package with the 'R CMD check' command and all worked out well, (only 'OK' status). Loading its vignette afterwards with 'source("package.Rcheck/inst/doc/vignette.R")' yields a message saying that several (well, in my case more than 50) warnings still exist and can be viewed via the 'warnings()' command. My question now is: why are there still warnings even though the check has been passed without any problems? Generally speaking, would it be possible to submit this package e.g. to the Bioconductor project, even if these warnings still exist? Thanks in advance, Christian -- Christian Kohler Institute of Functional Genomics Computational Diagnostics University of Regensburg D-93147 Regensburg (Germany) __ 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] SEM - standardized path coefficients? - significant style
Dear Steve, I'll file this suggestion for when I next revise the sem package. I'm unlikely to get to it soon since I rarely use the graph-drawing program dot and would have to figure out how to do what you want. As well, I think that I'd more likely allow the user to specify the line type for each edge in the graph rather than hard-coding this to significance/non-significance. Regards, John John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox > -Original Message- > From: Steve Powell [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 20, 2007 3:40 AM > To: 'John Fox' > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: RE: [R] SEM - standardized path coefficients? - > significant style > > Dear John > Being an R user is like having Christmas every day and having > a direct line to Santa for present suggestions. > How about if path.diagram.sem had the ability to print > non-significant paths in, for example dotted style? I had a > go myself but couldn't see how to get > (summary(model)$coeff)$"Pr(>|z|)" into the loop. > Very best wishes > Steve Powell > > > proMENTE social research > research | evaluation | training & consulting Kranjčevićeva > 35, 71000 Sarajevo > mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 > 33 556 866 > skype: stevepowell99 > www.promente.org | www.mojakarijera.com | www.psih.org > __ 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 lars
Hi! Ok, probably my last mail was too long. Questions are: * Did someone try lars on data with much more components than data points? Did you observe bad overfitting, too? Any other observations? * Why might the lars (least angle regression from lars package) method produce beta values that shoot up into the sky (until they overflow), and why might the Cp values start at a _negative_ value in step 1, growing linearly? That's not normal behaviour. What might be wrong there? For details see my last mail. :) Regards, Wiebke __ 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] It works but I don't know how (nice scientific notation with Lattice)
Hi, I had problems to display my results in a nice way (according to me). Thanks to posts of people of this forum, I solved my problems (ticks with a scientific notation and how to write nicely "V/m2" in the label of the x-axis) but ... I don't understand the script. Can somebody explain me how the short script below writes the scientific notation ? I guess it is the result of ans$bottom$labels$labels <- parse(text = ans$bottom$labels$labels) but it is really not clear to me. Thanks in advance for your explainations Ptit Bleu. library(lattice) x<-c(10,100,1000,1,10,20,200,2000,2,20) y<-c(1,2,3,4,5,2,4,6,8,10) z<-c(1,1,1,1,1,2,2,2,2,2) xyplot(y ~ x | z, scales = list(x = list(log = T)), xscale.components = function(...) { ans <- xscale.components.default(...) ans$bottom$labels$labels <- parse(text = ans$bottom$labels$labels) ans } , xlab=(expression(paste("X (V/",m^2,")"))) , ylab="Y (arb. unit)") -- View this message in context: http://www.nabble.com/It-works-but-I-don%27t-know-how-%28nice-scientific-notation-with-Lattice%29-tf4488112.html#a12798983 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] SUPER PARAMAGNETIC CLUSTERING
Dear all, we would like to know if there exist some routines (software) to build models based on the super paramagnetic clustering. Best regards, Silvia Figini -- Silvia Figini Department of Statistics "L. Lenti" University of Pavia Via Strada Nuova, 65 - 27100 - Pavia, Italy tel.+39- 0382-984660 http://musing.unipv.it/datamining __ 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] warnings although R CMD check runs without any problem
Uwe Ligges wrote: > Can you give examples? > > Uwe > > > Christian Kohler wrote: > >> Dear list members, >> >> as I am new to R, I would kindly like to ask for your help. >> >> I checked a package with the 'R CMD check' command and all worked out >> well, (only 'OK' status). Loading its vignette afterwards with >> 'source("package.Rcheck/inst/doc/vignette.R")' yields a message saying >> that several (well, in my case more than 50) warnings still exist and >> can be viewed via the 'warnings()' command. >> >> My question now is: why are there still warnings even though the check >> has been passed without any problems? Generally speaking, would it be >> possible to submit this package e.g. to the Bioconductor project, even >> if these warnings still exist? >> >> >> Thanks in advance, >> Christian >> >> >> >> > > __ > 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. > Hello Uwe, as the package is to submit to Bioconductor, I should have posted to the BioC-Help instead but initially it was rather a 'R'-specific question to me. My apology for that. Examples for warning messages are >warnings() >1:The exprSet class is deprecated, use ExpressionSet instead ... >6: The phenoData class is deprecated, use AnnotatedDataFrame (with ExpressionSet) instead >13: In s[v == x[1]] <- r : Number of elements to be replaced is not a multiple of the substitution length. In my opinion, these messages solely indicate some 'hints' which do not interfere with any functionality within the package. Right? As there is no reference to a file, which triggers these messages, I have currently no idea where to take a closer look at. Regards, Christian -- Christian Kohler Institute of Functional Genomics Computational Diagnostics University of Regensburg D-93147 Regensburg (Germany) __ 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] warnings although R CMD check runs without any problem
Hi, Christian Kohler wrote: > Uwe Ligges wrote: >> Can you give examples? >> >> Uwe >> >> >> Christian Kohler wrote: >> >>> Dear list members, >>> >>> as I am new to R, I would kindly like to ask for your help. >>> >>> I checked a package with the 'R CMD check' command and all worked out >>> well, (only 'OK' status). Loading its vignette afterwards with >>> 'source("package.Rcheck/inst/doc/vignette.R")' yields a message saying >>> that several (well, in my case more than 50) warnings still exist and >>> can be viewed via the 'warnings()' command. >>> >>> My question now is: why are there still warnings even though the check >>> has been passed without any problems? Generally speaking, would it be >>> possible to submit this package e.g. to the Bioconductor project, even >>> if these warnings still exist? >>> >>> >>> Thanks in advance, >>> Christian >>> >>> >>> >>> >> __ >> 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. >> > Hello Uwe, > > as the package is to submit to Bioconductor, I should have posted to the > BioC-Help instead but initially it was rather a 'R'-specific question to me. > My apology for that. > > Examples for warning messages are > >> warnings() >> 1:The exprSet class is deprecated, use ExpressionSet instead > ... >> 6: The phenoData class is deprecated, use AnnotatedDataFrame (with > ExpressionSet) instead These tell you that you are using data structures that are no longer supported and should not be used. You need to fix them - the appropriate replacements are also indicated in the help message. >> 13: In s[v == x[1]] <- r : Number of elements to be replaced is not a > multiple of the substitution length. This is also serious. It suggests that you have an error in your code. Typically if one replaces the elements in one vector s[v == x[1]], with those in another vector, namely r, the two sets should be the same length. In most (but not all) cases where this happens there is a bug. > > > In my opinion, these messages solely indicate some 'hints' which do not > interfere with any functionality within the package. Right? No, wrong - the first two tell you that you are badly (at least one year) out of date in your use of data structures and the last one tells you that you probably have a serious problem with your code. > As there is no reference to a file, which triggers these messages, I > have currently no idea where to take a closer look at. Well, you did not give the whole output, and in it there really are names of files and locations. You can also use an editor to search for 1) any instance of the work exprSet or phenoData and replace those parts of the code with the new classes 2) search for s[v == x[1]], and then use some of R's debugging methods to determine whether there is a bug or not. best wishes Robert > > Regards, > Christian > -- Robert Gentleman, PhD Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 PO Box 19024 Seattle, Washington 98109-1024 206-667-7700 [EMAIL PROTECTED] __ 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] warnings although R CMD check runs without any problem
On Thu, 20 Sep 2007, Christian Kohler wrote: > Dear list members, > > as I am new to R, I would kindly like to ask for your help. > > I checked a package with the 'R CMD check' command and all worked out > well, (only 'OK' status). Loading its vignette afterwards with > 'source("package.Rcheck/inst/doc/vignette.R")' yields a message saying > that several (well, in my case more than 50) warnings still exist and > can be viewed via the 'warnings()' command. > > My question now is: why are there still warnings even though the check > has been passed without any problems? Generally speaking, would it be Because the check process does not consider R-level warnings in examples or vignettes, only errors. Only someone who understands the code will know if the warnings are pedagogical, innocuous or serious. No one says that examples should not give warnings, and it may be helpful to illustrate when they might occur. > possible to submit this package e.g. to the Bioconductor project, even > if these warnings still exist? It is possible to submit it, and very likely that it would be acceptable. Distributing a package with warnings you do not understand is not a good idea, though. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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] Plotmath issue superscript "-"
Dear List, I'm trying to typeset some chemical ions in axis labels. These have both super and subscript components, and for some, I need a superscript "-". In LaTeX I might use $NO_3^-$ to do the typesetting, but I'm having a problem getting the correct invocation for expression: > expression(NO^{-}[3]) Error: syntax error, unexpected '}' in "expression(NO^{-}" > expression(NO^-[3]) Error: syntax error, unexpected '[' in "expression(NO^-[" > expression(NO^-) Error: syntax error, unexpected ')' in "expression(NO^-)" > expression(NO^{-}) Error: syntax error, unexpected '}' in "expression(NO^{-}" This is with R 2.5.1 (exact version info below). I suspect this is something to do with my use of the "-", which has some special meaning. Is there a way to achieve a superscript "-" (or similar looking character) using the plotmath routines in R? Thanks in advance, G > version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status Patched major 2 minor 5.1 year 2007 month 07 day05 svn rev42131 language R version.string R version 2.5.1 Patched (2007-07-05 r42131) -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.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.
Re: [R] warnings although R CMD check runs without any problem
Prof Brian Ripley wrote: > On Thu, 20 Sep 2007, Christian Kohler wrote: > > >> Dear list members, >> >> as I am new to R, I would kindly like to ask for your help. >> >> I checked a package with the 'R CMD check' command and all worked out >> well, (only 'OK' status). Loading its vignette afterwards with >> 'source("package.Rcheck/inst/doc/vignette.R")' yields a message saying >> that several (well, in my case more than 50) warnings still exist and >> can be viewed via the 'warnings()' command. >> >> My question now is: why are there still warnings even though the check >> has been passed without any problems? Generally speaking, would it be >> > > Because the check process does not consider R-level warnings in examples > or vignettes, only errors. Only someone who understands the code will > know if the warnings are pedagogical, innocuous or serious. No one says > that examples should not give warnings, and it may be helpful to > illustrate when they might occur. > > >> possible to submit this package e.g. to the Bioconductor project, even >> if these warnings still exist? >> > > It is possible to submit it, and very likely that it would be acceptable. > Distributing a package with warnings you do not understand is not a good > idea, though. > > Dear Prof Ripley & Mr Ligges, thanks for your help and the quick responses. Regards, Christian -- Christian Kohler Institute of Functional Genomics Computational Diagnostics University of Regensburg D-93147 Regensburg (Germany) __ 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] Plotmath issue superscript "-"
Try: plot(0,0,"n") text(0,0,expression( {NO[3]}^'-')) __ 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] Plotmath issue superscript "-"
Gavin Simpson wrote: > Dear List, > > I'm trying to typeset some chemical ions in axis labels. These have both > super and subscript components, and for some, I need a superscript "-". > In LaTeX I might use $NO_3^-$ to do the typesetting, but I'm having a > problem getting the correct invocation for expression: > > >> expression(NO^{-}[3]) >> > Error: syntax error, unexpected '}' in "expression(NO^{-}" > >> expression(NO^-[3]) >> > Error: syntax error, unexpected '[' in "expression(NO^-[" > >> expression(NO^-) >> > Error: syntax error, unexpected ')' in "expression(NO^-)" > >> expression(NO^{-}) >> > Error: syntax error, unexpected '}' in "expression(NO^{-}" > > This is with R 2.5.1 (exact version info below). > > I suspect this is something to do with my use of the "-", which has some > special meaning. > > Is there a way to achieve a superscript "-" (or similar looking > character) using the plotmath routines in R? > > It's an operator, it needs something to operate on. Try plot(0,main=quote(NO^-{})) > Thanks in advance, > > G > > >> version >> >_ > platform i686-pc-linux-gnu > arch i686 > os linux-gnu > system i686, linux-gnu > status Patched > major 2 > minor 5.1 > year 2007 > month 07 > day05 > svn rev42131 > language R > version.string R version 2.5.1 Patched (2007-07-05 r42131) > > -- 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 ~~ - ([EMAIL PROTECTED]) 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] Smooth line in graph
I don't know what SigmaPlot and Excel are doing for you, but I would guess that they are not doing cubic splines (as a general rule, when R and Excel differ, it is safest to assume that R is not the one doing something wrong) Often differences between packages are due to differences in assumptions or model specifications. I don't know SigmaPlot to be able to say what it is doing and a quick search of the excel help for 'spline' was not enlightening. Perhaps what you are looking for is not a cubic spline. Another option is an xspline. These are implemented in the grid package. Try: library(grid) library(lattice) x<-c(-45,67,131,259,347) y <- c(0.31, 0.45, 0.84, 0.43, 0.25) s <- seq(-1,1, .25) tmp.df <- data.frame(x=rep(x,9), y=rep(y,9), s=rep(s, each=5)) xyplot(y~x|factor(s), data=tmp.df, tmp.s=tmp.df$s, panel=function(x,y,subscripts,tmp.s,...){ grid.points(x,y) tmp2.s <- tmp.s[subscripts] print(tmp2.s) grid.xspline(x,y, default.units='native', shape=tmp2.s) }) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -Original Message- > From: Nestor Fernandez [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 20, 2007 4:02 AM > To: [EMAIL PROTECTED] > Cc: Greg Snow > Subject: Re: [R] Smooth line in graph > > Sorry, I answered too quickly. > It worked with the "simplified" example I provided but not > with non-regular intervals in x: > > x<-c(-45,67,131,259,347) > y <- c(0.31, 0.45, 0.84, 0.43, 0.25) > > plot(x,y) > lines(spline(x,y, method='n', n=250)) > #or: > lines(predict(interpSpline(x, y))) > > Produce the same decrease between first two points and the > shape is quite different to that produced by sigmaplot -I > need comparable figures. Changing "method" and "n" arguments > did not help. > > Sorry for bothering. Any other suggestion? > > > > > > > Greg Snow escribió: > > Try: > > > > > >> lines(spline(x,y, method='n', n=250)) > >> > > > > > > __ 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] Portfolio Optimization
Hello, I would like to solve a portfolio optimization problem in R. As far as I searched, I found the example of "solve.QP" &"portfolio.optim". In my understanding, both of them are based on given expected return, finding the minimum variance. Is there a way of doing this in an opposite way?i.e maximize the expected return subject to fixed variance? Or even better, like combining these two together? I would be grateful if anyone give me some advice or share the codes? -- View this message in context: http://www.nabble.com/Portfolio-Optimization-tf4488519.html#a12800372 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] SEM - singularity error
[EMAIL PROTECTED] wrote: > Good morning, > > I am trying to develop a structural equation model of snake abundance using > habitat variables. In attempting to estimate the model using the "sem" package > in R version 2.4.0, I receive the following error message: > > "Error in solve.default(C) : system is computationally singular: reciprocal > condition number = 1.75349e-16" > > MAIN PROBLEM: I am hoping to discover why I am receiving the aforementioned > error message and how to successfully estimate the model. > > OTHER INFORMATION: > 1. I believe the model is over-identified rather than under-identified (based > on > my understanding of the t-rule). I have observed data for 10 variables (9 > exogenous, 1 endogenous). > > 2. I am not certain that I have used the proper tool to estimate the > covariance > matrix. In this case, I used the "VAR" function. > > 3. I am most concerned that I have improperly coded the RAM file. For example, > in a case where I have three exogenous indicators of one exogenous latent > variable, I specify a start value of 1 for one of the exogenous indicators. I > am not sure if this is proper or necessary. > > 4. I am new to SEM; this is the first model I have ever tried to estimate. > > R CODE: Below is the r-code I have used to estimate the structural equation > model -- > > # LOADING R PACKAGES > library(sem) > > # READING IN THE CSV FILES > thsi.2006<-read.csv("thsi_ab_env_space_sem.csv") > thsi<-thsi.2006 > > # MAKING "RAM" FILE 2 > model2.nlc <-specify.model() > Moist->slope, NA, 1 > Moist->sand, lamda21, NA > Moist->clay, lamda31, NA > Hab->isol, NA, 1 > Hab->edgedist_a, lamda52, NA > Hab->ag10, lamda62, NA > Hab->urb10, lamda72, NA > Hab->rd10, lamda82, NA > Hab->y, lamda92, NA > Moist->this, gamma11, NA > Hab->this, gamma12, NA > slope<->slope, theta11, NA > sand<->sand, theta22, NA > clay<->clay, theta33, NA > isol<->isol, theta44, NA > edgedist_a<->edgedist_a, theta55, NA > ag10<->ag10, theta66, NA > urb10<->urb10, theta77, NA > rd10<->rd10, theta88, NA > y<->y, the99, NA > Moist<->Moist, phi11, NA > Hab<->Hab, phi22, NA > this<->this, theps11, NA > > model2.nlc > end > > # MAKING S (COVARIANCE MATRIX) > thsi.var <- var(thsi) > > # MAKING UNSCALED SEM MODEL > sem2<-sem(ram=model2.nlc, S=thsi.var, N=22) > > I am also attaching a jpeg diagram of the model I am trying to estimate. > Please > let me know if there is any additional information that I should add to this > posting. > > Thank you so much for your time. > Nicolette Cagle Your specification of the model seems OK and it is over-identified (21 free parameters and 34 df). I suspect the problem is that one or more of your 10 variables is a linear function of the remaining variables. If that is the case, then the following should give the same singularity error: factanal(thsi, factors=1) You may be able to drop one or more of the 10 variables from consideration and successfully estimate a conceptually similar model. hope this helps, Chuck Cleland > > > __ > 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. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help with making a function of scatter plot with multiple variables
Dear list, I have done a scatter plot of multiple variables in the same graph, with different col and pch. I managed to do it with the following code but not know how to make a function of these so that next time if I want to do similar graph but with new variables, I dont have to copy the code and then change the old variables with the new ones but just call a function with the new variables. I dont have any experience in making a function and would be very grateful if you can help me. A function will shorten my prog dramatically, since I repeat tthis type of graph alots in my analysis. Thanks in advance, Tom op <- par(bg = "grey97") par(mfrow=c(1,2)) plot(d1,v1, pch="v", col="orange",cex=0.6, lwd=2, xlab="day", ylab="resp",cex.main =1,font.main= 1,main=" Surv data",ylim=y,xlim=x, col.main="navyblue",col.lab="navyblue",cex.lab=0.7) points(s1,t1, pch="A", col="green4", cex=1) points(s2,t2, pch="B",col="navyblue", cex=1) points(s3,t3, pch="C",col="red", cex=1) points(s4,t4, pch="D",col="darkviolet", cex=1) points(s5,t5, pch="E",col="blue", cex=1) legend("topright",lbels,col=c("orange","green4","navyblue","red","darkviolet","blue"), text.col=c("orange","green4","navyblue","red","darkviolet","steelblue"), pch=c("v","A","B","C","D","E"),bg='gray100',cex=0.7,box.lty=1,box.lwd=1) abline(h = -1:9, v = 0:8, col = "lightgray", lty=3) par(op) - Jämför pris på flygbiljetter och hotellrum: http://shopping.yahoo.se/c-169901-resor-biljetter.html [[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] Plotmath issue superscript "-"
If you need a subscript as well, I like plot(0, main=quote({NO^'\x96'}[3])) Peter Ehlers Peter Dalgaard wrote: > Gavin Simpson wrote: >> Dear List, >> >> I'm trying to typeset some chemical ions in axis labels. These have both >> super and subscript components, and for some, I need a superscript "-". >> In LaTeX I might use $NO_3^-$ to do the typesetting, but I'm having a >> problem getting the correct invocation for expression: >> >> >>> expression(NO^{-}[3]) >>> >> Error: syntax error, unexpected '}' in "expression(NO^{-}" >> >>> expression(NO^-[3]) >>> >> Error: syntax error, unexpected '[' in "expression(NO^-[" >> >>> expression(NO^-) >>> >> Error: syntax error, unexpected ')' in "expression(NO^-)" >> >>> expression(NO^{-}) >>> >> Error: syntax error, unexpected '}' in "expression(NO^{-}" >> >> This is with R 2.5.1 (exact version info below). >> >> I suspect this is something to do with my use of the "-", which has some >> special meaning. >> >> Is there a way to achieve a superscript "-" (or similar looking >> character) using the plotmath routines in R? >> >> > It's an operator, it needs something to operate on. > > Try > > plot(0,main=quote(NO^-{})) > > > >> Thanks in advance, >> >> G >> >> >>> version >>> >>_ >> platform i686-pc-linux-gnu >> arch i686 >> os linux-gnu >> system i686, linux-gnu >> status Patched >> major 2 >> minor 5.1 >> year 2007 >> month 07 >> day05 >> svn rev42131 >> language R >> version.string R version 2.5.1 Patched (2007-07-05 r42131) >> >> > > __ 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] SEM - singularity error
Good afternoon Chuck, I really appreciate your help. I just ran the factor analysis and did not receive the singularity error (please see results below). Do you happen to have any additional ideas or suggestions? Thank you so much. Nicki FACTANAL RESULTS: Call: factanal(x = thsi, factors = 1) Uniquenesses: this edgedist_a isol ag10 urb10 rd10 slope 0.705 0.914 0.232 0.124 0.136 0.017 0.952 clay sand y 0.534 0.485 0.144 Loadings: Factor1 this0.543 edgedist_a 0.293 isol0.876 ag10 -0.936 urb10 0.930 rd100.992 slope -0.220 clay -0.682 sand0.718 y -0.925 Factor1 SS loadings 5.757 Proportion Var 0.576 Test of the hypothesis that 1 factor is sufficient. The chi square statistic is 120.94 on 35 degrees of freedom. The p-value is 2.17e-11 Quoting Chuck Cleland <[EMAIL PROTECTED]>: > [EMAIL PROTECTED] wrote: >> Good morning, >> >> I am trying to develop a structural equation model of snake abundance using >> habitat variables. In attempting to estimate the model using the >> "sem" package >> in R version 2.4.0, I receive the following error message: >> >> "Error in solve.default(C) : system is computationally singular: reciprocal >> condition number = 1.75349e-16" >> >> MAIN PROBLEM: I am hoping to discover why I am receiving the aforementioned >> error message and how to successfully estimate the model. >> >> OTHER INFORMATION: >> 1. I believe the model is over-identified rather than >> under-identified (based on >> my understanding of the t-rule). I have observed data for 10 variables (9 >> exogenous, 1 endogenous). >> >> 2. I am not certain that I have used the proper tool to estimate the >> covariance >> matrix. In this case, I used the "VAR" function. >> >> 3. I am most concerned that I have improperly coded the RAM file. >> For example, >> in a case where I have three exogenous indicators of one exogenous latent >> variable, I specify a start value of 1 for one of the exogenous >> indicators. I >> am not sure if this is proper or necessary. >> >> 4. I am new to SEM; this is the first model I have ever tried to estimate. >> >> R CODE: Below is the r-code I have used to estimate the structural equation >> model -- >> >> # LOADING R PACKAGES >> library(sem) >> >> # READING IN THE CSV FILES >> thsi.2006<-read.csv("thsi_ab_env_space_sem.csv") >> thsi<-thsi.2006 >> >> # MAKING "RAM" FILE 2 >> model2.nlc <-specify.model() >> Moist->slope, NA, 1 >> Moist->sand, lamda21, NA >> Moist->clay, lamda31, NA >> Hab->isol, NA, 1 >> Hab->edgedist_a, lamda52, NA >> Hab->ag10, lamda62, NA >> Hab->urb10, lamda72, NA >> Hab->rd10, lamda82, NA >> Hab->y, lamda92, NA >> Moist->this, gamma11, NA >> Hab->this, gamma12, NA >> slope<->slope, theta11, NA >> sand<->sand, theta22, NA >> clay<->clay, theta33, NA >> isol<->isol, theta44, NA >> edgedist_a<->edgedist_a, theta55, NA >> ag10<->ag10, theta66, NA >> urb10<->urb10, theta77, NA >> rd10<->rd10, theta88, NA >> y<->y, the99, NA >> Moist<->Moist, phi11, NA >> Hab<->Hab, phi22, NA >> this<->this, theps11, NA >> >> model2.nlc >> end >> >> # MAKING S (COVARIANCE MATRIX) >> thsi.var <- var(thsi) >> >> # MAKING UNSCALED SEM MODEL >> sem2<-sem(ram=model2.nlc, S=thsi.var, N=22) >> >> I am also attaching a jpeg diagram of the model I am trying to >> estimate. Please >> let me know if there is any additional information that I should add to this >> posting. >> >> Thank you so much for your time. >> Nicolette Cagle > > Your specification of the model seems OK and it is over-identified (21 > free parameters and 34 df). I suspect the problem is that one or more > of your 10 variables is a linear function of the remaining variables. > If that is the case, then the following should give the same singularity > error: > > factanal(thsi, factors=1) > > You may be able to drop one or more of the 10 variables from > consideration and successfully estimate a conceptually similar model. > > hope this helps, > > Chuck Cleland > >> >> >> __ >> 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. > > -- > Chuck Cleland, Ph.D. > NDRI, Inc. > 71 West 23rd Street, 8th floor > New York, NY 10010 > tel: (212) 845-4495 (Tu, Th) > tel: (732) 512-0171 (M, W, F) > fax: (917) 438-0894 > > -- Ecology Ph.D. Candidate Duke University Durham, NC 27708 www.duke.edu/~nlc4 __ 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-contai
[R] how can I attach a variable stored in
Hi - Any help would be greatly appreciated. I'm loading a list variable that's stored in an .RData file and would like attach it. I've used attach( ), but that only lets me see the variable that's stored in the file. As the variable name is of the form "comp.x.x", I've tried using attach( ls( pat="comp" ) ), but get an error as ls() just gives back a string. I've also played around with eval(), but don't really quite get what that function does since it seems to get into the R internals which I don't entirely understand and I haven't found any great unified documentation on R's handling environment and scoping. Thanks, Peter Waltman __ 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] Superimposing vector polygons over raster grid in a plot
Hello: I would like to superimpose vector polygons (state outlines) from a Shape file on top of a satellite image, imported into a SpatialGridDataFrame from GEOTIFF via gdal_translate and readGDAL. When I plot polygon and point shape files in R, into SpatialPointDataFrame and SpatialPolygonDataFrame, the two feature sets line up geographically, so it seems logical that a SpatialGridDataFrame should behave in the same way. From my initial research, the spplot function is the correct function for plotting grids/images with axes and annotation. The big question is, how do I incorporate a Spatial(Points or Polygons)DataFrame into the spplot display list? It seems as though many scientists would like to create such plots without resorting to GRASS or another GIS. Thanks for any advice, Rick Reeves Rick Reeves Scientific Programmer / Analyst National Center for Ecological Analysis and Synthesis UC Santa Barbara [EMAIL PROTECTED] www.nceas.ucsb.edu 805 892 2533 __ 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] Plotmath issue superscript "-"
Hallo, > If you need a subscript as well, I like > > plot(0, main=quote({NO^'\x96'}[3])) I tried this but I get: > plot(0, main=quote({NO^'\x96'}[3])) Errore in title(...) : stringa multibyte non valida ('invalid multibyte string') My R version is: platform i686-redhat-linux-gnu version.string R version 2.4.1 (2006-12-18) locale is: LANG=it_IT.UTF-8 What is this multibyte string? Does it depend on LOCALE settings? Where can I find further docs on this way to pass character descriptors? Thanks, ScionForbai __ 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] Cutting & pasting help examples into script window
Does this look like a bug? If so, is there a different way to report it? Thanks, Bob > -Original Message- > From: Dirk Eddelbuettel [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 20, 2007 10:17 AM > To: Muenchen, Robert A (Bob) > Subject: Re: [R] Cutting & pasting help examples into script window > > On Thu, Sep 20, 2007 at 10:01:03AM -0400, Muenchen, Robert A (Bob) > wrote: > > Stephan Grosse replied: > > > > > > > > What I do not understand is why you not just type > > example(yourcommand)? > > > > > > Stefan > > > > That's a good question. I want to play around with variations of the > > examples rather than run them exactly as they are. > > In Emacs' wonderful ESS mode, you just press 'l' and the line of > example code you're on gets sent to R. You can then 'pick it up' in > the R buffer and play with it. I do that all the time ... > > 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] Time series graphs
I'm fairly new to S-Plus and I need to get this done quickly. Suppose I have the following fake data below: There are two companies, call them Bob and Tom. Each have two variables, call them A and B, that have observations. Bob Tom A BAB Jan 84 9 8 Feb 7 5 4 7 Mar 6 8 4 4 Apr 3 7 6 2 May5 1 8 5 Jun 6 4 71 July 2 8 3 4 Aug 12 4 8 Sep4 3 19 Here is what I want to do: I want to make two different graphs, one for Bob and one for Tom. For each graph, plot both variables A and B. Connect the A values with a line, and connect the B values with a different type of line. So there should be two lines for each graph. For the A line, at each time point, the letter A should be on the line. And the same goes for the B line. Either R or S-Plus since they are essentially the same. I'm sure this is easy, but any help would be greatly appreciated. Thanks, Bill - Pinpoint customers who are looking for what you sell. [[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] SEM - singularity error
Dear Nicolette and Chuck, I apologize for not seeing Nicolette's original posting. The model does appear to be correctly specified (though I didn't see the path diagram) and over-identified. I assume that all of the variables with lower-case names are observed variables and that "Moist" and "Hab" are latent variables. (Simply comparing the number of free parameters to the number of unique covariances among observed variables provides a necessary but not sufficient condition for identification. This model is identified because there more than two unique indicators for each latent variable and because the structural submodel relating "this" to "Moist" and "Hab" is identified.) I suspect that the problem here is the restriction that "Moist" and "Hab" are uncorrelated, which follows from the lack of a double-headed arrow connecting these variables. You might try adding Moist <-> Hab to the model. I hope this helps, John On Thu, 20 Sep 2007 12:40:06 -0400 Chuck Cleland <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Good morning, > > > > I am trying to develop a structural equation model of snake > abundance using > > habitat variables. In attempting to estimate the model using the > "sem" package > > in R version 2.4.0, I receive the following error message: > > > > "Error in solve.default(C) : system is computationally singular: > reciprocal > > condition number = 1.75349e-16" > > > > MAIN PROBLEM: I am hoping to discover why I am receiving the > aforementioned > > error message and how to successfully estimate the model. > > > > OTHER INFORMATION: > > 1. I believe the model is over-identified rather than > under-identified (based on > > my understanding of the t-rule). I have observed data for 10 > variables (9 > > exogenous, 1 endogenous). > > > > 2. I am not certain that I have used the proper tool to estimate > the covariance > > matrix. In this case, I used the "VAR" function. > > > > 3. I am most concerned that I have improperly coded the RAM file. > For example, > > in a case where I have three exogenous indicators of one exogenous > latent > > variable, I specify a start value of 1 for one of the exogenous > indicators. I > > am not sure if this is proper or necessary. > > > > 4. I am new to SEM; this is the first model I have ever tried to > estimate. > > > > R CODE: Below is the r-code I have used to estimate the structural > equation > > model -- > > > > # LOADING R PACKAGES > > library(sem) > > > > # READING IN THE CSV FILES > > thsi.2006<-read.csv("thsi_ab_env_space_sem.csv") > > thsi<-thsi.2006 > > > > # MAKING "RAM" FILE 2 > > model2.nlc <-specify.model() > > Moist->slope, NA, 1 > > Moist->sand, lamda21, NA > > Moist->clay, lamda31, NA > > Hab->isol, NA, 1 > > Hab->edgedist_a, lamda52, NA > > Hab->ag10, lamda62, NA > > Hab->urb10, lamda72, NA > > Hab->rd10, lamda82, NA > > Hab->y, lamda92, NA > > Moist->this, gamma11, NA > > Hab->this, gamma12, NA > > slope<->slope, theta11, NA > > sand<->sand, theta22, NA > > clay<->clay, theta33, NA > > isol<->isol, theta44, NA > > edgedist_a<->edgedist_a, theta55, NA > > ag10<->ag10, theta66, NA > > urb10<->urb10, theta77, NA > > rd10<->rd10, theta88, NA > > y<->y, the99, NA > > Moist<->Moist, phi11, NA > > Hab<->Hab, phi22, NA > > this<->this, theps11, NA > > > > model2.nlc > > end > > > > # MAKING S (COVARIANCE MATRIX) > > thsi.var <- var(thsi) > > > > # MAKING UNSCALED SEM MODEL > > sem2<-sem(ram=model2.nlc, S=thsi.var, N=22) > > > > I am also attaching a jpeg diagram of the model I am trying to > estimate. Please > > let me know if there is any additional information that I should > add to this > > posting. > > > > Thank you so much for your time. > > Nicolette Cagle > > Your specification of the model seems OK and it is over-identified > (21 > free parameters and 34 df). I suspect the problem is that one or > more > of your 10 variables is a linear function of the remaining variables. > If that is the case, then the following should give the same > singularity > error: > > factanal(thsi, factors=1) > > You may be able to drop one or more of the 10 variables from > consideration and successfully estimate a conceptually similar model. > > hope this helps, > > Chuck Cleland > > > > > > > > __ > > 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. > > -- > Chuck Cleland, Ph.D. > NDRI, Inc. > 71 West 23rd Street, 8th floor > New York, NY 10010 > tel: (212) 845-4495 (Tu, Th) > tel: (732) 512-0171 (M, W, F) > fax: (917) 438-0894 > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-proje
[R] Non-metric multidimensional scaling
Hello everyone, I'm working with R 2.4.1 on a PC running with XP. Trying to run isoMDS as follows: Gquad.mat <- Gquads[4:10] # extracts only the metric data variables Gquad.dist <- dist(Gquad.mat) Gquad.mds <- isoMDS(Gquad.dist) plot(Gquad.mds$points, type = "n") text(Gquad.mds$points, labels = as.character(Gquads$Quadname), cex = .5) The data.frame includes 711 records, and the first 3 columns contain categorical variables which I exclude from the analysis. When I invoke the script above an error message is returned. Error in isoMDS(Gquad.dist) : zero or negative distance between objects 179 and 180. How can I handle this, is it valid to add 0.5 to every element in the distance matrix or is someother alternative more appropriate? Thanks in advance Steve Steve Friedman, PhD Everglades Division Senior Environmental Scientist, Landscape Ecology South Florida Water Management District 3301 Gun Club Road West Palm Beach, Florida 33406 email: [EMAIL PROTECTED] Office: 561 - 682 - 6312 Fax: 561 - 682 - 5980 If you are not doing what you truly enjoy its your obligation to yourself to change. [[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] Strange behaviour of lars method
Thanks for your answer! On 20.09.2007, at 12:48, Tim Hesterberg wrote: > Might you be having numerical problems? That might very well be what's happening. Did hope that it only happens late in the procedure so I can ignore it, but those Cp values indicate I maybe can't. > If you're using the "lars" > library, it uses cross-product matrices, which are notoriously > numerically unstable in regression calculations when there is > high multiple correlation among the x's. ...as is the case in my data. Good to know... > We have a prototype package that offers more stable calculations, > using QR decompositions. > See http://www.insightful.com/Hesterberg/glars > Let me know if you'd like to try this. Yes, please! Just also had a peak at the ProcASA paper that's linked there... I did not know about elastic net before, maybe I will try that too for comparison... In fact (like always) I don't really know what method would be best. Did you try lars or glars on some more noisy/bad/difficult data sets? How good is its stability/generalization capability on these? You write the original LARS method is for linear regression. But it includes the lasso solutions. Lasso can have nonlinear solutions because of the penalty used. Or did I misunderstand something? Regards, Wiebke __ 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] Time series graphs
Using plot.zoo in the zoo package try this: Lines <- "Bob.A Bob.BTom.ATom.B Jan 84 9 8 Feb 7 5 4 7 Mar 6 8 4 4 Apr 3 7 6 2 May5 1 8 5 Jun 6 4 71 July 2 8 3 4 Aug 12 4 8 Sep4 3 19 " DF <- read.table(textConnection(Lines)) library(zoo) z <- zooreg(as.matrix(DF), start = as.yearmon(as.Date("2007-01-01")), freq = 12) z <- aggregate(z, as.Date, tail, 1) plot(z, plot.type = "single", type = "o", pch = c("A", "A", "B", "B"), lty = 1:2) legend("bottomleft", c("Bob", "Tom"), lty = 1:2) On 9/20/07, Bill Pepe <[EMAIL PROTECTED]> wrote: > I'm fairly new to S-Plus and I need to get this done quickly. Suppose I have > the following fake data below: > > There are two companies, call them Bob and Tom. Each have two variables, > call them A and B, that have observations. > > Bob Tom > >A BAB > Jan 84 9 8 > Feb 7 5 4 7 > Mar 6 8 4 4 > Apr 3 7 6 2 > May5 1 8 5 > Jun 6 4 71 > July 2 8 3 4 > Aug 12 4 8 > Sep4 3 19 > > Here is what I want to do: I want to make two different graphs, one for Bob > and one for Tom. For each graph, plot both variables A and B. Connect the A > values with a line, and connect the B values with a different type of line. > So there should be two lines for each graph. For the A line, at each time > point, the letter A should be on the line. And the same goes for the B line. > Either R or S-Plus since they are essentially the same. > > I'm sure this is easy, but any help would be greatly appreciated. > > Thanks, > > Bill > > > - > Pinpoint customers who are looking for what you sell. >[[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.
[R] Conditional Logit and Mixed Logit
Hello, Could anybody provide me with codes (procedure) how to obtain Conditional Logit (McFadden) and Mixed Logit (say, assuming normal distribution) estimates in R? Thanks, David U. -- View this message in context: http://www.nabble.com/Conditional-Logit-and-Mixed-Logit-tf4489238.html#a12802959 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] Ambiguities in vector
Birgit Lemcke wrote: > > > Perhaps you haven´t understood my question in the mail yesterday. So > I will try to describe my problem in a different way > > You see the tables. I would like to test the variables between the > tables. > I'm afraid that even before we start to deal with the ambiguities your question is not clear. What do you want to know, and before you sat down at the computer what statistical test did you intend to use? (For better or worse, most of the documentation of R _assumes_ you know what you want to test and how you want to do it.) I'm supposing you want to do some kind of comparison across communities (tables 1 and 2), but I don't know what kind. Comparing a single cell of the table to another just asks if the leaf form is the same in the two communities. Do you just want to ask if leaf forms of a given species are significantly different in different communities? I'm not sure what the null hypothesis would be here. What are the rows and columns? Can we use them to develop a hypothesis? If you can say precisely what your question is and how you would test it in the _absence_ of ambiguity (i.e., specify a statistical test -- you don't need to know how to run it in R, that's what the list is actually for), then we can help you decide how to handle the multiple coding problem. good luck Ben Bolker -- View this message in context: http://www.nabble.com/Ambiguities-in-vector-tf4485921.html#a12802997 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] convert data from
Hi, I am trying to convert a data frame from: X1X2 A12 B34 C56 to: A01 1 A02 2 B013 B024 C015 C026. How can I do it in R? I appreciate your help. Zheng - [[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] how can I attach a variable stored in
I don't think I understand your question but John Fox has written a very nice documentat about scoping and environments on his website. It's probably easy to find the site by googling "John Fox" but, if you can't find it, let me know. As I said, I don't think that I understand your question but, if you loaded a list variable using load("whatever.Rdata"), the variable will just be suitting in your workspace. You don't need to attach anything because load just loads the data right into the workspace. So typing the variable name should show the data. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Waltman Sent: Thursday, September 20, 2007 1:32 PM To: r-help@r-project.org Subject: [R] how can I attach a variable stored in Hi - Any help would be greatly appreciated. I'm loading a list variable that's stored in an .RData file and would like attach it. I've used attach( ), but that only lets me see the variable that's stored in the file. As the variable name is of the form "comp.x.x", I've tried using attach( ls( pat="comp" ) ), but get an error as ls() just gives back a string. I've also played around with eval(), but don't really quite get what that function does since it seems to get into the R internals which I don't entirely understand and I haven't found any great unified documentation on R's handling environment and scoping. Thanks, Peter Waltman __ 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. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ 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] Non-metric multidimensional scaling
>Error in isoMDS(Gquad.dist) : zero or negative distance between objects >179 and 180. >How can I handle this, is it valid to add 0.5 to every element in the >distance matrix or is someother alternative more appropriate? This means that your objects 179 and 180 are identical so just remove one of the two. They both have the same distance to all other objects so your results shouldn't change. Whatever conclusion you draw from the location of one on your plot, you can say the same for the other. Silvia. Thanks in advance Steve Steve Friedman, PhD Everglades Division Senior Environmental Scientist, Landscape Ecology South Florida Water Management District 3301 Gun Club Road West Palm Beach, Florida 33406 email: [EMAIL PROTECTED] Office: 561 - 682 - 6312 Fax: 561 - 682 - 5980 If you are not doing what you truly enjoy its your obligation to yourself to change. [[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/Non-metric-multidimensional-scaling-tf4489161.html#a12803598 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] random Forests
1) See the help pages for save() and load(). We do this all the time. 2) Prediction (or what you call scoring) given the matrix structure is quite simple. Take a look at the underlying C source code. You can write that in any language you want without much problem. Andy From: David Montgomery > > Hi, > > I am new to R and have a specific question about the > randomForest package and the saving of trees and scoring. > > 1) I am looking to save the trees and score at a later time. > Is there a way to load the saved trees and use the predict > function? Can objects be saved and loaded i.e. the > randomForest function call? I dont want to have to rerun > trees. Hopefully this applies to any stat type procedure > that requires scoring. > > 2) Has anybody written any code in any other language that > optimizes scoring using the format that the trees are saved > in? Ideally I would like to do real time scoring outside of > R and hoping that someone has code in python or c++developed > around the matrix format of the tree structure. > > Thanks, > > David > > > > > [[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 attachments,...{{dropped}} __ 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] SEM - singularity error
Dear John, Thank you so much for your assistance, it is greatly appreciated. You are correct in your interpretation of the variables (Moist and Hab are latent, the other, lower case variables are observed). I've attempted to run the model again adding Moist <-> Hab (please see code below) and still receive the same error message: "Error in solve.default(C) : system is computationally singular: reciprocal condition number = 6.59035e-17." Is it possible that something is wrong with the variance-covariance matrix (please see pasted below r code)? Are extremely small values (e.g., 4e-4) problematic? Do you have any additional suggestions as to how I might go about trouble shooting this problem? I am also attaching the jpeg model diagram, in case it could be of use to you. Thank you so much for your time. Best wishes, Nicki R CODE USED: # 20 Sep 2007 SEM of Thamnophis abundance # LOADING R PACKAGES library(sem) # READING IN THE CSV FILES thsi.2006<-read.csv("thsi_ab_env_space_sem.csv") thsi<-thsi.2006 # MAKING "RAM" FILE 3 model3.nlc <-specify.model() Moist->slope, NA, 1 Moist->sand, lamda21, NA Moist->clay, lamda31, NA Hab->isol, NA, 1 Hab->edgedist_a, lamda52, NA Hab->ag10, lamda62, NA Hab->urb10, lamda72, NA Hab->rd10, lamda82, NA Hab->y, lamda92, NA Moist->this, gamma11, NA Hab->this, gamma12, NA slope<->slope, theta11, NA sand<->sand, theta22, NA clay<->clay, theta33, NA isol<->isol, theta44, NA edgedist_a<->edgedist_a, theta55, NA ag10<->ag10, theta66, NA urb10<->urb10, theta77, NA rd10<->rd10, theta88, NA y<->y, the99, NA Moist<->Moist, phi11, NA Hab<->Hab, phi22, NA Moist<->Hab, phi21, NA this<->this, theps11, NA model3.nlc end # MAKING S (COVARIANCE MATRIX) thsi.var <- var(thsi) # MAKING UNSCALED SEM MODEL sem3<-sem(ram=model3.nlc, S=thsi.var, N=22) VARIANCE-COVARIANCE MATRIX (AKA: thsi.var): this this 8.88528139 edgedist_a 44.91469329 isol 2678.38321991 ag10 -0.38967619 urb10 0.11704827 rd10 0.02132100 slope-2.25074394 clay-36.19339827 sand 19.66753247 y-0.95970602 edgedist_a this 44.9146933 edgedist_a 17491.7873712 isol 96122.5594957 ag10 -9.1045614 urb10 1.9439758 rd10 0.5333281 slope 24.4351358 clay -1360.1102116 sand 619.1507519 y-15.4852253 isol this 2678.38322 edgedist_a 96122.55950 isol 4167108.48214 ag10 -347.26757 urb10 91.79339 rd1025.71996 slope -392.44092 clay-42236.76039 sand 19461.19308 y -868.20597 ag10 this -0.38967619 edgedist_a -9.10456137 isol -347.26756672 ag10 0.05167298 urb10-0.01314388 rd10 -0.00297957 slope 0.06923224 clay 3.17604271 sand -1.61043719 y 0.11896881 urb10 this0.117048268 edgedist_a 1.943975810 isol 91.793388529 ag10 -0.013143880 urb10 0.003733677 rd100.000784747 slope -0.039094302 clay -0.907067141 sand0.491619654 y -0.034343332 rd10 this0.0213209957 edgedist_a 0.5333280831 isol 25.7199633947 ag10 -0.0029795700 urb10 0.0007847471 rd100.0001987203 slope -0.0041496227 clay -0.2726142316 sand0.1286087229 y -0.0078502982 slope this -2.250744e+00 edgedist_a 2.443514e+01 isol -3.924409e+02 ag106.923224e-02 urb10 -3.909430e-02 rd10 -4.149623e-03 slope 2.520968e+00 clay3.343637e+00 sand -2.202094e+00 y 3.306712e-01 clay this -3.619340e+01 edgedist_a -1.360110e+03 isol -4.223676e+04 ag103.176043e+00 urb10 -9.070671e-01 rd10 -2.726142e-01 slope 3.343637e+00 clay7.962072e+02 sand -3.410372e+02 y 1.096320e+01 sand this 19.6675325 edgedist_a 619.1507519 isol 19461.1930766 ag10 -1.6104372 urb10 0.4916197 rd10 0.1286087 slope -2.2020936 clay-341.0372225 sand 165.1578113 y -5.4148540 y this -9.597060e-01 edgedist_a -1.548523e+01 isol -8.682060e+02 ag101.189688e-01 urb10 -3.434333e-02 rd10 -7.850298e-03 slope 3.306712e-01 clay1.096320e+01 sand -5.414854e+00 y 3.694397e-01 Quoting John Fox <[EMAIL PROTECTED]>: Dear Nicolette and Chuck, I apologize for not seeing Nicolette's original posting. The model does appear to be correctly specified (though I didn't see the path diagram) and over-identified. I assume that all of the variables with lower-case names are observed variables and that "Moist" and "Hab" are latent variables. (Simply comparing the number of free parameters to the number of unique covarianc
Re: [R] Ambiguities in vector
First thanks for your answer. Now I try to explain better: I have species in the rows and morphological attributes in the columns coded by numbers (qualitative variables; nominal and ordinal). In one table for the male plants of every species and in the other table for the female plants of every species. The variables contain every possible occurrence in this species and this gender. I would like to compare every variable between male and female plants for example using a ChiSquare Test. The Null-hypothesis could be: Variable male is equal to variable Female. The question behind all is, if male and female plants in this species are significantly different and which attributes are responsible for this difference. I really hope that this is better understandable. If not please ask. Thanks a million in advance. Greetings Birgit Am 20.09.2007 um 20:24 schrieb bbolker: > > > > Birgit Lemcke wrote: >> >> >> Perhaps you haven´t understood my question in the mail yesterday. So >> I will try to describe my problem in a different way >> >> You see the tables. I would like to test the variables between the >> tables. >> > > I'm afraid that even before we start to deal with the ambiguities > your question is not clear. What do you want to know, and before > you sat down at the computer what statistical test did you intend > to use? (For better or worse, most of the documentation of R > _assumes_ you know what you want to test and how you want to > do it.) I'm supposing you want to do some kind of comparison > across communities (tables 1 and 2), but I don't know what kind. > Comparing a single cell of the table to another just asks if > the leaf form is the same in the two communities. Do you just > want to ask if leaf forms of a given species are significantly > different > in different communities? I'm not sure what the null hypothesis > would be here. What are the rows and columns? Can we use > them to develop a hypothesis? > > If you can say precisely what your question is and how you would > test it in the _absence_ of ambiguity (i.e., specify a statistical > test -- > you don't need to know how to run it in R, that's what the list is > actually for), then we can help you decide how to handle the > multiple coding problem. > > good luck > Ben Bolker > -- > View this message in context: http://www.nabble.com/Ambiguities-in- > vector-tf4485921.html#a12802997 > 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. Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] [[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] Time series graphs
In pure R (without other packages) is IMHO simpler to understand (at least if data are so simple: months 1 till 9 with no missing values...). All you need is: dummybob <- ' month A B Jan 8 4 Feb 7 5 Mar 6 8 Apr 3 7 May 5 1 Jun 6 4 Jul 2 8 Aug 1 2 Sep 4 3 ' bob <- read.table(textConnection(dummybob), head=TRUE, stringsAsFactors = FALSE) plot(0,0,"n",xlim=c(1,9),ylim=c(0,9),xlab="Month",ylab="Value",axes=FALSE) title(main="Bob") lines(1:9,bob$A,lty="solid",col="black") lines(1:9,bob$B,lty="dotted",col="green") axis(1,1:9,bob$month) axis(2) text(1:9,bob$A,"A",pos=3) text(1:9,bob$B,"B",pos=3) box() And then repeat with the other dataset. __ 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] Superimposing vector polygons over raster grid in a plot
On Thursday 20 September 2007, Rick Reeves wrote: > Hello: > > I would like to superimpose vector polygons (state outlines) from a > Shape file on top of a satellite image, > imported into a SpatialGridDataFrame from GEOTIFF via gdal_translate and > readGDAL. > > When I plot polygon and point shape files in R, into > SpatialPointDataFrame and SpatialPolygonDataFrame, > the two feature sets line up geographically, so it seems logical that a > SpatialGridDataFrame should behave > in the same way. > > From my initial research, the spplot function is the correct function > for plotting grids/images with axes and > annotation. > > The big question is, how do I incorporate a Spatial(Points or > Polygons)DataFrame into the spplot display list? > > It seems as though many scientists would like to create such plots > without resorting to GRASS or > another GIS. While GRASS and GMT are excellent tools, here are some ideas on how to make composite maps in R: http://casoilresource.lawr.ucdavis.edu/drupal/node/442 cheers, Dylan > Thanks for any advice, > Rick Reeves > > Rick Reeves > Scientific Programmer / Analyst > National Center for Ecological Analysis and Synthesis > UC Santa Barbara > [EMAIL PROTECTED] > www.nceas.ucsb.edu > 805 892 2533 -- Dylan Beaudette Soils and Biogeochemistry Graduate Group University of California at Davis 530.754.7341 __ 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] Plotmath issue superscript "-"
Yes, sorry, I should have said that I was on Windows. In a UTF-8 locale, you could try \u2013 in place of \x96. The character is an endash. Peter Ehlers Scionforbai wrote: > Hallo, > >> If you need a subscript as well, I like >> >> plot(0, main=quote({NO^'\x96'}[3])) > > > I tried this but I get: > >> plot(0, main=quote({NO^'\x96'}[3])) > Errore in title(...) : stringa multibyte non valida ('invalid multibyte > string') > > My R version is: > platform i686-redhat-linux-gnu > version.string R version 2.4.1 (2006-12-18) > > locale is: LANG=it_IT.UTF-8 > > What is this multibyte string? Does it depend on LOCALE settings? > Where can I find further docs on this way to pass character > descriptors? > Thanks, > ScionForbai > > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how can I attach a variable stored in
Hi Mark - Thanks for the reply. Sorry I didn't really clarify too well what I'm trying to do. The issue is not that I can't see the variable that gets loaded. The issue is that the variable is a list variable, and I'd like to write a function that will take the .RData filename and attach the variable it contains so that I can more easily access its contents, i.e. foo.bar <- list( "a"= "a", "b"=1 ) save( file="foo.bar.RData", foo.bar ) rm( foo.bar ) my.fn <- function( fname ) { load( fname ) attach( ls( pat="foo" ) ) # I want to attach( foo.bar ), but this doesn't work } ls() # prints out "foo.bar" attach( ls( ) ) # still doesn't work attach( foo.bar ) # works So, basically, the question is how can I attach the variable that's stored in a file if I don't already know it's name? Thanks again! Peter Leeds, Mark (IED) wrote: > I don't think I understand your question but John Fox has written a very > nice documentat about scoping and environments on his website. > It's probably easy to find the site by googling "John Fox" but, if you > can't find it, let me know. > > As I said, I don't think that I understand your question but, if you > loaded a list variable using load("whatever.Rdata"), the variable will > just be suitting in your workspace. You don't need to attach anything > because load just loads the data right into the workspace. > So typing the variable name should show the data. > > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Peter Waltman > Sent: Thursday, September 20, 2007 1:32 PM > To: r-help@r-project.org > Subject: [R] how can I attach a variable stored in > > Hi - > > Any help would be greatly appreciated. > > I'm loading a list variable that's stored in an .RData file and would > like attach it. > > I've used attach( ), but that only lets me see the variable > that's stored in the file. > > As the variable name is of the form "comp.x.x", I've tried using attach( > ls( pat="comp" ) ), but get an error as ls() just gives back a string. > > I've also played around with eval(), but don't really quite get what > that function does since it seems to get into the R internals which I > don't entirely understand and I haven't found any great unified > documentation on R's handling environment and scoping. > > Thanks, > > Peter Waltman > > __ > 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. > > > This is not an offer (or solicitation of an offer) to buy/sell the > securities/instruments mentioned or an official confirmation. Morgan Stanley > may deal as principal in or own or act as market maker for > securities/instruments mentioned or may advise the issuers. This is not > research and is not from MS Research but it may refer to a research > analyst/research report. Unless indicated, these views are the author's and > may differ from those of Morgan Stanley research or others in the Firm. We > do not represent this is accurate or complete and we may not update this. > Past performance is not indicative of future returns. For additional > information, research reports and important disclosures, contact me or see > https://secure.ms.com/servlet/cls. You should not use e-mail to request, > authorize or effect the purchase or sale of any security or instrument, to > send transfer instructions, or to effect any other transactions. We cannot > guarantee that any such requests received vi! a e-mail will be processed in a timely manner. This communication is solely for the addressee(s) and may contain confidential information. We do not waive confidentiality by mistransmission. Contact me if you do not wish to receive these communications. In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules). > > __ 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] Conditional Logit and Mixed Logit
On Thu, 20 Sep 2007, David U. wrote: > > Hello, > > Could anybody provide me with codes (procedure) how to obtain Conditional > Logit (McFadden) and Mixed Logit (say, assuming normal distribution) > estimates in R? RSiteSearch("conditional logit") as the posting guide tells you! > > Thanks, > David U. > -- > View this message in context: > http://www.nabble.com/Conditional-Logit-and-Mixed-Logit-tf4489238.html#a12802959 > 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. > Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ 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] error in manova
I work with Windows, R 2.4.1. I'm a beginner with R! After doing a Discriminant Function Analysis, I am trying to run manova to get a measure of significance of my lda results. I want to predict groups 1 through 4 using 78 variables (bad group/var ratio, I know, but I'm just exploring the possibilities right now). I've tried with a test matrix and I get my results fine, so I think it might have something to do with the matrix I'm using (hence, the sample of my matrix I show below). My matrix, called disperser.mx in my code, looks like: disperser P5.38 P6.45 P6.55 P6.63 P7.12 P7.42 P8.10 P8.30 P8.88 P9.09 P9.30 3 0.001.340.000.000.000.000.000.000.00 0.000.00 2 0.000.00131.56 0.000.000.000.000.000.00 0.000.00 2 0.005.050.000.000.000.000.000.000.00 0.000.00 3 0.0072.65 103.26 1.090.000.000.000.000.00 0.000.00 2 0.000.000.000.000.000.000.000.000.00 0.000.00 2 0.880.480.890.000.000.160.000.000.00 0.000.00 2 0.000.000.000.000.000.750.000.000.00 0.000.00 4 0.000.000.000.000.000.000.000.000.00 0.000.00 2 0.000.000.000.000.005.4120.62 0.008.13 8.878.27 4 0.000.000.000.000.000.000.000.000.00 0.000.00 2 0.000.000.000.000.000.000.000.000.00 0.000.00 2 0.000.000.000.000.000.000.000.000.00 0.000.00 2 0.00133.24 0.000.730.000.001.342.130.00 0.000.00 1 0.0011.08 3.160.760.000.000.000.000.00 0.000.00 4 0.000.000.000.000.000.000.000.000.00 0.000.00 4 0.820.000.000.004.790.000.0033.69 0.00 0.0011.44 2 0.000.000.000.000.000.000.000.000.00 0.000.00 4 0.000.000.000.000.000.000.000.000.00 0.000.00 2 0.001.810.000.000.000.000.000.000.00 0.000.00 1 0.000.000.000.000.006.890.000.000.00 0.000.00 2 7.268.161.500.001.971.280.004.080.00 0.001.16 4 0.000.000.000.000.003.130.000.000.00 0.000.00 4 0.000.000.000.000.000.830.000.000.00 0.000.00 1 0.000.000.000.000.000.000.000.000.00 0.000.00 2 0.001.480.220.000.000.001.800.000.66 0.470.47 1 0.000.000.000.000.000.000.000.000.00 0.000.00 1 0.000.000.000.004.780.000.000.000.00 0.000.00 ...with a lot more variables. The code I am writing to get a manova is: ##first, the code for the discriminant function, just in case it has something to do with the error I get later## disperser.mx$disperser<- as.factor (disperser.mx$disperser) disperser.df <- lda(disperser~., data=disperser.mx) predict(disperser.df) attach(disperser.mx) table(disperser, predict(disperser.df)$class) ## so far so good. I get my discriminant analysis fine volatileVar <- disperser.mx[c(2:79)] ## these are all the variables that I want to use summary (manova(as.matrix(volatileVar)~disperser.mx$disperser), test='Wilks') ## here is where I get an error that says "Error in summary.manova(manova(as.matrix(volatileVar) ~ disperser.mx$disperser), : residuals have rank 23 < 78" I would appreciate any help you can offer! Silvia. -- View this message in context: http://www.nabble.com/error-in-manova-tf4489610.html#a12804209 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] how can I attach a variable stored in
try: attach(get(ls(pat="^foo"))) On 9/20/07, Peter Waltman <[EMAIL PROTECTED]> wrote: > Hi Mark - > > Thanks for the reply. Sorry I didn't really clarify too well what I'm > trying to do. The issue is not that I can't see the variable that gets > loaded. > > The issue is that the variable is a list variable, and I'd like to write > a function that will take the .RData filename and attach the variable it > contains so that I can more easily access its contents, i.e. > >foo.bar <- list( "a"= "a", "b"=1 ) >save( file="foo.bar.RData", foo.bar ) >rm( foo.bar ) > >my.fn <- function( fname ) { > load( fname ) > attach( ls( pat="foo" ) ) # I want to attach( foo.bar ), but >this doesn't work >} > >ls() # prints out "foo.bar" > >attach( ls( ) ) # still doesn't work >attach( foo.bar ) # works > > So, basically, the question is how can I attach the variable that's > stored in a file if I don't already know it's name? > > Thanks again! > > Peter > > Leeds, Mark (IED) wrote: > > I don't think I understand your question but John Fox has written a very > > nice documentat about scoping and environments on his website. > > It's probably easy to find the site by googling "John Fox" but, if you > > can't find it, let me know. > > > > As I said, I don't think that I understand your question but, if you > > loaded a list variable using load("whatever.Rdata"), the variable will > > just be suitting in your workspace. You don't need to attach anything > > because load just loads the data right into the workspace. > > So typing the variable name should show the data. > > > > > > > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > On Behalf Of Peter Waltman > > Sent: Thursday, September 20, 2007 1:32 PM > > To: r-help@r-project.org > > Subject: [R] how can I attach a variable stored in > > > > Hi - > > > > Any help would be greatly appreciated. > > > > I'm loading a list variable that's stored in an .RData file and would > > like attach it. > > > > I've used attach( ), but that only lets me see the variable > > that's stored in the file. > > > > As the variable name is of the form "comp.x.x", I've tried using attach( > > ls( pat="comp" ) ), but get an error as ls() just gives back a string. > > > > I've also played around with eval(), but don't really quite get what > > that function does since it seems to get into the R internals which I > > don't entirely understand and I haven't found any great unified > > documentation on R's handling environment and scoping. > > > > Thanks, > > > > Peter Waltman > > > > __ > > 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. > > > > > > This is not an offer (or solicitation of an offer) to buy/sell the > > securities/instruments mentioned or an official confirmation. Morgan > > Stanley may deal as principal in or own or act as market maker for > > securities/instruments mentioned or may advise the issuers. This is not > > research and is not from MS Research but it may refer to a research > > analyst/research report. Unless indicated, these views are the author's > > and may differ from those of Morgan Stanley research or others in the Firm. > > We do not represent this is accurate or complete and we may not update > > this. Past performance is not indicative of future returns. For > > additional information, research reports and important disclosures, contact > > me or see https://secure.ms.com/servlet/cls. You should not use e-mail to > > request, authorize or effect the purchase or sale of any security or > > instrument, to send transfer instructions, or to effect any other > > transactions. We cannot guarantee that any such requests received ! vi! > a e-mail will be processed in a timely manner. This communication is solely > for the addressee(s) and may contain confidential information. We do not > waive confidentiality by mistransmission. Contact me if you do not wish to > receive these communications. In the UK, this communication is directed in > the UK to those persons who are market counterparties or intermediate > customers (as defined in the UK Financial Services Authority's rules). > > > > > > __ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/ma
Re: [R] convert data from
This should get you close to what you want: > x <- read.table(textConnection(" X1X2 + A12 + B34 + C56"), header=TRUE) > # add rownames to the dataframe > x$name <- row.names(x) > require(reshape) # use reshape package [1] TRUE > melt(x, id='name') name variable value 1A X1 1 2B X1 3 3C X1 5 4A X2 2 5B X2 4 6C X2 6 On 9/20/07, Pan Zheng <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to convert a data frame from: > >X1X2 > A12 > B34 > C56 > > to: > A01 1 > A02 2 > B013 > B024 > C015 > C026. > > How can I do it in R? > > I appreciate your help. > > Zheng > > > - > >[[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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ 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] Identify and plotting symbols. [SEC=UNCLASSIFIED]
On 20/09/2007, at 4:35 PM, Crombie, Joe wrote: > Or maybe: > >> while(length(ind <- identify(x,y,n = 1, plot = F))) >> points(x[ind], y[ind], pch = 19) > > (highlights each point as you select it, until you click _stop_) Bewdy!!! That's eggs-actly what I was looking for. Thanks very much. cheers, Rolf ## Attention:\ This e-mail message is privileged and confidenti...{{dropped}} __ 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] help with making a function of scatter plot with multiple variables
The simple way is to enclose it in a 'function' and pass parameters. Assuming that you have the same number of parameters, then the following will do: my.func <- function(x,y,d1,v1,s1,t1,s2,t2,s3,t3,s4,t4,s5,t5) { op <- par(bg = "grey97") par(mfrow=c(1,2)) plot(d1,v1, pch="v", col="orange",cex=0.6, lwd=2, xlab="day", ylab="resp",cex.main =1,font.main= 1,main=" Surv data",ylim=y,xlim=x, col.main="navyblue",col.lab="navyblue",cex.lab=0.7) points(s1,t1, pch="A", col="green4", cex=1) points(s2,t2, pch="B",col="navyblue", cex=1) points(s3,t3, pch="C",col="red", cex=1) points(s4,t4, pch="D",col="darkviolet", cex=1) points(s5,t5, pch="E",col="blue", cex=1) legend("topright",lbels,col=c("orange","green4","navyblue","red","darkviolet","blue"), text.col=c("orange","green4","navyblue","red","darkviolet","steelblue"), pch=c("v","A","B","C","D","E"),bg='gray100',cex=0.7,box.lty=1,box.lwd=1) abline(h = -1:9, v = 0:8, col = "lightgray", lty=3) par(op) } # call it with my.func(x,y,d1,v1,s1,t1,s2,t2,s3,t3,s4,t4,s5,t5) You might also include the data in a list to make it easier On 9/20/07, Tom Cohen <[EMAIL PROTECTED]> wrote: > Dear list, > > I have done a scatter plot of multiple variables in the same graph, with > different col and pch. I managed to do it with the following code but not > know how to make a function of these so that next time if I want to do > similar graph but with new variables, I dont have to copy the code and then > change the old variables with the new ones but just call a function with the > new variables. I dont have any experience in making a function and would be > very grateful if you can help me. A function will shorten my prog > dramatically, since I repeat tthis type of graph alots in my analysis. > > Thanks in advance, > Tom > > op <- par(bg = "grey97") > par(mfrow=c(1,2)) > plot(d1,v1, pch="v", col="orange",cex=0.6, lwd=2, >xlab="day", ylab="resp",cex.main =1,font.main= 1,main=" Surv > data",ylim=y,xlim=x, >col.main="navyblue",col.lab="navyblue",cex.lab=0.7) > >points(s1,t1, pch="A", col="green4", cex=1) >points(s2,t2, pch="B",col="navyblue", cex=1) >points(s3,t3, pch="C",col="red", cex=1) >points(s4,t4, pch="D",col="darkviolet", cex=1) >points(s5,t5, pch="E",col="blue", cex=1) > > legend("topright",lbels,col=c("orange","green4","navyblue","red","darkviolet","blue"), > text.col=c("orange","green4","navyblue","red","darkviolet","steelblue"), > pch=c("v","A","B","C","D","E"),bg='gray100',cex=0.7,box.lty=1,box.lwd=1) >abline(h = -1:9, v = 0:8, col = "lightgray", lty=3) > par(op) > > > > > - > > Jämför pris på flygbiljetter och hotellrum: > http://shopping.yahoo.se/c-169901-resor-biljetter.html >[[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. > > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how can I attach a variable stored in
Here's a function that does what I think you want to do: > attach.firstvar <- function(file) { + tmpenv <- new.env() + vars <- load(file, envir=tmpenv) + x <- get(vars[1], envir=tmpenv, inherits=FALSE) + if (is.list(x)) + attach(x, name=vars[1]) + return(vars) + } > x <- list(xa=1, xb=2, xc=3) > save(list="x", file="tmp1.rda") > remove(list="x") > attach.firstvar("tmp1.rda") [1] "x" > ls(pos=2) [1] "xa" "xb" "xc" > find("xa") [1] "x" > search() [1] ".GlobalEnv""x" "package:stats" [4] "package:graphics" "package:grDevices" "package:utils" [7] "package:datasets" "package:methods" "Autoloads" [10] "package:base" > xa [1] 1 > xb [1] 2 > Peter Waltman wrote: > Hi Mark - > > Thanks for the reply. Sorry I didn't really clarify too well what I'm > trying to do. The issue is not that I can't see the variable that gets > loaded. > > The issue is that the variable is a list variable, and I'd like to write > a function that will take the .RData filename and attach the variable it > contains so that I can more easily access its contents, i.e. > > foo.bar <- list( "a"= "a", "b"=1 ) > save( file="foo.bar.RData", foo.bar ) > rm( foo.bar ) > > my.fn <- function( fname ) { >load( fname ) >attach( ls( pat="foo" ) ) # I want to attach( foo.bar ), but > this doesn't work > } > > ls() # prints out "foo.bar" > > attach( ls( ) ) # still doesn't work > attach( foo.bar ) # works > > So, basically, the question is how can I attach the variable that's > stored in a file if I don't already know it's name? > > Thanks again! > > Peter > > Leeds, Mark (IED) wrote: >> I don't think I understand your question but John Fox has written a very >> nice documentat about scoping and environments on his website. >> It's probably easy to find the site by googling "John Fox" but, if you >> can't find it, let me know. >> >> As I said, I don't think that I understand your question but, if you >> loaded a list variable using load("whatever.Rdata"), the variable will >> just be suitting in your workspace. You don't need to attach anything >> because load just loads the data right into the workspace. >> So typing the variable name should show the data. >> >> >> >> >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >> On Behalf Of Peter Waltman >> Sent: Thursday, September 20, 2007 1:32 PM >> To: r-help@r-project.org >> Subject: [R] how can I attach a variable stored in >> >> Hi - >> >> Any help would be greatly appreciated. >> >> I'm loading a list variable that's stored in an .RData file and would >> like attach it. >> >> I've used attach( ), but that only lets me see the variable >> that's stored in the file. >> >> As the variable name is of the form "comp.x.x", I've tried using attach( >> ls( pat="comp" ) ), but get an error as ls() just gives back a string. >> >> I've also played around with eval(), but don't really quite get what >> that function does since it seems to get into the R internals which I >> don't entirely understand and I haven't found any great unified >> documentation on R's handling environment and scoping. >> >> Thanks, >> >> Peter Waltman >> >> __ >> 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. >> >> >> This is not an offer (or solicitation of an offer) to buy/sell the >> securities/instruments mentioned or an official confirmation. Morgan >> Stanley may deal as principal in or own or act as market maker for >> securities/instruments mentioned or may advise the issuers. This is not >> research and is not from MS Research but it may refer to a research >> analyst/research report. Unless indicated, these views are the author's and >> may differ from those of Morgan Stanley research or others in the Firm. We >> do not represent this is accurate or complete and we may not update this. >> Past performance is not indicative of future returns. For additional >> information, research reports and important disclosures, contact me or see >> https://secure.ms.com/servlet/cls. You should not use e-mail to request, >> authorize or effect the purchase or sale of any security or instrument, to >> send transfer instructions, or to effect any other transactions. We cannot >> guarantee that any such requests received v i! > a e-mail will be processed in a timely manner. This communication is solely > for the addressee(s) and may contain confidential information. We do not > waive confidentiality by mistransmission. Contact me if you do not wish to > receive these communications. In the UK, this communication is directed in > the UK to those persons
Re: [R] Robust or Sandwich estimates in lmer2
Abdus Sattar <[EMAIL PROTECTED]> asked: > > I am trying to find the robust (or sandwich) estimates of the standard > error of fixed effects parameter estimates using the package "lmer2". > Others have already pointed out that this is not implemented in lmer2. You could try a delete-n jackknife, which you would have to implement yourself. An ordinary delete-1 jackknife does not work for clustered/correlated data. This would also give you bias-corrected point estimates. I should add that, in the limited simulations I have done (for Gaussian mixed model analysis of pedigree data), the jackknife standard errors seemed a bit conservative (too big). David Duffy. -- | David Duffy (MBBS PhD) ,-_|\ | email: [EMAIL PROTECTED] ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v __ 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] Superimposing vector polygons over raster grid in a plot
On Thursday 20 September 2007, Rick Reeves wrote: > Thanks for this, Dylan. Great example. One question: 'elev.pred' and > 'elev.var' are columns in the result 'p' from predict? > thanks, RR Hi, elev.pred and elev.var are the 'zcol' attribute, or rather the value at each cell within the spatial dataframe object 'p' in that example. here is the construct for spplot() ... note that i left off the 'zcol=' bit on the first call to spplot... i will fix that. spplot(p, zcol='elev.var', ... cheers, Dylan > Dylan Beaudette wrote: > > On Thursday 20 September 2007, Rick Reeves wrote: > >> Hello: > >> > >> I would like to superimpose vector polygons (state outlines) from a > >> Shape file on top of a satellite image, > >> imported into a SpatialGridDataFrame from GEOTIFF via gdal_translate and > >> readGDAL. > >> > >> When I plot polygon and point shape files in R, into > >> SpatialPointDataFrame and SpatialPolygonDataFrame, > >> the two feature sets line up geographically, so it seems logical that a > >> SpatialGridDataFrame should behave > >> in the same way. > >> > >> From my initial research, the spplot function is the correct function > >> for plotting grids/images with axes and > >> annotation. > >> > >> The big question is, how do I incorporate a Spatial(Points or > >> Polygons)DataFrame into the spplot display list? > >> > >> It seems as though many scientists would like to create such plots > >> without resorting to GRASS or > >> another GIS. > > > > While GRASS and GMT are excellent tools, here are some ideas on how to > > make composite maps in R: > > > > http://casoilresource.lawr.ucdavis.edu/drupal/node/442 > > > > cheers, > > > > Dylan > > > >> Thanks for any advice, > >> Rick Reeves > >> > >> Rick Reeves > >> Scientific Programmer / Analyst > >> National Center for Ecological Analysis and Synthesis > >> UC Santa Barbara > >> [EMAIL PROTECTED] > >> www.nceas.ucsb.edu > >> 805 892 2533 -- Dylan Beaudette Soils and Biogeochemistry Graduate Group University of California at Davis 530.754.7341 __ 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] Time series graphs, question about using zoo
Hi, Can you tell me what is the meaning for "tail, 1" in "aggregate"? I also want to get some similar graph, but the data is not time series data. Suppose here is my data one, I want a graph with x-axis is just the index(1:9). The graph plot all the variable A, B,C,D. So there should be 4 lines for each graph. For the A line, at each time point, the letter A should be on the line. And the same goes for the B line. A BCD > 8 4 9 8 > 7 5 4 7 > 6 8 4 4 > 3 7 6 2 > 5 1 8 5 > 6 4 71 > 2 8 3 4 > 1 2 4 8 > 4 3 19 So I add a name for each row rownames(one) <- c(1:9) z <- zooreg(as.matrix(one), start = 1, freq = 1) z <- aggregate(z, as.Date, tail, 1) plot(z, plot.type = "single", type = "o", pch = c("A", "B", "C", "D"), lty = 1:2) I get the plot, which I think it should be right. but the problem is that the x-axis still have month (Jan, ) on it and I didnot get "A,B,C,D" on my graph, is there any thing wrong? >From: "Gabor Grothendieck" <[EMAIL PROTECTED]> >To: "Bill Pepe" <[EMAIL PROTECTED]> >CC: r-help@r-project.org >Subject: Re: [R] Time series graphs >Date: Thu, 20 Sep 2007 14:15:54 -0400 > >Using plot.zoo in the zoo package try this: > >Lines <- "Bob.A Bob.BTom.ATom.B > Jan 84 9 8 > Feb 7 5 4 7 > Mar 6 8 4 4 > Apr 3 7 6 2 > May5 1 8 5 > Jun 6 4 71 > July 2 8 3 4 > Aug 12 4 8 > Sep4 3 19 >" >DF <- read.table(textConnection(Lines)) > >library(zoo) >z <- zooreg(as.matrix(DF), start = as.yearmon(as.Date("2007-01-01")), freq >= 12) >z <- aggregate(z, as.Date, tail, 1) >plot(z, plot.type = "single", type = "o", > pch = c("A", "A", "B", "B"), lty = 1:2) >legend("bottomleft", c("Bob", "Tom"), lty = 1:2) > > > >On 9/20/07, Bill Pepe <[EMAIL PROTECTED]> wrote: > > I'm fairly new to S-Plus and I need to get this done quickly. Suppose I >have the following fake data below: > > > > There are two companies, call them Bob and Tom. Each have two >variables, call them A and B, that have observations. > > > > Bob Tom > > > >A BAB > > Jan 84 9 8 > > Feb 7 5 4 7 > > Mar 6 8 4 4 > > Apr 3 7 6 2 > > May5 1 8 5 > > Jun 6 4 71 > > July 2 8 3 4 > > Aug 12 4 8 > > Sep4 3 19 > > > > Here is what I want to do: I want to make two different graphs, one for >Bob and one for Tom. For each graph, plot both variables A and B. Connect >the A values with a line, and connect the B values with a different type of >line. So there should be two lines for each graph. For the A line, at each >time point, the letter A should be on the line. And the same goes for the B >line. Either R or S-Plus since they are essentially the same. > > > > I'm sure this is easy, but any help would be greatly appreciated. > > > > Thanks, > > > > Bill > > > > > > - > > Pinpoint customers who are looking for what you sell. > >[[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. _ [[replacing trailing spam]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guid
Re: [R] SEM - singularity error
Dear Nicki, > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 20, 2007 3:06 PM > To: John Fox > Cc: Chuck Cleland; [EMAIL PROTECTED] > Subject: Re: [R] SEM - singularity error > > Dear John, > > Thank you so much for your assistance, it is greatly > appreciated. You are correct in your interpretation of the > variables (Moist and Hab are latent, the other, lower case > variables are observed). I've attempted to run the model > again adding Moist <-> Hab (please see code below) and still > receive the same error message: > > "Error in solve.default(C) : system is computationally > singular: reciprocal condition number = 6.59035e-17." > > Is it possible that something is wrong with the > variance-covariance matrix (please see pasted below r code)? > Are extremely small values (e.g., 4e-4) problematic? Do you > have any additional suggestions as to how I might go about > trouble shooting this problem? You could set the argument debug=TRUE in the call to sem(), which will give you more detail about what's going on. But I suspect that the problem is the very large differences in size among the variances of your observed variances, differences of many orders of magnitude. You could try the following: (1) set the argument par.size="start.values"; and, if that doesn't work, (2) alternatively see what happens when you try to estimate the model from a correlation rather than a covariance matrix. > > I am also attaching the jpeg model diagram, in case it could > be of use to you. The diagram is identical to the one that I inferred from your model specification. I still think that you probably want to allow the two latent exogenous variables to be correlated. If neither of these approaches works, then please send me (privately) the input covariance matrix and model specification as files so that I can take a closer look. Regards, John > > Thank you so much for your time. > Best wishes, > Nicki > > R CODE USED: > # 20 Sep 2007 SEM of Thamnophis abundance > > # LOADING R PACKAGES > library(sem) > > # READING IN THE CSV FILES > thsi.2006<-read.csv("thsi_ab_env_space_sem.csv") > thsi<-thsi.2006 > > # MAKING "RAM" FILE 3 > model3.nlc <-specify.model() > Moist->slope, NA, 1 > Moist->sand, lamda21, NA > Moist->clay, lamda31, NA > Hab->isol, NA, 1 > Hab->edgedist_a, lamda52, NA > Hab->ag10, lamda62, NA > Hab->urb10, lamda72, NA > Hab->rd10, lamda82, NA > Hab->y, lamda92, NA > Moist->this, gamma11, NA > Hab->this, gamma12, NA > slope<->slope, theta11, NA > sand<->sand, theta22, NA > clay<->clay, theta33, NA > isol<->isol, theta44, NA > edgedist_a<->edgedist_a, theta55, NA > ag10<->ag10, theta66, NA > urb10<->urb10, theta77, NA > rd10<->rd10, theta88, NA > y<->y, the99, NA > Moist<->Moist, phi11, NA > Hab<->Hab, phi22, NA > Moist<->Hab, phi21, NA > this<->this, theps11, NA > > model3.nlc > end > > # MAKING S (COVARIANCE MATRIX) > thsi.var <- var(thsi) > > # MAKING UNSCALED SEM MODEL > sem3<-sem(ram=model3.nlc, S=thsi.var, N=22) > > VARIANCE-COVARIANCE MATRIX (AKA: thsi.var): >this > this 8.88528139 > edgedist_a 44.91469329 > isol 2678.38321991 > ag10 -0.38967619 > urb10 0.11704827 > rd10 0.02132100 > slope-2.25074394 > clay-36.19339827 > sand 19.66753247 > y-0.95970602 > edgedist_a > this 44.9146933 > edgedist_a 17491.7873712 > isol 96122.5594957 > ag10 -9.1045614 > urb10 1.9439758 > rd10 0.5333281 > slope 24.4351358 > clay -1360.1102116 > sand 619.1507519 > y-15.4852253 > isol > this 2678.38322 > edgedist_a 96122.55950 > isol 4167108.48214 > ag10 -347.26757 > urb10 91.79339 > rd1025.71996 > slope -392.44092 > clay-42236.76039 > sand 19461.19308 > y -868.20597 > ag10 > this -0.38967619 > edgedist_a -9.10456137 > isol -347.26756672 > ag10 0.05167298 > urb10-0.01314388 > rd10 -0.00297957 > slope 0.06923224 > clay 3.17604271 > sand -1.61043719 > y 0.11896881 > urb10 > this0.117048268 > edgedist_a 1.943975810 > isol 91.793388529 > ag10 -0.013143880 > urb10 0.003733677 > rd100.000784747 > slope -0.039094302 > clay -0.907067141 > sand0.491619654 > y -0.034343332 > rd10 > this0.0213209957 > edgedist_a 0.5333280831 > isol 25.7199633947 > ag10 -0.0029795700 > urb10 0.0007847471 > rd100.0001987203 > slope -0.0041496227 > clay -0.2726142316 > sand0.1286087229 > y -0.0078502982 >slope > this -2.250744e+00 > edgedist_a 2.443514e+01 > isol -3.924409e+02 > ag106.923224e-02 > urb10
Re: [R] Cutting & pasting help examples into script window
On 20/09/2007 1:49 PM, Muenchen, Robert A (Bob) wrote: > Does this look like a bug? If so, is there a different way to report it? It sounds like a bug, but I can't reproduce it. You said it is intermittent on your system. Can you try to work out the conditions that reliably trigger it? It might be something specific to your system; does anyone else see this? 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] Time series graphs, question about using zoo
Try this: Lines <- "A BCD 8 4 9 8 7 5 4 7 6 8 4 4 3 7 6 2 5 1 8 5 6 4 71 2 8 3 4 1 2 4 8 4 3 19 " one <- read.table(textConnection(Lines), header = TRUE) library(zoo) z <- zoo(as.matrix(one)) plot(z, plot.type = "single", pch = colnames(z), type = "o", col = 1:4, lty = 1:4) legend("bottomleft", colnames(z), col = 1:4, lty = 1:4) # or use matplot matplot(as.matrix(one), pch = colnames(z), type = "o") legend("bottomleft", colnames(z), col = 1:4, lty = 1:4) On 9/20/07, fang liu <[EMAIL PROTECTED]> wrote: > Hi, > Can you tell me what is the meaning for "tail, 1" in "aggregate"? > I also want to get some similar graph, but the data is not time series data. > Suppose here is my data one, I want a graph with x-axis is just the > index(1:9). > The graph plot all the variable A, B,C,D. So there should be 4 lines for > each graph. For the A line, at each time point, the letter A should be on > the line. And the same goes for the B line. >A BCD > > 8 4 9 8 > > 7 5 4 7 > > 6 8 4 4 > > 3 7 6 2 > > 5 1 8 5 > > 6 4 71 > > 2 8 3 4 > > 1 2 4 8 > > 4 3 19 > > So I add a name for each row > rownames(one) <- c(1:9) > z <- zooreg(as.matrix(one), start = 1, freq = 1) > z <- aggregate(z, as.Date, tail, 1) > plot(z, plot.type = "single", type = "o", >pch = c("A", "B", "C", "D"), lty = 1:2) > > I get the plot, which I think it should be right. but the problem is that > the x-axis still have month (Jan, ) on it and I didnot get "A,B,C,D" on my > graph, is there any thing wrong? > > > > >From: "Gabor Grothendieck" <[EMAIL PROTECTED]> > >To: "Bill Pepe" <[EMAIL PROTECTED]> > >CC: r-help@r-project.org > >Subject: Re: [R] Time series graphs > >Date: Thu, 20 Sep 2007 14:15:54 -0400 > > > >Using plot.zoo in the zoo package try this: > > > >Lines <- "Bob.A Bob.BTom.ATom.B > > Jan 84 9 8 > > Feb 7 5 4 7 > > Mar 6 8 4 4 > > Apr 3 7 6 2 > > May5 1 8 5 > > Jun 6 4 71 > > July 2 8 3 4 > > Aug 12 4 8 > > Sep4 3 19 > >" > >DF <- read.table(textConnection(Lines)) > > > >library(zoo) > >z <- zooreg(as.matrix(DF), start = as.yearmon(as.Date("2007-01-01")), freq > >= 12) > >z <- aggregate(z, as.Date, tail, 1) > >plot(z, plot.type = "single", type = "o", > > pch = c("A", "A", "B", "B"), lty = 1:2) > >legend("bottomleft", c("Bob", "Tom"), lty = 1:2) > > > > > > > >On 9/20/07, Bill Pepe <[EMAIL PROTECTED]> wrote: > > > I'm fairly new to S-Plus and I need to get this done quickly. Suppose I > >have the following fake data below: > > > > > > There are two companies, call them Bob and Tom. Each have two > >variables, call them A and B, that have observations. > > > > > > Bob Tom > > > > > >A BAB > > > Jan 84 9 8 > > > Feb 7 5 4 7 > > > Mar 6 8 4 4 > > > Apr 3 7 6 2 > > > May5 1 8 5 > > > Jun 6 4 71 > > > July 2 8 3 4 > > > Aug 12 4 8 > > > Sep4 3 19 > > > > > > Here is what I want to do: I want to make two different graphs, one for > >Bob and one for Tom. For each graph, plot both variables A and B. Connect > >the A values with a line, and connect the B values with a different type of > >line. So there should be two lines for each graph. For the A line, at each > >time point, the letter A should be on the line. And the same goes for the B > >line. Either R or S-Plus since they are essentially the same. > > > > > > I'm sure this is easy, but any help would be greatly appreciated. > > > > > >
Re: [R] Time series graphs, question about using zoo [SEC=UNCLASSIFIED]
Hi Fang, An easy way of doing this is by: > matplot(one, pch = LETTERS[1:4], type = 'b') Cheers Joe Joe Crombie Information and Risk Sciences Bureau of Rural Science Canberra Australia p: +61 2 6272 5906 e: [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of fang liu Sent: Friday, 21 September 2007 8:35 AM To: r-help@r-project.org Subject: Re: [R] Time series graphs, question about using zoo Hi, Can you tell me what is the meaning for "tail, 1" in "aggregate"? I also want to get some similar graph, but the data is not time series data. Suppose here is my data one, I want a graph with x-axis is just the index(1:9). The graph plot all the variable A, B,C,D. So there should be 4 lines for each graph. For the A line, at each time point, the letter A should be on the line. And the same goes for the B line. A BCD > 8 4 9 8 > 7 5 4 7 > 6 8 4 4 > 3 7 6 2 > 5 1 8 5 > 6 4 71 > 2 8 3 4 > 1 2 4 8 > 4 3 19 So I add a name for each row rownames(one) <- c(1:9) z <- zooreg(as.matrix(one), start = 1, freq = 1) z <- aggregate(z, as.Date, tail, 1) plot(z, plot.type = "single", type = "o", pch = c("A", "B", "C", "D"), lty = 1:2) I get the plot, which I think it should be right. but the problem is that the x-axis still have month (Jan, ) on it and I didnot get "A,B,C,D" on my graph, is there any thing wrong? >From: "Gabor Grothendieck" <[EMAIL PROTECTED]> >To: "Bill Pepe" <[EMAIL PROTECTED]> >CC: r-help@r-project.org >Subject: Re: [R] Time series graphs >Date: Thu, 20 Sep 2007 14:15:54 -0400 > >Using plot.zoo in the zoo package try this: > >Lines <- "Bob.A Bob.BTom.ATom.B > Jan 84 9 8 > Feb 7 5 4 7 > Mar 6 8 4 4 > Apr 3 7 6 2 > May5 1 8 5 > Jun 6 4 71 > July 2 8 3 4 > Aug 12 4 8 > Sep4 3 19 >" >DF <- read.table(textConnection(Lines)) > >library(zoo) >z <- zooreg(as.matrix(DF), start = as.yearmon(as.Date("2007-01-01")), >freq = 12) z <- aggregate(z, as.Date, tail, 1) plot(z, plot.type = >"single", type = "o", > pch = c("A", "A", "B", "B"), lty = 1:2) legend("bottomleft", c("Bob", >"Tom"), lty = 1:2) > > > >On 9/20/07, Bill Pepe <[EMAIL PROTECTED]> wrote: > > I'm fairly new to S-Plus and I need to get this done quickly. > > Suppose I >have the following fake data below: > > > > There are two companies, call them Bob and Tom. Each have two >variables, call them A and B, that have observations. > > > > Bob Tom > > > >A BAB > > Jan 84 9 8 > > Feb 7 5 4 7 > > Mar 6 8 4 4 > > Apr 3 7 6 2 > > May5 1 8 5 > > Jun 6 4 71 > > July 2 8 3 4 > > Aug 12 4 8 > > Sep4 3 19 > > > > Here is what I want to do: I want to make two different graphs, one > > for >Bob and one for Tom. For each graph, plot both variables A and B. >Connect the A values with a line, and connect the B values with a >different type of line. So there should be two lines for each graph. >For the A line, at each time point, the letter A should be on the line. >And the same goes for the B line. Either R or S-Plus since they are essentially the same. > > > > I'm sure this is easy, but any help would be greatly appreciated. > > > > Thanks, > > > > Bill > > > > > > - > > Pinpoint customers who are looking for what you sell. > >[[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-projec
[R] Help create a loopto conduct multiple pairwise operations
#Hello, #I have three data frames, X,Y and Z with two columns each and different numbers of rows. # creation of data frame X X.alleles <- c(1,5,6,7,8) X.Freq<- c(0.35, 0.15, 0.05 , 0.10, 0.35) Loc1 <- cbind( X.alleles,X.Freq) X <- data.frame(Loc1) #creation of data frame Y Y.alleles <- c(1,4,6,8) Y.Freq <- c(0.35, 0.35, 0.10, 0.20 ) Loc2<- cbind(Y.alleles, Y.Freq) Y <- data.frame (Loc2) # creation of data frame Z Z.alleles <- c(1,4,5,6,8) Z.Freq <- c(0.35, 0.35, 0.05, 0.05, 0.20) Loc3 <- cbind(Z.alleles, Z.Freq) Z<- data.frame (Loc3) X Y Z # I want to create a pair wise multiplication for all of the second columns of my dataframe X,Y and Z # Here is a way to get two of the data frames to create a pairwise multiplication. X.Freq_times_Y.Freq<- matrix(Y[,2] %o% X[,2], ncol=1) X.Freq_times_Y.Freq # I would like to create a loop to calculate all possible pairwise multiplications for the # second columns of my X,Y, and Z data frames. # I will be conducting pair wise comparisons for up to 50 different data frames so I need the code to be # as flexible as possible Any help would be greatly appreciated. Thanks in advance Luke Neraas [EMAIL PROTECTED] University of Alaska Fairbanks School of Fisheries and Ocean Sciences 11120 Glacier Highway UAF Fisheries Division Juneau, AK 99801 [[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] Help create a loopto conduct multiple pairwise operations
You can put the dataframes in a list and then use 'combn' to determine the possible pairwise combinations and then use this in an lapply to compute the products which is also in a list: > > X.alleles <- c(1,5,6,7,8) > X.Freq<- c(0.35, 0.15, 0.05 , 0.10, 0.35) > Loc1 <- cbind( X.alleles,X.Freq) > X <- data.frame(Loc1) > > #creation of data frame Y > > Y.alleles <- c(1,4,6,8) > Y.Freq <- c(0.35, 0.35, 0.10, 0.20 ) > Loc2<- cbind(Y.alleles, Y.Freq) > Y <- data.frame (Loc2) > > # creation of data frame Z > > Z.alleles <- c(1,4,5,6,8) > Z.Freq <- c(0.35, 0.35, 0.05, 0.05, 0.20) > Loc3 <- cbind(Z.alleles, Z.Freq) > Z<- data.frame (Loc3) > > X X.alleles X.Freq 1 1 0.35 2 5 0.15 3 6 0.05 4 7 0.10 5 8 0.35 > Y Y.alleles Y.Freq 1 1 0.35 2 4 0.35 3 6 0.10 4 8 0.20 > Z Z.alleles Z.Freq 1 1 0.35 2 4 0.35 3 5 0.05 4 6 0.05 5 8 0.20 > # create a list of the dataframes you want to multiply > dfList <- list(X, Y, Z) > # get possible pairwise matches > combo <- combn(length(dfList), 2) > result <- lapply(seq(ncol(combo)), function(.col){ + dfList[[combo[1, .col]]][, 2] %o% dfList[[combo[2, .col]]][, 2] + }) > > result [[1]] [,1] [,2] [,3] [,4] [1,] 0.1225 0.1225 0.035 0.07 [2,] 0.0525 0.0525 0.015 0.03 [3,] 0.0175 0.0175 0.005 0.01 [4,] 0.0350 0.0350 0.010 0.02 [5,] 0.1225 0.1225 0.035 0.07 [[2]] [,1] [,2] [,3] [,4] [,5] [1,] 0.1225 0.1225 0.0175 0.0175 0.07 [2,] 0.0525 0.0525 0.0075 0.0075 0.03 [3,] 0.0175 0.0175 0.0025 0.0025 0.01 [4,] 0.0350 0.0350 0.0050 0.0050 0.02 [5,] 0.1225 0.1225 0.0175 0.0175 0.07 [[3]] [,1] [,2] [,3] [,4] [,5] [1,] 0.1225 0.1225 0.0175 0.0175 0.07 [2,] 0.1225 0.1225 0.0175 0.0175 0.07 [3,] 0.0350 0.0350 0.0050 0.0050 0.02 [4,] 0.0700 0.0700 0.0100 0.0100 0.04 > dfList [[1]] X.alleles X.Freq 1 1 0.35 2 5 0.15 3 6 0.05 4 7 0.10 5 8 0.35 [[2]] Y.alleles Y.Freq 1 1 0.35 2 4 0.35 3 6 0.10 4 8 0.20 [[3]] Z.alleles Z.Freq 1 1 0.35 2 4 0.35 3 5 0.05 4 6 0.05 On 9/20/07, Luke Neraas <[EMAIL PROTECTED]> wrote: > #Hello, > > > #I have three data frames, X,Y and Z with two columns each and different > numbers of rows. > > # creation of data frame X > > X.alleles <- c(1,5,6,7,8) > X.Freq<- c(0.35, 0.15, 0.05 , 0.10, 0.35) > Loc1 <- cbind( X.alleles,X.Freq) > X <- data.frame(Loc1) > > #creation of data frame Y > > Y.alleles <- c(1,4,6,8) > Y.Freq <- c(0.35, 0.35, 0.10, 0.20 ) > Loc2<- cbind(Y.alleles, Y.Freq) > Y <- data.frame (Loc2) > > # creation of data frame Z > > Z.alleles <- c(1,4,5,6,8) > Z.Freq <- c(0.35, 0.35, 0.05, 0.05, 0.20) > Loc3 <- cbind(Z.alleles, Z.Freq) > Z<- data.frame (Loc3) > > X > Y > Z > > # I want to create a pair wise multiplication for all of the second columns > of my dataframe X,Y and Z > > # Here is a way to get two of the data frames to create a pairwise > multiplication. > > X.Freq_times_Y.Freq<- matrix(Y[,2] %o% X[,2], ncol=1) > X.Freq_times_Y.Freq > > # I would like to create a loop to calculate all possible pairwise > multiplications for the > # second columns of my X,Y, and Z data frames. > # I will be conducting pair wise comparisons for up to 50 different data > frames so I need the code to be > # as flexible as possible > > Any help would be greatly appreciated. > > Thanks in advance > > > Luke Neraas > [EMAIL PROTECTED] > > University of Alaska Fairbanks > School of Fisheries and Ocean Sciences > 11120 Glacier Highway > UAF Fisheries Division > Juneau, AK 99801 > >[[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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ 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] Cutting & pasting help examples into script window
Now I'm working in 2.5.1 on a home machine also running XP. It has the same problem, and I think I finally figured it out. I've noticed that if the cursor is directly over the text, it becomes an I-beam. When hovering over the blank space around the text, the cursor becomes an arrow. Selections via the arrow almost always paste properly into a script window. Copies made while selecting with the I-beam cursor almost always fail. Regardless of how the selection is done, a paste into Notepad never fails. Copying from Notepad to a script window never fails, regardless of how the paste into Notepad was selected. Very strange! Bob P.S. almost the testing has been with the ?data.frame and ?summary examples. > -Original Message- > From: Duncan Murdoch [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 20, 2007 7:59 PM > To: Muenchen, Robert A (Bob) > Cc: [EMAIL PROTECTED] > Subject: Re: [R] Cutting & pasting help examples into script window > > On 20/09/2007 1:49 PM, Muenchen, Robert A (Bob) wrote: > > Does this look like a bug? If so, is there a different way to report > it? > > It sounds like a bug, but I can't reproduce it. You said it is > intermittent on your system. Can you try to work out the conditions > that reliably trigger it? > > It might be something specific to your system; does anyone else see > this? > > 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.
[R] BRugs package question
Hi there, I installed the latest OpenBUGS version (3.0.3) in program files folder but it seems that bugs use its own version of OpenBUGS. here is part of the message bugs returns . Welcome to BRugs running on OpenBUGS version 2.2.0 beta how can i configure BRugs to use the mine version of OpenBUGS? Cheers, SK - [[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] Line Graph - Greater than 2 variables on plot
Hello all, I was wondering if anyone knew how to construct a multiple line graph on R, where there are 2 (or more) sets of data points plotted against some x axis of data, and you can draw a line on the graph connecting each set of data points. For example: A B C D 0.65662.11851.23205 0.647 2.08651.232510 0.65322.10601.228715 0.64872.12901.231320 0.65942.12851.234125 0.65772.10701.234330 0.65792.13451.234035 0.67342.17051.236240 0.675 2.18451.237245 0.65922.15501.234050 0.66472.17101.230555 Would there be a way: a) To graph all the points of data in sets A, B and C as Y coordinates on one graph, using the points in set D as the X-axis/coordinates for all 3 sets (A, B and C)? b) To be able to draw 3 lines on the graph that connect each set of data (1 line connects all the A points, one line connects all the B points, one line connects all the C points) I couldn't find anything in the examples or the help section about multiple lines on the same graph, only one line. Thanks, Wayne __ 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] Line Graph - Greater than 2 variables on plot
On 21/09/2007, at 1:57 PM, Wayne Aldo Gavioli wrote: > > > Hello all, > > I was wondering if anyone knew how to construct a multiple line > graph on R, > where there are 2 (or more) sets of data points plotted against > some x axis of > data, and you can draw a line on the graph connecting each set of > data points. > > For example: > > A B C D > 0.65662.11851.23205 > 0.647 2.08651.232510 > 0.65322.10601.228715 > 0.64872.12901.231320 > 0.65942.12851.234125 > 0.65772.10701.234330 > 0.65792.13451.234035 > 0.67342.17051.236240 > 0.675 2.18451.237245 > 0.65922.15501.234050 > 0.66472.17101.230555 > > > > Would there be a way: > a) To graph all the points of data in sets A, B and C as Y > coordinates on one > graph, using the points in set D as the X-axis/coordinates for all > 3 sets (A, B > and C)? > b) To be able to draw 3 lines on the graph that connect each set of > data (1 line > connects all the A points, one line connects all the B points, one > line connects > all the C points) > > > I couldn't find anything in the examples or the help section about > multiple > lines on the same graph, only one line. ?points ?lines ?matplot ## Attention:\ This e-mail message is privileged and confidenti...{{dropped}} __ 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] RJDBC connection help needed
Hi everyone, I'm obviously missing something simple here... Trying to connect to an external db with RJDBC. (I can connect OK with ROLAP and with other java apps, eg dbVisualizer) JDBC call seems to work ok: > driverClass <- "net.sourceforge.jtds.jdbc.Driver" > classPath <- "C:\\Dwns\\jtds\\jtds-1.2.jar" > identifier.quote <- '"' > drv <- JDBC(driverClass, classPath, identifier.quote) > summary(drv) JDBCDriver name = JDBC driver.version = 0.1-1 DBI.version = 0.1-1 client.version = NA max.connections = NA > but attempting to connect gives: > dbURL <- "jdbc:jtds:sqlserver://..com;DatabaseName=sunms" > con <- dbConnect(drv, dbURL, uid = "jporzak", pwd = "") Error in .local(drv, ...) : Unable to connect JDBC to jdbc:jtds:sqlserver://..com;DatabaseName=sunms > where "", "", "" are changed to protect the innocent. note that the dbURL string is exactly what I use in dbVisualizer with success (using WinXP SP2, R 2.5.1, RJDBC 0.1-3) -- TIA, Jim Porzak http://www.linkedin.com/in/jimporzak __ 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] Line Graph - Greater than 2 variables on plot
This should do it for you: > x <- read.table(textConnection("A B C D + 0.65662.11851.23205 + 0.647 2.08651.232510 + 0.65322.10601.228715 + 0.64872.12901.231320 + 0.65942.12851.234125 + 0.65772.10701.234330 + 0.65792.13451.234035 + 0.67342.17051.236240 + 0.675 2.18451.237245 + 0.65922.15501.234050 + 0.66472.17101.230555"), header=TRUE) > > matplot(x[, 4], x[, -4], type='o') > On 9/20/07, Wayne Aldo Gavioli <[EMAIL PROTECTED]> wrote: > > > Hello all, > > I was wondering if anyone knew how to construct a multiple line graph on R, > where there are 2 (or more) sets of data points plotted against some x axis of > data, and you can draw a line on the graph connecting each set of data points. > > For example: > > A B C D > 0.65662.11851.23205 > 0.647 2.08651.232510 > 0.65322.10601.228715 > 0.64872.12901.231320 > 0.65942.12851.234125 > 0.65772.10701.234330 > 0.65792.13451.234035 > 0.67342.17051.236240 > 0.675 2.18451.237245 > 0.65922.15501.234050 > 0.66472.17101.230555 > > > > Would there be a way: > a) To graph all the points of data in sets A, B and C as Y coordinates on one > graph, using the points in set D as the X-axis/coordinates for all 3 sets (A, > B > and C)? > b) To be able to draw 3 lines on the graph that connect each set of data (1 > line > connects all the A points, one line connects all the B points, one line > connects > all the C points) > > > I couldn't find anything in the examples or the help section about multiple > lines on the same graph, only one line. > > > Thanks, > > > > Wayne > > __ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ 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] Estimate correlation with bootstrap
Hello. I would like to estimate the correlation coefficient from two samples with Bootstrapping using the R-function sample(). The problem is, that I have to sample pairwise. For example if I have got two time series and I draw from the first series the value from 1912 I need the value from 1912 from the second sample, too. Example: Imagine that a and b are two time series with returns for example: a <- c(1,2,3,4,5,6,7,8,9,10) b <- c(1,1,56,3,6,6,6,7,2,10) a.sample <- numeric(10) b.sample <- numeric(10) boot.cor.a.b <- numeric(1000) for (i in 1:1000) { for (j in 1:10) { a.sample[j] <- sample(a,1,replace=TRUE) b.sample[j] <- sample(b,1,replace=TRUE) } boot.cor.a.b[i] <- cor(a,b) } The problem here is, that the sampling is independent from each other. So how do I have to change the R-code to get the pairwise sampling mentioned above? I hope you can help me. Sincerely Klein. __ 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.