Re: [R] Sparse KMeans/KDE/Nearest Neighbors?
Hello Manyu, I am guessing you refer to the netflix dataset. Try looking at ways to represent large data sets, that is, the list from here: http://cran.r-project.org/web/views/HighPerformanceComputing.html Here it is: *Large memory and out-of-memory data* - The biglm http://cran.r-project.org/web/packages/biglm/index.html package by Lumley uses incremental computations to offers lm() and glm() functionality to data sets stored outside of R's main memory. - The ff http://cran.r-project.org/web/packages/ff/index.html package by Adler et al. offers file-based access to data sets that are too large to be loaded into memory, along with a number of higher-level functions. - The bigmemoryhttp://cran.r-project.org/web/packages/bigmemory/index.html package by Kane and Emerson permits storing large objects such as matrices in memory and uses external pointer objects to refer to them. This permits transparent access from R without bumping against R's internal memory limits. Several R processes on the same computer can also shared big memory objects. - A large number of database packages, and database-alike packages (such as sqldf http://cran.r-project.org/web/packages/sqldf/index.html by Grothendieck and data.tablehttp://cran.r-project.org/web/packages/data.table/index.html by Dowle) are also of potential interest but not reviewed here. - The HadoopStreaminghttp://cran.r-project.org/web/packages/HadoopStreaming/index.html package provides a framework for writing map/reduce scripts for use in Hadoop Streaming; it also facilitates operating on data in a streaming fashion which does not require Hadoop. - The speedglmhttp://cran.r-project.org/web/packages/speedglm/index.html package permits to fit (generalised) linear models to large data. For in-memory data sets, speedlm() or speedglm() can be used along with update.speedlm() which can update fitted models with new data. For out-of-memory data sets, shglm() is available; it works in the presence of factors and can check for singular matrices. - The biglars http://cran.r-project.org/web/packages/biglars/index.html package by Seligman et al can use the ffhttp://cran.r-project.org/web/packages/ff/index.html to support large-than-memory datasets for least-angle regression, lasso and stepwise regression. Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Thu, Feb 25, 2010 at 12:00 AM, manyu_aditya abhimanyu.adi...@gmail.comwrote: hi, I have a dataset (the netflix dataset) which is basically ~18k columns and well variable number of rows but let's assume 25 thousand for now. The dataset is very sparse. I was wondering how to do kmeans/nearest neighbors or kernel density estimation on it. I tired using the spMatrix function in Matrix package. I think I'm able to create the matrix but as soon as I pass it to kmeans functions in package stats it says cannot allocate 3.3Gb. Which is basically 18k * 25K * 8. There is a sparse kmeans solver by tibshirani but that epxects a regular dense format matrix so again the issue is the same. A simple no this is not possible answer shall suffice as long as you are right!!! tHanks much. -- View this message in context: http://n4.nabble.com/Sparse-KMeans-KDE-Nearest-Neighbors-tp1568129p1568129.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] different types graphs
library(RODBC) ch- odbcConnect(durga) sqlQuery(ch, paste(SELECT * from emp)) sqlQuery(ch, (SELECT * from xyz)) store revenue year_y 1 bigbazar 7878752008 2 more 87876 2008 plot(revenue ~ year_y, data=xyz, pch=16) can i get any diffrent types of graphs like pie charts, bar plots.using plot commands? please give me suggestions. -- View this message in context: http://n4.nabble.com/different-types-graphs-tp1568673p1568673.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] What is assign attribute?
I am just curious. Every once and a while I see an attribute attached to an object called assign. What meaning does this have? For example: dist ~ speed, data=cars forms a matrix like: num [1:50, 1:2] 1 1 1 1 1 1 1 1 1 1 ... - attr(*, dimnames)=List of 2 ..$ : chr [1:50] 1 2 3 4 ... ..$ : chr [1:2] (Intercept) speed - attr(*, assign)= int [1:2] 0 1 The dimnames attribute is fairly self-explanatory. I just am not sure what the assign attribute means. Thank you. Kevin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] What is assign attribute?
I am just curious. Every once and a while I see an attribute attached to an object called assign. What meaning does this have? For example: dist ~ speed, data=cars forms a matrix like: num [1:50, 1:2] 1 1 1 1 1 1 1 1 1 1 ... - attr(*, dimnames)=List of 2 ..$ : chr [1:50] 1 2 3 4 ... ..$ : chr [1:2] (Intercept) speed - attr(*, assign)= int [1:2] 0 1 The dimnames attribute is fairly self-explanatory. I just am not sure what the assign attribute means. Thank you. Kevin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] different types graphs
Hi! Here are a few tips to start finding what you need (in R): apropos(pie) RSiteSearch(pie) Try also: ?pie ?barplot I guess there are hundreds of commands to do every type of graphics, but you can start there. The manual Using R for Data Analysis and Graphics from JH Maindonald is also quite good, among many others! HTH Ivan Le 2/25/2010 09:48, chinna a écrit : library(RODBC) ch- odbcConnect(durga) sqlQuery(ch, paste(SELECT * from emp)) sqlQuery(ch, (SELECT * from xyz)) store revenue year_y 1 bigbazar 7878752008 2 more 87876 2008 plot(revenue ~ year_y, data=xyz, pch=16) can i get any diffrent types of graphs like pie charts, bar plots.using plot commands? please give me suggestions. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] different types graphs
On Thu, 25 Feb 2010 00:48:04 -0800 (PST) chinna durgache...@gmail.com wrote: library(RODBC) ch- odbcConnect(durga) sqlQuery(ch, paste(SELECT * from emp)) sqlQuery(ch, (SELECT * from xyz)) store revenue year_y 1 bigbazar 7878752008 2 more 87876 2008 plot(revenue ~ year_y, data=xyz, pch=16) can i get any diffrent types of graphs like pie charts, bar plots.using plot commands? please give me suggestions. try demo(graphics) for a start detlef -- View this message in context: http://n4.nabble.com/different-types-graphs-tp1568673p1568673.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to fast extract values from different list elements
hi, I have a list L having more than 14000 Elements, each of these contains an array of about length 1200. L[[1]][26:30] # e.g. print 5 entries of first element of L [1] 0.000 6.7982652 114.4737184 89.7328239 3.2001664 Furthermore I get two arrays A and B of same length as input. A-c(4,7,9,34,463,788) B-c(50,67,87,361,45,89) I would like to extract (or print or save) certain values of L which I do in the following (inefficient) way at the moment: for (i in 1:length(A) { print( L[[A[i]]][B[i]] ) } this works fine but it is very slow (since A and B can be very large and I have to repeat this about 5000 times). I would like to make this faster using e.g. apply or lapply but I didn't get it work using these methods. Does anybody know an EFFICIENT or FAST way extract the values from L using the values from A and B? thanks for your answers. Peter [[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] locfit: max number of predictors?
Hi All, In another thread Andy Liaw, who CRAN lists as locfit maintainer; said: quote From: Liaw, Andy andy_l...@merck.com To: Guy Green guygr...@netvigator.com; r-help@r-project.org Subject: Re: Alternatives to linear regression with multiple variables Date: 22 February 2010 17:50 You can try the locfit package, which I believe can handle up to 5 variables. E.g., /quote Looking in the locfit documentation (e.g. http://www.stats.bris.ac.uk/R/web/packages/locfit/locfit.pdf) I can't see an upper limit on the number of predictors; if it is 5 I'm getting close in one of my applications. Can anyone confirm or deny the existence of a 'crisp' upper limit on the number of predictors in locfit? If it is 5, or thereabouts, can anyone suggest an alternative which can handle a few more? (I'm using it for multidimensional interpolation). Best regards, Keith Jewell __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 looping on sqlSave()
Hi! I've tried it, but the problem is that each element has a different size, with makes rbind() useless. Is there then a function/package that allows appending data in an Excel sheet? I've searched already for a few packages, but none (except, in theory, RODBC) can append. Any suggestion? Regards, Ivan Le 2/24/2010 19:38, Dieter Menne a écrit : Ivan Calandra wrote: ... for (i in 1:4){ sqlSave(xlsFile, as.data.frame(test[[i]]), tablename=test, rownames=F, addPK=T, append=T) } Error in odbcUpdate(channel, query, mydata, coldata[m, ], test = test, : missing columns in 'data' odbcCloseAll() I have never managed to write to Excel with ODBC with append=TRUE. If you do not want to Access instead where this works, best is to collect (rbind) the data in an R data frame, and write everything in one chunk. Dieter -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Institut und Museum Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calan...@uni-hamburg.de ** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 split.
I read in the documentation for split: ‘split’ divides the data in the vector ‘x’ into the groups defined by ‘f’. But I am still unclear as to its function. Take for example: x - 1:4 split(x, c(0,1)) $`0` [1] 1 3 $`1` [1] 2 4 I am not clear on how this result is reached. Thank you. Kevin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 looping on sqlSave()
Ivan Calandra wrote: I've tried it, but the problem is that each element has a different size, with makes rbind() useless. Assuming that size means different number of columns, then appending is not valid, because it would change the structure of the table, and with ODBC we are in the relational database world. In that case, you should assemble your data frame with all possible columns and leave the fields empty. If size means different number of rows, where append DOES make sense, rbind is useful. Dieter -- View this message in context: http://n4.nabble.com/problem-with-looping-on-sqlSave-tp1567601p1568715.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Updating a hexbinplot
Dear all, Considering this simple example of hexbinplot: mixdata - data.frame(x = c(rnorm(5000), rnorm(5000,4,1.5)), y = c(rnorm(5000), rnorm(5000,2,3)), a = gl(2, 5000)) fig - hexbinplot(y ~ x | a, mixdata) print(fig) update(fig, colramp = BTC) produces a bad (non-updated) legend. Compare it with: hexbinplot(y ~ x | a, mixdata, colramp = BTC) What should I do to update the plot with the correct legend? (I'm using R 2.10.1 under Windows XP). Thanks in advance, Marcin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] different types graphs
On 02/25/2010 07:48 PM, chinna wrote: library(RODBC) ch- odbcConnect(durga) sqlQuery(ch, paste(SELECT * from emp)) sqlQuery(ch, (SELECT * from xyz)) store revenue year_y 1 bigbazar 7878752008 2 more 87876 2008 plot(revenue ~ year_y, data=xyz, pch=16) can i get any diffrent types of graphs like pie charts, bar plots.using plot commands? Hi chinna, You can get all of these and more. What type of plot you want depends upon what you want to illustrate: # scatterplot - sprays all the values out with a # different color for each store plot(xyz$year_y,xyz$revenue,type=p, col=as.numeric(xyz$store)) # barplot - shows you the relative positions of # the stores in different years # this example was done with the toy data I posted last time barplot(as.matrix( reshape(xyz,idvar=Store,timevar=Year,dir=wide)[,2:4]) ,beside=TRUE) legend(8,60,levels(xyz$Store),fill=c(gray80,gray50,gray20)) # pie chart - shows the mean revenue for each store # over all the years sampled - again the previous toy data pie(by(xyz$Revenue,xyz$Store,mean)) You have to decide on what you want to illustrate unless you are just producing PlotArt, a new genre in which the artist produces random plots of financial data to emphasize the meaninglessness of the materialistic culture in which we pretend that we are happy, but No, I can't keep a straight face anymore. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with looping on sqlSave()
What if size means both columns and rows? Here is one of such lists: test - structure(list(m = structure(c(0.090909090909091, 0.181818181818182, 0.272727272727273, 0.363636363636364, 0.454545454545455, 0.545454545454545, 0.636363636363636, 0.727272727272727, 0.818181818181818, 0.909090909090909, 1, NA, NA, NA, NA, NA, NA, -14.571209, -13.829402, -22.1283685, -22.717841, -34.8053215, 12.988246, 10.2528335, 9.47791, 24.585605, NA, NA, NA, NA, NA, NA, NA), .Dim = c(11L, 3L), .Dimnames = list( NULL, c(qhat, lower, upper))), crit = 0.611274541966673, numsig = 0L, pc = NA), .Names = c(m, crit, numsig, pc)) I've managed to do what I want using write.csv() like: for (i in 1:4){ write.csv(test[[i]], file=test.csv, append=T, quote=F, row.names=F) } I would like to export directly into xls for 2 reasons: - I won't have to save each file again in xls - I can take advantage of the use of several sheets, which would reduce the number of files. As I said in my earlier emails, what I want to export are test outputs from functions, so I cannot change it; I just have to deal with it. Thanks again Ivan Le 2/25/2010 10:24, Dieter Menne a écrit : Ivan Calandra wrote: I've tried it, but the problem is that each element has a different size, with makes rbind() useless. Assuming that size means different number of columns, then appending is not valid, because it would change the structure of the table, and with ODBC we are in the relational database world. In that case, you should assemble your data frame with all possible columns and leave the fields empty. If size means different number of rows, where append DOES make sense, rbind is useful. Dieter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with looping on sqlSave()
Ivan Calandra wrote: What if size means both columns and rows? Then you are not longer in the database world, and should use one of the half dozen other methods to write to Excel, either native, via Perl (portable) or RCOM. Search R-search for write Excel. Dieter -- View this message in context: http://n4.nabble.com/problem-with-looping-on-sqlSave-tp1567601p1568745.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Odp: Subset Question
Hi r-help-boun...@r-project.org napsal dne 25.02.2010 08:22:48: This shall work. What really are values of region? What does str(eu08$region) tell you about it? If it is really factor, what are really its levels? What does level(eu08$region) show? My thoughts were also that it would work, but it results in 130 column headings stripped of all rows. To answer your questions: str(eu08$region) yielded: $ region : Factor w/ 10 levels 1.Byrard,..: 3 3 3 3 10 10 10 4 4 4 ... level(eu08$region) yielded nothing, but levels(eu08$region) yielded: [1] 1.Byrard2.Alsat 3.Bigur [4] 4.Itziar5.Ingur 6.Git [7] 7.Git Balance 8.Triage 9.Snolunt [10] 10.Bigntu Here is your problem. Factor is integer numeric vector with label for each separate level of factor. If you want question your factor you need to use proper label. see subset(eu08, region==1.Byrard) Regards Petr Thanks for your attention, Petr! -- View this message in context: http://n4.nabble.com/Subset-Question- tp1568555p1568584.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Odp: different types graphs
Hi r-help-boun...@r-project.org napsal dne 25.02.2010 09:48:04: library(RODBC) ch- odbcConnect(durga) sqlQuery(ch, paste(SELECT * from emp)) sqlQuery(ch, (SELECT * from xyz)) store revenue year_y 1 bigbazar 7878752008 2 more 87876 2008 plot(revenue ~ year_y, data=xyz, pch=16) can i get any diffrent types of graphs like pie charts, bar plots.using plot commands? please give me suggestions. Your installation of R must be broken. I can easily get help pages for ?plot ?pie ?barplot Regards Petr -- View this message in context: http://n4.nabble.com/different-types-graphs- tp1568673p1568673.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with looping on sqlSave()
As I said earlier, none of the packages I have found (dataframes2xls, WriteXLS, xlsReadWrite, xlsx) to export to xls allow appending on the same sheet. So at the end, write.csv() is more flexible for my use. Do you know if the RExcel add-on would be useful in my case? I took a look at the manual, but it doesn't really describe well the possibilites. Thank you anyway Ivan Le 2/25/2010 10:53, Dieter Menne a écrit : Ivan Calandra wrote: What if size means both columns and rows? Then you are not longer in the database world, and should use one of the half dozen other methods to write to Excel, either native, via Perl (portable) or RCOM. Search R-search for write Excel. Dieter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multicore in R
Why don't use the mclapply() function? It takes care of everything. mario On 25-Feb-10 8:56, dikshie wrote: Hi, i have a function: zz- (constrOptim(c(.5,0), fr, grr, ui=rbind(c(-1,0),c(1,-1)), ci=c(-0.9,0.1))) i can get the result by using command (for example): zz$par now if i can use multicore: zz-parallel(constrOptim(c(.5,0), fr, grr, ui=rbind(c(-1,0),c(1,-1)), ci=c(-0.9,0.1))) result collect(zz) i cant get my the result: result$par because multicore add process id. for example: $`2493`$par [1] 0.8891335 0.7891335 i try to get the result by: result$`processID(zz)`$par but it return NULL. so any idea how to get the result? with best regards, -- Ing. Mario Valle Data Analysis and Visualization Group| http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] angle phase mapping
Hi all, sorry, here is the pdf and I re post my question : could anyone give me a clue for the name of a function that would allow me to create the same kind of plot as the attached image in R? I know how to create a map (shapefile polygons), I just want to add the phase information as triangles , pointing in the direction according to the phase, and the colors of the triangle describing as well the phase I will have a vector of phases : one scalr (the phase) per polygon plotted on the map Thanks very much for any help Magali 2010/2/25 Magali teurlai teurlaima...@gmail.com Hi all, could anyone give me a clue for the name of a function that would allow me create the same kind of plot as the attached image in R? I know how to create a map (shapfile polygons), I just want to add the phase information Thanks very much for any help Magali phase angle map.pdf Description: Adobe PDF document __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 Beta Distribution and Transformation method
The following are problems for my Data Analysis course. The professor has allowed us to use internet help sites such as these to solve the problems since he didn't teach us how to use R in class. 1. I have learned how many random numbers must be simulated for the Beta distribution using Acceptance-Rejection method. I need to write an R code/function to check how many random numbers must be simulated to generate 1000 samples from the Beta( a= 2; B = 2) distribution. Also, I need to do a simulation study for the following problems [Transformation Methods]: 2 . If Z ~N(0; 1), then V = Z^2=x^ 2(1). Draw a random sample of size 100 from V and compare this with theoretical samples. Summarize the result. 3. If U ~x^2(m) and V ~x^2(n) are independent, then F = (U/m)/ (V/n) has the F distribution with (m, n) degrees of freedom. Choose the values m = 2 and n = 3. Draw a random sample of size 100 from F and compare this with theoretical sample. Summarize the result. 4. I f U,V ~Unif(0; 1) are independent , then Z1 = (sqrt(-2 log U)) cos(2piV ); Z2 =(sqrt(-2 log V)) sin(2piU) are independent standard normal [N(0; 1)] variables. Draw a random sample of size 100 from Z1 and Z2 and compare this with theoretical samples. Summarize the result. Any help would be greatly appreciated as to how to solve these using R code. I am a beginner at R and don't know it nearly well enough to solve these. Thanks, Tyler -- View this message in context: http://n4.nabble.com/Help-with-Beta-Distribution-and-Transformation-method-tp1568604p1568604.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Bimodal distribution
Hi Ingmar, Thank you for your reply! How to fit a mixture distribution to the data, do you mean by using mixed model? Regards, Samor --- On Wed, 24/2/10, Ingmar Visser i.vis...@uva.nl wrote: From: Ingmar Visser i.vis...@uva.nl Subject: Re: [R] Bimodal distribution To: Samor Gandhi samorgan...@yahoo.com Cc: r-help@r-project.org Date: Wednesday, 24 February, 2010, 19:14 Samor, A somewhat indirect answer: you could fit a mixture distribution to your data and test how many components are needed to best describe your data. hth, Ingmar On Wed, Feb 24, 2010 at 1:22 PM, Samor Gandhi samorgan...@yahoo.com wrote: Hello, Is there any test for bimodality in R that x - c(rnorm(1000,0,1),rnorm(1000,3,1)) hist(x,nclass=100) Thank you in advance for any help. Regards, Samor [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Barplot colours
Hi all, my plotbase (height) is a 2x2 matrix and I want to draw a plot with different colours. I used beside = FALSE and so the elements (1,1) and (2,1) are in one bar and the elements (1,2) and (2,2) are in the other bar (stacked). This is no problem, if the first row has one colour and the second line has one colour. But now I want to draw the frist bar in one colour an the second bar in two different colours. Is there apossibility to do this? I tried to do this in providing a 2x2 matrix with different colours in the parameter col but without sucess. Thank you very much in advance, Jens. -- View this message in context: http://n4.nabble.com/Barplot-colours-tp1568753p1568753.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with looping on sqlSave()
Ivan Calandra wrote: As I said earlier, none of the packages I have found (dataframes2xls, WriteXLS, xlsReadWrite, xlsx) to export to xls allow appending on the same sheet. Please check again. WriteXLS has a parameter where to start writing. D -- View this message in context: http://n4.nabble.com/problem-with-looping-on-sqlSave-tp1567601p1568831.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to install rattle for data mining
library(rattle) Loading required package: pmml Loading required package: XML Error: package 'XML' could not be loaded In addition: Warning message: In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) : there is no package called 'XML' i have installed glade package install.packages(RGtk2) install.packages(rattle) -- View this message in context: http://n4.nabble.com/how-to-install-rattle-for-data-mining-tp1568841p1568841.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] export tables to Excel files
OK, I think dirung the disuccion we mixed up the directions of transfer. The example I sent was Excel - R For R - Excel you need something like RInterface.GetDataframe dfname, Worksheets(wsname).Range(A1) dfname, wsname and the cell refence (A1) have to be given for each dataframe you want to transfer. You need to install RExcel to do this. CRAN has a package RExcelInstaller which does everything for you. On 2/24/2010 4:35 PM, Tal Galili wrote: Hi Erich. I admit I haven't gotten all that is necessary to implement it. But thanks anyway :) Tal Contact Details:--- Contact me: tal.gal...@gmail.com mailto:tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com http://www.talgalili.com (Hebrew) | www.biostatistics.co.il http://www.biostatistics.co.il (Hebrew) | www.r-statistics.com http://www.r-statistics.com (English) -- On Wed, Feb 24, 2010 at 12:55 PM, Erich Neuwirth erich.neuwi...@univie.ac.at mailto:erich.neuwi...@univie.ac.at wrote: This was a VBA program which from R put the dataframes into R. Then in R you can do whatever you want. On 2/24/2010 7:52 AM, Tal Galili wrote: (off mailing list) Thanks Erich for the example, only please note that I asked about the other way around (reading the excel into R) Either way - Thanks! Tal Contact Details:--- Contact me: tal.gal...@gmail.com mailto:tal.gal...@gmail.com mailto:tal.gal...@gmail.com mailto:tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com http://www.talgalili.com http://www.talgalili.com (Hebrew) | www.biostatistics.co.il http://www.biostatistics.co.il http://www.biostatistics.co.il (Hebrew) | www.r-statistics.com http://www.r-statistics.com http://www.r-statistics.com (English) -- On Wed, Feb 24, 2010 at 1:01 AM, Erich Neuwirth erich.neuwi...@univie.ac.at mailto:erich.neuwi...@univie.ac.at mailto:erich.neuwi...@univie.ac.at mailto:erich.neuwi...@univie.ac.at wrote: In RExcel, you can write VBA macros to perform R-related function. A cooked up example (not checked) Sub TransferFrames() MySheetNames = Array(Sheet1, Sheet2, Sheet3) MyDFNames = Array(mydf1, mydf2, mydf3) RInterface.StartRServer For i = Lbound(MySheetNames) to UBound(MySheetNames) RInterface.PutDataframe MyDFNames(i), _ Worksheets(MySheetNames(i)).Range(A1).CurrentRegion Next i End Sub This will take the data in the rectangular nonempty range anchored at cell A1 for the 3 names sheets and transfer them to R as dataframes with the names given in MyDFNames On 2/23/2010 10:46 PM, Tal Galili wrote: Hi Richard, Thanks for pointing this out. BTW - How would you use Rexcel to write several data frames into several sheets in excel ? Thanks! Tal Contact Details:--- Contact me: tal.gal...@gmail.com mailto:tal.gal...@gmail.com mailto:tal.gal...@gmail.com mailto:tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com http://www.talgalili.com http://www.talgalili.com (Hebrew) | www.biostatistics.co.il http://www.biostatistics.co.il http://www.biostatistics.co.il (Hebrew) | www.r-statistics.com http://www.r-statistics.com http://www.r-statistics.com (English) -- On Tue, Feb 23, 2010 at 5:04 PM, RICHARD M. HEIBERGER r...@temple.edu mailto:r...@temple.edu mailto:r...@temple.edu mailto:r...@temple.eduwrote: Please consider RExcel, which allows complete integration of R and Excel. See http://rcom.univie.ac.at for details and examples including a video. RExcel works in both directions (R to Excel, Excel to R) with Excel 2010, 2007, 2003, and 2002. Rich [[alternative HTML version deleted]] __ R-help@r-project.org
Re: [R] Barplot colours
On 02/25/2010 08:59 PM, koj wrote: Hi all, my plotbase (height) is a 2x2 matrix and I want to draw a plot with different colours. I used beside = FALSE and so the elements (1,1) and (2,1) are in one bar and the elements (1,2) and (2,2) are in the other bar (stacked). This is no problem, if the first row has one colour and the second line has one colour. But now I want to draw the frist bar in one colour an the second bar in two different colours. Is there apossibility to do this? I tried to do this in providing a 2x2 matrix with different colours in the parameter col but without sucess. Hi Jens, You can pass a matrix of colors to the barp function in the plotrix package. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] data mining
how can we achieve data mining using R Project. how to install Rattle gui for R project. can anyone please help me. i want to forecast the results . Thanks in advance. -- View this message in context: http://n4.nabble.com/data-mining-tp1568872p1568872.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to install rattle for data mining
A little googling goes a LONG way: [1]http://datamining.togaware.com/survivor/Install_MS_Windows.html Explicity states how to install the 'XML' package required by R. References 1. http://datamining.togaware.com/survivor/Install_MS_Windows.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.
Re: [R] Help with split.
rkevinbur...@charter.net wrote: I read in the documentation for split: ‘split’ divides the data in the vector ‘x’ into the groups defined by ‘f’. But I am still unclear as to its function. Take for example: x - 1:4 split(x, c(0,1)) $`0` [1] 1 3 $`1` [1] 2 4 I am not clear on how this result is reached. Usual recycling rule: Same result as split(x, c(0,1,0,1)). -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] What is assign attribute?
rkevinbur...@charter.net wrote: I am just curious. Every once and a while I see an attribute attached to an object called assign. What meaning does this have? For example: dist ~ speed, data=cars forms a matrix like: num [1:50, 1:2] 1 1 1 1 1 1 1 1 1 1 ... - attr(*, dimnames)=List of 2 ..$ : chr [1:50] 1 2 3 4 ... ..$ : chr [1:2] (Intercept) speed - attr(*, assign)= int [1:2] 0 1 The dimnames attribute is fairly self-explanatory. I just am not sure what the assign attribute means. It has to do with the mapping between terms of the formula and columns of the design matrix: str(model.matrix(Ozone~factor(Month)+Wind,data=airquality)) num [1:116, 1:6] 1 1 1 1 1 1 1 1 1 1 ... - attr(*, dimnames)=List of 2 ..$ : chr [1:116] 1 2 3 4 ... ..$ : chr [1:6] (Intercept) factor(Month)6 factor(Month)7 factor(Month)8 ... - attr(*, assign)= int [1:6] 0 1 1 1 1 2 - attr(*, contrasts)=List of 1 ..$ factor(Month): chr contr.treatment I.e. columns 2:5 belong to the first non-intercept term, factor(Month). (Notice that it is implicitly assumed that you have the corresponding terms() output to hand, likewise for the contrasts attribute.) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rearranging entries in a matrix
I have a matrix, called data. I used the code below to rearrange the data such that the first column remains the same, but the y value falls under either columns 2, 3 or 4, depending on the value of z. If z=1 for example, then the value of y will fall under column 2, if z=2, the value of y falls under column 3, and so on. data x y z [1,] 50 13 1 [2,] 14 8 2 [3,] 3 7 3 [4,] 4 16 1 [5,] 6 8 2 [6,] 10 2 3 [7,] 15 11 1 [8,] 14 9 3 data1 - data.frame(matrix(0, length(x), ncol(data)+1)) colnames(data1) - c(x,y1,y2,y3) data1$x - data[,1] data1$y1 - apply(data, 1, function(x) (ifelse(x[3]==1,x[2],NA))) data1$y2 - apply(data, 1, function(x) (ifelse(x[3]==2,x[2],NA))) data1$y3 - apply(data, 1, function(x) (ifelse(x[3]==3,x[2],NA))) data1 x y1 y2 y3 1 50 13 NA NA 2 14 NA 8 NA 3 3 NA NA 7 4 4 16 NA NA 5 6 NA 8 NA 6 10 NA NA 2 7 15 11 NA NA 8 14 NA NA 9 I used the apply function (three times) to generate the output below, which is as I wish to have it. Can any one write for me a for loop that would produce the same results. Thanks in advance. JN [[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] adonis(), design
hello list, i'd appreciate help regarding formula expression in adonis(), package vegan. i'm interested in the effect of an impact on species composition and if this effect is the same for different sites. i have an impact survey with plot pairs, one plot with impact the other with similar ecolgical conditions but without impact, which is the control (factor1: impact). two different sites were sampled, at each 6 plot pairs (factor2: community) with a final N of 24. so this would be a 2-factorial crossed design, right? thus, i called: adonis(speciesdata~Community*Impact) but do i have to a account for the identity of pairs by blocking them - if so, how to achieve this in adonis? i'm not sure about the reasons why a blocking would be needed and if the rather small size of my data would allow a blocking, without loosing all statistical power. greetings, kay -- View this message in context: http://n4.nabble.com/adonis-design-tp1568989p1568989.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R and Wordpress
Hi, On Wed, Feb 24, 2010 at 11:40 PM, C.H. chainsawti...@gmail.com wrote: Dear R helpers, I have a question regarding wordpress and R. I have asked this question in Wordpress support ( http://wordpress.org/support/topic/368312 ) but there is no answer so far, maybe the R community can have a better answer. I followed the excellent tutorial on r-statistics-blog ( http://www.r-statistics.com/2010/02/r-syntax-highlight-on-your-blog-a-wordpress-plugin/ ) to enable syntax hightlighting but Wordpress keeps breaking - into - and I have to use = instead. (I think = is confusing.) And I think it is not related to the theme as well. Is there any clue to solve this? I am using Wordpress 2.9.2. I'm guessing that your best bet is to ask the author of the blog that you linked to in your post ... just post a comment on that post there. -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to fast extract values from different list elements
On Thu, Feb 25, 2010 at 4:10 AM, Heym, Peter-Paul ph...@ipb-halle.de wrote: this works fine but it is very slow (since A and B can be very large and I have to repeat this about 5000 times). I would like to make this faster using e.g. apply or lapply but I didn't get it work using these methods. Does anybody know an EFFICIENT or FAST way extract the values from L using the values from A and B? Instead of L[[A[i]]][B[i]], try L[A][B] - Tom __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Rearranging entries in a matrix
Hi: Loop? We don't need no steeenking loop!! Here's a way to create a matrix with matrix indexing that you can attach with x to create a new data frame. Calling your original data frame df, m - matrix(NA, nrow = nrow(df), ncol = 3) # Create the indices of the initialized matrix to modify idx - cbind(1:nrow(m), df$z) # Map the modifications to the matrix m[idx] - df$y m [,1] [,2] [,3] [1,] 13 NA NA [2,] NA8 NA [3,] NA NA7 [4,] 16 NA NA [5,] NA8 NA [6,] NA NA2 [7,] 11 NA NA [8,] NA NA9 data1 - as.data.frame(cbind(df$x, m)) names(data1) - c(x, y1, y2, y3) data1 x y1 y2 y3 1 50 13 NA NA 2 14 NA 8 NA 3 3 NA NA 7 4 4 16 NA NA 5 6 NA 8 NA 6 10 NA NA 2 7 15 11 NA NA 8 14 NA NA 9 HTH, Dennis On Thu, Feb 25, 2010 at 5:17 AM, Juliet Ndukum jpnts...@yahoo.com wrote: I have a matrix, called data. I used the code below to rearrange the data such that the first column remains the same, but the y value falls under either columns 2, 3 or 4, depending on the value of z. If z=1 for example, then the value of y will fall under column 2, if z=2, the value of y falls under column 3, and so on. data x y z [1,] 50 13 1 [2,] 14 8 2 [3,] 3 7 3 [4,] 4 16 1 [5,] 6 8 2 [6,] 10 2 3 [7,] 15 11 1 [8,] 14 9 3 data1 - data.frame(matrix(0, length(x), ncol(data)+1)) colnames(data1) - c(x,y1,y2,y3) data1$x - data[,1] data1$y1 - apply(data, 1, function(x) (ifelse(x[3]==1,x[2],NA))) data1$y2 - apply(data, 1, function(x) (ifelse(x[3]==2,x[2],NA))) data1$y3 - apply(data, 1, function(x) (ifelse(x[3]==3,x[2],NA))) data1 x y1 y2 y3 1 50 13 NA NA 2 14 NA 8 NA 3 3 NA NA 7 4 4 16 NA NA 5 6 NA 8 NA 6 10 NA NA 2 7 15 11 NA NA 8 14 NA NA 9 I used the apply function (three times) to generate the output below, which is as I wish to have it. Can any one write for me a for loop that would produce the same results. Thanks in advance. JN [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rearranging entries in a matrix
Try this also: reshape(cbind(Id = 1:8, DF), v.names = 'y', timevar = 'z', direction = 'wide', idvar = 'Id')[-1] On Thu, Feb 25, 2010 at 10:17 AM, Juliet Ndukum jpnts...@yahoo.com wrote: I have a matrix, called data. I used the code below to rearrange the data such that the first column remains the same, but the y value falls under either columns 2, 3 or 4, depending on the value of z. If z=1 for example, then the value of y will fall under column 2, if z=2, the value of y falls under column 3, and so on. data x y z [1,] 50 13 1 [2,] 14 8 2 [3,] 3 7 3 [4,] 4 16 1 [5,] 6 8 2 [6,] 10 2 3 [7,] 15 11 1 [8,] 14 9 3 data1 - data.frame(matrix(0, length(x), ncol(data)+1)) colnames(data1) - c(x,y1,y2,y3) data1$x - data[,1] data1$y1 - apply(data, 1, function(x) (ifelse(x[3]==1,x[2],NA))) data1$y2 - apply(data, 1, function(x) (ifelse(x[3]==2,x[2],NA))) data1$y3 - apply(data, 1, function(x) (ifelse(x[3]==3,x[2],NA))) data1 x y1 y2 y3 1 50 13 NA NA 2 14 NA 8 NA 3 3 NA NA 7 4 4 16 NA NA 5 6 NA 8 NA 6 10 NA NA 2 7 15 11 NA NA 8 14 NA NA 9 I used the apply function (three times) to generate the output below, which is as I wish to have it. Can any one write for me a for loop that would produce the same results. Thanks in advance. JN [[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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Zero inflation model - pscl package
On Wed, 24 Feb 2010, Nicholas M. Caruso wrote: I have some questions regarding Zero Inflation Poisson models. I am using count data to analyze abundance trends of salamanders. However, I have surveys which differ in the amount of effort (i.e. the number of people searching and amount of time - I am using a museum database so not all surveys were conducted by me). Therefore I need to account for the effort. If change the count (response variable) then it will have decimals and not be usable in this model. So I decided to put this term into the independent variable. The usual approach would be the following: If you think that some link function of y/n (response per effort) is linear in a set of covariates x with coefficients b, you would typically write log(y/n) = x'b which can be transformed to log(y) - log(n) = x'b log(y) = x'b + log(n) i.e., the log-effort would be an additional regressor with coefficient fixed to 1. This is called an offset so the R formula would be y ~ x + offset(log(n)) Alternatively, instead of relying on the fact the coefficient is exactly 1, you can estimate and test it, i.e. y ~ x + log(n) I am analyzing Historic vs. Current surveys. Here is an example of my code: require(pscl) model - zeroinfl(Sallys~Survey:Person.Hours, dist=poisson, EM=TRUE) summary(model) I think I would allow different intercepts as well, i.e., zeroinfl(Sallys ~ Survey * log(Person.Hours)) I have received some very significant results on most of them and on some that I thought wouldn't be significant turned out to be. So I am concerned with the model being appropriate. I created a simulated database and ran a simple glm to see if y/b ~ x is the same as y~x:b and it is not (not surprisingly). Does anyone have suggestions for how to adjust my model to allow for these comparisons? I cannot use a glm with Poisson error because of overdispersion and a lot of zeroes. I thought about either rounding up my ratios or multiplying everything by 100 to eliminate the decimals but to keep the variation (I am not pleased with either of those options) On another note, I am having a little trouble interpreting the results (I think). Which this may not matter if I cannot use the ZIP model. Is the Count model coefficients (poisson with log link) the measure of if the sites differ and if so what do the estimates for both surveys indicate? Is that the mean for both surveys and it is testing them against zero? If so I want to test them against each other and I don't know exactly how to do that. Here is the output: Estimate Std. Error z value Pr(|z|) (Intercept) 1.974180.06570 30.048 2e-16 *** SurveyCurrent:Person.Hours 0.041920.07597 0.5520.581 SurveyHistoric:Person.Hours 0.402210.01540 26.110 2e-16 *** It forces the intercept to be the same, both for the current and the historic sites which is not so intuitive. The two slopes mean, that for the historic sites, the counts increased clearly with effort, but for the current sites it increased only slightly (not significantly). As for the Zero-inflation model coefficients( binomial with logit link). I read that this is a measure of 1) suitability or 2) if the predictor of excess zeros was significant. Which one of these (or is it something else) is correct and how do I interpret this? Here is a sample of a read out: Zero-inflation model coefficients (binomial with logit link): Estimate Std. Error z value Pr(|z|) (Intercept) -1.1625 0.9833 -1.182 0.237 SurveyCurrent:Person.Hours -1.1787 1.1304 -1.0430.297 SurveyHistoric:Person.Hours -0.5050 0.3440 -1.4680.142 This reflects the probability of additional zeros which does not seem to depend on either site or effort. For an introduction to the zero-inflation model and its implementation in R see vignette(countreg, package = pscl) Also, I would recommend to consider hurdle() models as well. They often give similar fits and are slightly easier to interpret (IMO). hth, Z http://search.twitter.com/search?q=%0D%0Ahttp://www.google.com/search?q=%0D%0Ahttp://smarterfox.com/wikisearch/search?q=%0D%0Alocale=en-UShttp://www.oneriot.com/search?p=smarterfoxssrc=smarterfox_popup_bubblespid=8493c8f1-0b5b-4116-99fd-f0bcb0a3b602q=%0D%0A Thanks for any suggestions/help!! -- Nicholas M Caruso Graduate Student CLFS-Biology 4219 Biology-Psychology Building University of Maryland, College Park, MD 20742-5815 phone: 301-405-6884 -- I learned something of myself in the woods today, and walked out pleased for having made the acquaintance. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help
Re: [R] Reading a password-protected Excel workbook
Dimitri Shvorob wrote: I try reading a password-protected spreadsheet with RODBC, passing a file or an ODBC source to odbcConnect, e.g. con = odbcConnect(dsn = mywkbk, uid = , pwd = mypwd) but get Could not decrypt file pop-up error message. Not really: http://support.microsoft.com/default.aspx/kb/211378/EN-US/ Dieter -- View this message in context: http://n4.nabble.com/Reading-a-password-protected-Excel-workbook-tp1568925p1569030.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] latent class factor analysis (LCFA) in R?
On Tue, 23 Feb 2010 13:43:44 +0100, Ingmar Visser (IV) wrote: Dear Mark, I don't know whether it has ... But there are some packages that provide functionality for specifying mixtures of user-defined distributions, in your case a factor model. package flexmix has an example of how to fit mixtures of user-defined models and so does my own package depmixS4 (which may be overkill here as it is meant for markov mixtures of general distributions). Hence, you could use one of these in combination with your favorite factor modeling package to specify the model you want. hth, Ingmar On Tue, Feb 23, 2010 at 12:46 PM, Mark Heckmann mark.heckm...@gmx.dewrote: I am looking for a package that can perform latent class factor analysis (LCFA) like in LatentGold. Does someone know wether or not it has been implemented in some package? I just can't find it. Bests, Mark ��� Mark Heckmann Dipl. Wirt.-Ing. cand. Psych. Vorstra�e 93 B01 28359 Bremen Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.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. [[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] behavior of seq_along
I'm trying to understand the behavior of seq_along in the following example: x - 1:5; sum(x) y - 6:10; sum(y) data - c(x,y) S - sum( data[seq_along(x)] ) S T - sum( data[seq_along(y)] ) T Why is T != sum(y) ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 looping on sqlSave()
I've checked in the package WriteXLS and couldn't find such parameter (I hope I didn't overlook anything!). However write.xls() in xlsReadWrite package has such parameter. I've tried it and the problem is that, even though I can make the writing start at the last line, it will overwrite the whole file. Even if I try to append on a new sheet, the xls file is overwritten. One by one, I'm crossing off the possibilities... Thanks! Ivan Le 2/25/2010 11:58, Dieter Menne a écrit : Ivan Calandra wrote: As I said earlier, none of the packages I have found (dataframes2xls, WriteXLS, xlsReadWrite, xlsx) to export to xls allow appending on the same sheet. Please check again. WriteXLS has a parameter where to start writing. D __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Subset Question
Chertudi wrote: Hello helpful R folks, First off, please forgive my English. Second, I'm new with R, I've searched the archives about subsets, and I haven't found quite the help I need. I'm currently analysing a population survey whose data set has about 15000 households (the rows/observations) and 130 variables (the columns). I've managed to import the set into R as a data.frame called eu08. Now, I'm trying to look at all of the variables, but limited to one province in the region variable. I think the provinces are factors, and the province of interest is labeled '3'. I've tried the following: region3=subset(eu08, region==3) --this simply strips all of the rows from the columns, and I know that about 4000 of the observations are specific to region 3. So does putting the 3 as '3' and 3. Any help would be greatly appreciate. Well, we don't know if it really is a factor. You can determine that by doing... class(eu08$region) If it is a factor, then levels(eu08$region) should let you know what you can subset with. str(eu08) might also be good to look at... Erik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] latent class factor analysis (LCFA) in R?
Hi, We (i.e. Bettina Grün) have some experimental code for mixtures of factor analyzers in flexmix, because we needed it for one paper. We have not released it yet because the code is not very well tested (and we do have concerns about identification of such models, but that's a different issue). As there seems to be interest in it we will release a new version of flexmix in the next days which includes mixtures of factor analyzers. Look for help(FLXMCfactanal) in flexmix version 2.2-5 (next Monday or so). Best, Fritz On Tue, 23 Feb 2010 13:43:44 +0100, Ingmar Visser (IV) wrote: Dear Mark, I don't know whether it has ... But there are some packages that provide functionality for specifying mixtures of user-defined distributions, in your case a factor model. package flexmix has an example of how to fit mixtures of user-defined models and so does my own package depmixS4 (which may be overkill here as it is meant for markov mixtures of general distributions). Hence, you could use one of these in combination with your favorite factor modeling package to specify the model you want. hth, Ingmar On Tue, Feb 23, 2010 at 12:46 PM, Mark Heckmann mark.heckm...@gmx.dewrote: I am looking for a package that can perform latent class factor analysis (LCFA) like in LatentGold. Does someone know wether or not it has been implemented in some package? I just can't find it. Bests, Mark ��� Mark Heckmann Dipl. Wirt.-Ing. cand. Psych. Vorstra�e 93 B01 28359 Bremen Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.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. [[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] Building R packages in Windows 7
Dear useRs, I'm having trouble building R packages in Windows 7 regarding HTML help Workshop. Pointing PATH to c:\Program Files\HTML help Workshop does work in Windows (e.g. Vista) and does not in Windows 7. Some tips?? Kind regards, -- Dr Eric B Ferreira Exact Sciences Department Federal University of Alfenas Brazil [[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] behavior of seq_along
Dale Steele wrote: x - 1:5; sum(x) y - 6:10; sum(y) data - c(x,y) S - sum( data[seq_along(x)] ) S T - sum( data[seq_along(y)] ) T If in doubt, divide and conquer: seq_along(x) [1] 1 2 3 4 5 seq_along(y) [1] 1 2 3 4 5 You expected that the second vector is 6,7... Dieter -- View this message in context: http://n4.nabble.com/behavior-of-seq-along-tp1569033p1569049.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] behavior of seq_along
Because, data[seq_along(x)] == data[seq_along(y)], You need this: sum(data[length(x) + seq_along(y)]) On Thu, Feb 25, 2010 at 11:02 AM, Dale Steele dale.w.ste...@gmail.com wrote: I'm trying to understand the behavior of seq_along in the following example: x - 1:5; sum(x) y - 6:10; sum(y) data - c(x,y) S - sum( data[seq_along(x)] ) S T - sum( data[seq_along(y)] ) T Why is T != sum(y) ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] angle phase mapping
On Feb 25, 2010, at 5:51 AM, Magali teurlai wrote: Hi all, sorry, here is the pdf and I re post my question : could anyone give me a clue for the name of a function that would allow me to create the same kind of plot as the attached image in R? I know how to create a map (shapefile polygons), I just want to add the phase information as triangles , pointing in the direction according to the phase, and the colors of the triangle describing as well the phase I will have a vector of phases : one scalr (the phase) per polygon plotted on the map You have a plot with shapes indicating directions and magnitudes overlayed on latitude and longitude on a map. Look for vectorFields in package plotrix. There is also a dataset in ggplot that is described as being a vector field but I don't see a plotting method mentioned in that dataset page. Thanks very much for any help Magali 2010/2/25 Magali teurlai teurlaima...@gmail.com Hi all, could anyone give me a clue for the name of a function that would allow me create the same kind of plot as the attached image in R? I know how to create a map (shapfile polygons), I just want to add the phase information Thanks very much for any help Magali phase angle map.pdf__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with looping on sqlSave()
Just to confirm, WriteXLS() does not have such a parameter, but write.xls() in the xlsReadWRite package does. As you have noted however, none of these approaches are really designed to enable flexible appending to an existing Excel file. As I believe Dieter noted in an earlier post, your best option may be to look at the RCOM/RExcel based solution, which gives you more flexibility in writing to Excel files. More info at http://rcom.univie.ac.at/. HTH, Marc Schwartz On Feb 25, 2010, at 8:02 AM, Ivan Calandra wrote: I've checked in the package WriteXLS and couldn't find such parameter (I hope I didn't overlook anything!). However write.xls() in xlsReadWrite package has such parameter. I've tried it and the problem is that, even though I can make the writing start at the last line, it will overwrite the whole file. Even if I try to append on a new sheet, the xls file is overwritten. One by one, I'm crossing off the possibilities... Thanks! Ivan Le 2/25/2010 11:58, Dieter Menne a écrit : Ivan Calandra wrote: As I said earlier, none of the packages I have found (dataframes2xls, WriteXLS, xlsReadWrite, xlsx) to export to xls allow appending on the same sheet. Please check again. WriteXLS has a parameter where to start writing. D __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] reducing data.frame
Perhaps the reshape package? It's just about impossible to read your data layout. Could you resubmit the example using dput()? Thanks --- On Thu, 2/25/10, AC Del Re de...@wisc.edu wrote: From: AC Del Re de...@wisc.edu Subject: [R] reducing data.frame To: r-help@r-project.org Received: Thursday, February 25, 2010, 12:44 AM Hi All, Is there an easy way to reduce a data.frame to 1 'id' per row while keeping information from the other rows of that same variable, if applicable? e.g.: # data multi[1:15,] id r n wi wi.tau z k alliance a.rater eml treatment outcome o.rater german 1 100 0.280 44 41 21.72514 0.2876821 210 NA NA NA NA NA Client NA 2 100 0.280 44 41 21.80953 0.2876821 182 NA NA Early NA NA NA NA 3 100 0.280 44 41 22.36641 0.2876821 206 NA Client NA NA NA NA NA 4 100 0.280 44 41 23.59224 0.2876821 188 NA NA NA NA NA NA Other 5 100 0.280 44 41 23.83157 0.2876821 147 WAI NA NA NA NA NA NA 6 101 0.000 37 34 19.65678 0.000 182 NA NA Early NA NA NA NA 7 101 0.5423790 37 34 17.65078 0.6075200 98 NA NA NA Psychodymic NA NA NA 8 101 0.5423790 37 34 19.58820 0.6075200 210 NA NA NA NA NA Observer NA 9 101 0.5423790 37 34 21.09334 0.6075200 188 NA NA NA NA NA NA Other 10 101 0.9075737 37 34 19.65678 1.5135878 182 NA NA Late NA NA NA NA 11 103a 0.495 18 15 10.36364 0.5426615 90 NA NA NA NA SCL NA NA 12 103a 0.6171548 18 15 11.32425 0.7203964 210 NA NA NA NA NA Observer NA 13 103a 0.6171548 18 15 11.34714 0.7203964 182 NA NA Early NA NA NA NA 14 103a 0.6171548 18 15 11.49606 0.7203964 206 NA Client NA NA NA NA NA 15 103a 0.6171548 18 15 11.81150 0.7203964 188 NA NA NA NA NA NA Other # with the goal of having a reduced df (1 id per row) like this: id r n wi wi.tau z k alliance a.rater eml treatment outcome o.rater german 1 100 0.280 44 41 21.72514 0.2876821 210 wai client early NA NA Client other 101 etc... Ideally, I would like to reduce by id and r, if the values are the same and keep any discrepant values as a separate row (if possible), e.g.: 6 101 0.000 37 34 19.65678 0.000 182 NA NA Early NA NA NA NA 7 101 0.5423790 37 34 17.65078 0.6075200 98 NA NA Late Psychodymic NA Observer Other I appreciate any assistance, AC [[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. __ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Building R packages in Windows 7
On 25/02/2010 9:06 AM, Eric Ferreira wrote: Dear useRs, I'm having trouble building R packages in Windows 7 regarding HTML help Workshop. Pointing PATH to c:\Program Files\HTML help Workshop does work in Windows (e.g. Vista) and does not in Windows 7. Some tips?? We don't use the HTML Help Workshop any more since R 2.10.0, so you could upgrade to the current R, and the problem will go away. Otherwise, I think you'll have to ask Microsoft for help. But they aren't likely to be helpful: Win XP is the most recent OS listed as supported. 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] behavior of seq_along
On Feb 25, 2010, at 9:02 AM, Dale Steele wrote: I'm trying to understand the behavior of seq_along in the following example: x - 1:5; sum(x) y - 6:10; sum(y) data - c(x,y) S - sum( data[seq_along(x)] ) S T - sum( data[seq_along(y)] ) T Why is T != sum(y) ? Look at seq_along(y) seq_along returns indices for the purpose of accession of elements, so it starts with 1 and ends with the length of the object. Had you asked for sum(data[y[seq_along(y)]]) you might have achieved your expectation. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] error using pvcm() on unbalanced panel data
Dear all I am trying to fit Variable Coefficients Models on Unbalanced Panel Data. I managed to fit such models on balanced panel data (the example from the plm vignette), but I failed to do so on my real, unbalanced panel data. I can reproduce the error on a modified example from the vignette: require(plm) data(Hedonic) Hed - pvcm(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + ptratio + blacks + lstat, Hedonic, model = within,index = townid) Error in FUN(X[[1L]], ...) : insufficient number of observations ##it fails for both FE and RE cases Hed - pvcm(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + ptratio + blacks + lstat, Hedonic, model = random,index = townid) Error in FUN(X[[1L]], ...) : insufficient number of observations Would this be expected behaviour for unbalanced data? The vignette warns of several limitations regarding such data, but doesn't mention this specific case as a limitation. I would like to subsequently perform a test of poolability on my real data. Thank you Liviu sessionInfo() R version 2.10.1 (2009-12-14) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] plm_1.2-3sandwich_2.2-5 zoo_1.6-2MASS_7.3-5 [5] Formula_0.2-0kinship_1.1.0-23 lattice_0.18-3 nlme_3.1-96 [9] survival_2.35-8 fortunes_1.3-7 RGtk2_2.12.18cairoDevice_2.10 [13] sos_1.2-5brew_1.0-3 hints_1.0.1-1 loaded via a namespace (and not attached): [1] grid_2.10.1 tools_2.10.1 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Reading a password-protected Excel workbook
I try reading a password-protected spreadsheet with RODBC, passing a file or an ODBC source to odbcConnect, e.g. con = odbcConnect(dsn = mywkbk, uid = , pwd = mypwd) but get Could not decrypt file pop-up error message. Can anyone help? Thank you. -- View this message in context: http://n4.nabble.com/Reading-a-password-protected-Excel-workbook-tp1568925p1568925.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] mtext with at=NULL
Hello, in the help of mtext I found at: If ‘length(at)==0’ (the default), the location will be determined by ‘adj’ But if I use mtext( hello world, at=NULL) there comes the following error message: Fehler in mtext(hallo Welt, side = 3, adj = NA, at = NULL) : 'at' mit Länge 0 angegeben So the help says it is ok to use at with length(at) == 0 but if I use an at with length(at) == 0 I get an error message. This is a bug, isn't it? Kind regards, Ulrike Feldmann -- Ulrike Feldmann ZKRD Statistician Zentrales Knochenmarkspender-Register Fon: +49 731 1507-45 fuer die Bundesrepublik Deutschland Fax: +49 731 1507-01 Gemeinnützige Gesellschaft mbH http://www.zkrd.deHelmholtzstraße 10, 89081 Ulm, Germany - Registergericht: Amtsgericht Ulm, HRB 2566 Geschäftsführer: Manfred Stähle und Dr. Dr. Carlheinz Müller __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] export results
Hi all, I am looping through a function for 100 time in the middle of my code, and I want to output the results from this function. Is there a way to write the results into a txt or csv fil? For example, I write the results from the first loop to the first column of a spreadsheet and the results from the second loop to the second coclumn of a spreadsheet etc. Thank you very much, Wendy -- View this message in context: http://n4.nabble.com/export-results-tp1568880p1568880.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] error using pvcm() on unbalanced panel data
On 2/25/10, Liviu Andronic landronim...@gmail.com wrote: I can reproduce the error on a modified example from the vignette: require(plm) data(Hedonic) Hed - pvcm(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + ptratio + blacks + lstat, Hedonic, model = within,index = townid) Error in FUN(X[[1L]], ...) : insufficient number of observations ##it fails for both FE and RE cases Hed - pvcm(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + ptratio + blacks + lstat, Hedonic, model = random,index = townid) Error in FUN(X[[1L]], ...) : insufficient number of observations A quick update, the function pooltest() used via its formula interface fails in a similar way: pooltest(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + ptratio + blacks + lstat, Hedonic, model = within,index = townid) Error in FUN(X[[1L]], ...) : insufficient number of observations pooltest(mv ~ crim + zn + indus + chas + nox + rm + age + dis +rad + tax + ptratio + blacks + lstat, Hedonic, model = pooling,index = townid) Error in FUN(X[[1L]], ...) : insufficient number of observations Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] mtext with at=NULL
On 25/02/2010 8:58 AM, Ulrike Feldmann wrote: Hello, in the help of mtext I found at: If ‘length(at)==0’ (the default), the location will be determined by ‘adj’ But if I use mtext( hello world, at=NULL) there comes the following error message: Fehler in mtext(hallo Welt, side = 3, adj = NA, at = NULL) : 'at' mit Länge 0 angegeben So the help says it is ok to use at with length(at) == 0 but if I use an at with length(at) == 0 I get an error message. This is a bug, isn't it? I'd say it's a documentation error: it claims that the default is length 0, but the default is NA, which is length 1. The actual test in the code uses adj when a C equivalent of is.finite(at) is TRUE, so I'll change the docs to match the behaviour, rather than changing the behaviour to match the docs. 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] Odp: export results
Hi r-help-boun...@r-project.org napsal dne 25.02.2010 12:42:46: Hi all, I am looping through a function for 100 time in the middle of my code, and I want to output the results from this function. Is there a way to write the results into a txt or csv fil? For example, I write the results from the first loop to the first column of a spreadsheet and the results from the second loop to the second coclumn of a spreadsheet etc. make a data frame, let say res res=as.data.frame(matrix(NA, n, 100)) #predefine data frame for (i in ...) { some stuff res[,i] - some function result } write.table(res,) Regards Petr Thank you very much, Wendy -- View this message in context: http://n4.nabble.com/export-results-tp1568880p1568880.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to extract one of four plots in a linear regression model
Dear All, A linear regression model could be fitted by using lm function and the plot function can be used to check the assumption of the model. The help menu shows few instances on suitable coding for fitting such a linear model. In addition, four different plots could be extracted simultaneously with only a single plot function as followed: require(graphics) ## Annette Dobson (1990) An Introduction to Generalized Linear Models. ## Page 9: Plant Weight Data. ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) anova(lm.D9 - lm(weight ~ group)) opar - par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) plot(lm.D9, las = 1) The plot function gives four different plots simulaneously but i just need only part of them, for instance the normality plot. Could someone give some ideas the way to extract this single plot as i need to copy only this plot and paste it into Word document. Thanks Fir __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Building R packages in Windows 7
On 25/02/2010 10:40 AM, Eric Ferreira wrote: Dear Duncan Thank so much for your reply. Actually, I'm using the latest version of R and the problem persists. What do you use instead of HTML Help Workshop for newer R versions? We just produce text and HTML help pages on demand, and LaTeX ones for the pdf manuals. How are you asking for CHMs to be produced? Duncan Murdoch Best regards Eric. On 25 February 2010 11:43, Duncan Murdoch murd...@stats.uwo.ca wrote: On 25/02/2010 9:06 AM, Eric Ferreira wrote: Dear useRs, I'm having trouble building R packages in Windows 7 regarding HTML help Workshop. Pointing PATH to c:\Program Files\HTML help Workshop does work in Windows (e.g. Vista) and does not in Windows 7. Some tips?? We don't use the HTML Help Workshop any more since R 2.10.0, so you could upgrade to the current R, and the problem will go away. Otherwise, I think you'll have to ask Microsoft for help. But they aren't likely to be helpful: Win XP is the most recent OS listed as supported. 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] How to do: Correlation with blocks (or - repeated measures ?!) ?
Hello dear R help group, I have the following setup to analyse: We have about 150 subjects, and for each subject we performed a pair of tests (under different conditions) 18 times. The 18 different conditions of the test are complementary, in such a way so that if we where to average over the tests (for each subject), we would get no correlation between the tests (between subjects). What we wish to know is the correlation (and P value) between the tests, in within subjects, but over all the subjects. The way I did this by now was to perform the correlation for each subject, and then look at the distribution of the correlations received so to see if it's mean is different then 0. But I suspect there might be a better way for answering the same question (someone said to me something about geographical correlation, but a shallow search didn't help). p.s: I understand there might be a place here to do some sort of mixed model, but I would prefer to present a correlation, and am not sure how to extract such an output from a mixed model. Also, here is a short dummy code to give an idea of what I am talking about: attach(longley) N - length(Unemployed) block - c( rep( a, N), rep( b, N), rep( c, N) ) Unemployed.3 - c(Unemployed + rnorm(1), Unemployed + rnorm(1), Unemployed + rnorm(1)) GNP.deflator.3 - c(GNP.deflator + rnorm(1), GNP.deflator + rnorm(1), GNP.deflator + rnorm(1)) cor(Unemployed, GNP.deflator) cor(Unemployed.3, GNP.deflator.3) cor(Unemployed.3[block == a], GNP.deflator.3[block == a]) cor(Unemployed.3[block == b], GNP.deflator.3[block == b]) cor(Unemployed.3[block == c], GNP.deflator.3[block == c]) (I would like to somehow combine the last three correlations...) Any ideas will be welcomed. Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- [[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] How to add a title to represent four different plot in lm function
Dear All, A linear regression model could be fitted by using lm function and the plot function can be used to check the assumptions of the model. The example is as followed. require(graphics) ## Annette Dobson (1990) An Introduction to Generalized Linear Models. ## Page 9: Plant Weight Data. ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) anova(lm.D9 - lm(weight ~ group)) opar - par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) plot(lm.D9, las = 1) Could someone advice me the way to add a single title either at the above or bottom of these 4 plots, entitled The verification of model assumtion via four different plots ? Thanks Fir __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Building R packages in Windows 7
On 25/02/2010 10:56 AM, Eric Ferreira wrote: This is my first package. I'm just getting started doing that, following the steps described on you website... I really don't know how I asking for CHMs to be produced, sorry. All I can suggest is that you need to be less stingy with information. Tell us what you did. Tell us what symptoms you saw. Do both of those by cut and paste from your console, don't paraphrase, or refer to vague instructions like your website. Duncan Murdoch On 25 February 2010 12:52, Duncan Murdoch murd...@stats.uwo.ca wrote: On 25/02/2010 10:40 AM, Eric Ferreira wrote: Dear Duncan Thank so much for your reply. Actually, I'm using the latest version of R and the problem persists. What do you use instead of HTML Help Workshop for newer R versions? We just produce text and HTML help pages on demand, and LaTeX ones for the pdf manuals. How are you asking for CHMs to be produced? Duncan Murdoch Best regards Eric. On 25 February 2010 11:43, Duncan Murdoch murd...@stats.uwo.ca wrote: On 25/02/2010 9:06 AM, Eric Ferreira wrote: Dear useRs, I'm having trouble building R packages in Windows 7 regarding HTML help Workshop. Pointing PATH to c:\Program Files\HTML help Workshop does work in Windows (e.g. Vista) and does not in Windows 7. Some tips?? We don't use the HTML Help Workshop any more since R 2.10.0, so you could upgrade to the current R, and the problem will go away. Otherwise, I think you'll have to ask Microsoft for help. But they aren't likely to be helpful: Win XP is the most recent OS listed as supported. 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] How to extract one of four plots in a linear regression model
Hi, You can extract a plot in using the option which in specifying the number of the plot (from 1 to 6). For example: plot(lm.D9, which=1) Regards, Alain Guillet On 25-Feb-10 16:50, FMH wrote: Dear All, A linear regression model could be fitted by using lm function and the plot function can be used to check the assumption of the model. The help menu shows few instances on suitable coding for fitting such a linear model. In addition, four different plots could be extracted simultaneously with only a single plot function as followed: require(graphics) ## Annette Dobson (1990) An Introduction to Generalized Linear Models. ## Page 9: Plant Weight Data. ctl- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group- gl(2,10,20, labels=c(Ctl,Trt)) weight- c(ctl, trt) anova(lm.D9- lm(weight ~ group)) opar- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) plot(lm.D9, las = 1) The plot function gives four different plots simulaneously but i just need only part of them, for instance the normality plot. Could someone give some ideas the way to extract this single plot as i need to copy only this plot and paste it into Word document. Thanks Fir __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Alain Guillet Statistician and Computer Scientist SMCS - Institut de statistique - Université catholique de Louvain Bureau c.316 Voie du Roman Pays, 20 B-1348 Louvain-la-Neuve Belgium tel: +32 10 47 30 50 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] data mining
It depends on what you want to do. Start by looking at: http://cran.r-project.org/web/views/ http://cran.r-project.org/web/views/There are also some nice startup tutorials on google, start from that... Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Thu, Feb 25, 2010 at 1:32 PM, chinna durgache...@gmail.com wrote: how can we achieve data mining using R Project. how to install Rattle gui for R project. can anyone please help me. i want to forecast the results . Thanks in advance. -- View this message in context: http://n4.nabble.com/data-mining-tp1568872p1568872.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Odp: export results
If your data can fit in memory, consider creating a list of the intermediate values and then 'cbind'ing the result into a matrix that you want to write out. result - lapply(1:100, function(x) your function ) # if everything is the same size result - do.call(cbind, result) On Thu, Feb 25, 2010 at 10:44 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi r-help-boun...@r-project.org napsal dne 25.02.2010 12:42:46: Hi all, I am looping through a function for 100 time in the middle of my code, and I want to output the results from this function. Is there a way to write the results into a txt or csv fil? For example, I write the results from the first loop to the first column of a spreadsheet and the results from the second loop to the second coclumn of a spreadsheet etc. make a data frame, let say res res=as.data.frame(matrix(NA, n, 100)) #predefine data frame for (i in ...) { some stuff res[,i] - some function result } write.table(res,) Regards Petr Thank you very much, Wendy -- View this message in context: http://n4.nabble.com/export-results-tp1568880p1568880.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that 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] Use 2 ifelse to sort data
There is the %% operator in the TeachingDemos package that allows comparisons like: 5 %% a %% 10 But in this case it is not needed (and in this case it takes more key strokes than 5 a a 5, so may not be worth it). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of bill.venab...@csiro.au Sent: Monday, February 22, 2010 8:55 PM To: tu_chun...@yahoo.com; r-help@r-project.org Subject: Re: [R] Use 2 ifelse to sort data a - 1:20 tt - ifelse(a 10, A, ifelse(a 5, B, C)) The problem you have is with '5 a = 10'. Such double sided inequalities are used in mathematics but not in R. Here you only need the first part, but if you did need both you would need to write 5 a a = 10 Look carefully and spot the difference. Bill Venables CSIRO/CMIS Cleveland Laboratories -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Chunhao Sent: Tuesday, 23 February 2010 12:13 PM To: r-help@r-project.org Subject: [R] Use 2 ifelse to sort data Dear R users, I have a question how to use 2 ifelse to sort my data. Such as from 11 to 20 assign to A; 6 to 10 assign to B, and the rest of them assign to C a-1:20 tt-ifelse(a10, A,no=ifelse( 5 a =10, B, C)) Many Thanks Chunhao -- View this message in context: http://n4.nabble.com/Use-2-ifelse-to- sort-data-tp1565422p1565422.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Normal distribution (Lillie.test())
You should probably read fortune(117) and fortune(234) (and possibly some of the original discussions that lead to the fortunes). Reading the help page for the SnowsPenultimateNormalityTest function (TeachingDemos package) may also help. If you are happy with the plots, but still feel the need for a test of some sort, then you should investigate using the vis.test function in the TeachingDemos package. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Bosken Sent: Tuesday, February 23, 2010 4:13 AM To: r-help@r-project.org Subject: Re: [R] Normal distribution (Lillie.test()) Hi, Thanks for your reaction; How do you come to the decision that my data not is normal distributed? With the 69-95-99.7 test and Q-Q plot seems it ok! But these test are not exact, they only give you an image. Gr. Bosken -- View this message in context: http://n4.nabble.com/Normal-distribution- Lillie-test-tp1565083p1565762.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] error in lmLists in lme4 package (bug?)
Hello, I am trying to use lmLists in the lme4 package and copying over very standard code from the nlme package given in 'Mixed-Effects Models in S and S-Plus'. It appears to not accept an 'I(age-11)' in the formula, though it will accept the formula with out the subtraction of 11 from age. This seems like it would be a bug, since this is standard formula syntax, unless I'm missing something about lmList in lme4. Please see my session info and output below. Thanks for your help, Elizabeth library(lme4) data(Orthodont) sessionInfo() R version 2.10.0 (2009-10-26) x86_64-apple-darwin9.8.0 locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] MEMSS_0.3-6lme4_0.999375-32 Matrix_0.999375-31 lattice_0.17-26 loaded via a namespace (and not attached): [1] grid_2.10.0 tools_2.10.0 fm1Orth.lis-lmList(distance~age|Subject, data=Orthodont) fm2Orth.lis-lmList(distance~I(age-11)|Subject, data=Orthodont) Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found Error in unique(c(AsIs, oldClass(x))) : object 'age' not found __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Reading a password-protected Excel workbook
Use RDCOMClient or rcom to open it and then use RODBC to read it. On Thu, Feb 25, 2010 at 7:26 AM, Dimitri Shvorob dimitri.shvo...@gmail.com wrote: I try reading a password-protected spreadsheet with RODBC, passing a file or an ODBC source to odbcConnect, e.g. con = odbcConnect(dsn = mywkbk, uid = , pwd = mypwd) but get Could not decrypt file pop-up error message. Can anyone help? Thank you. -- View this message in context: http://n4.nabble.com/Reading-a-password-protected-Excel-workbook-tp1568925p1568925.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Single character input without Enter
The getGraphicsEvent function only works on windows (at least last time I checked), so if you are working only on windows, you can use that. If you want something that works cross platform, then the tcltk solution is a possibility. Your original question did not indicate if you would be willing to have this working through a graph or not, so I was not sure if this was a good solution or not. I would have told you this on Monday, but I was out of town the first part of the week and not reading r-help. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Dieter Menne Sent: Thursday, February 25, 2010 11:29 AM To: r-help@r-project.org Subject: Re: [R] Single character input without Enter Greg Snow-2 wrote: The playSudoku function in the sudoku package has 2 examples/methods of responding to single key strokes, whether those methods will work for your application or not depends on what you are trying to do. Thanks, Greg, it boils down to the rather basic getGraphicsEvent(prompt = Waiting for input, onMouseDown = NULL, onMouseMove = NULL, onMouseUp = NULL, onKeybd = NULL) in grDevices; so no tclk needed. Strange that nobody told me Dieter -- View this message in context: http://n4.nabble.com/Single-character- input-without-Enter-tp1564153p1569460.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Normal distribution (Lillie.test())
Install and load the fortunes package first, then run fortune(117), etc. Then run fortune() quite a few times for possible enlightenment (or at least mild entertainment). Do your NoiseGenerotors need to generate exactly normal data (they don't, see SnowsPenultimateNormalityTest), or is there a level of close enough? If I remember correctly, you were testing 2000 values, with that sample size most normality tests will find very small differences to be significantly different, even if those small differences are practically meaningless. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Bosken Sent: Thursday, February 25, 2010 10:21 AM To: r-help@r-project.org Subject: Re: [R] Normal distribution (Lillie.test()) Hi, Thanks for your reaction. The purpose of my test is to check if my NoiseGenerators really are Normal Distributed en witch circuit is the best! So I need some good test to do this. But what with: Fortune(117) and fortune(234), can't find anything about it.. Thanks for the help! Bosken -- View this message in context: http://n4.nabble.com/Normal-distribution- Lillie-test-tp1565083p1569361.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Normal distribution (Lillie.test())
May be you should have said: Normality tests are standard farce in a host of statistical texts. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h tml -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter Sent: Thursday, February 25, 2010 12:24 PM To: 'Greg Snow'; 'Bosken'; r-help@r-project.org Subject: Re: [R] Normal distribution (Lillie.test()) ... But,quoting Pogo, We have met the enemy, and he is us. Normality tests are standard fare in a host of statistical texts. Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Greg Snow Sent: Thursday, February 25, 2010 9:00 AM To: Bosken; r-help@r-project.org Subject: Re: [R] Normal distribution (Lillie.test()) You should probably read fortune(117) and fortune(234) (and possibly some of the original discussions that lead to the fortunes). Reading the help page for the SnowsPenultimateNormalityTest function (TeachingDemos package) may also help. If you are happy with the plots, but still feel the need for a test of some sort, then you should investigate using the vis.test function in the TeachingDemos package. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Bosken Sent: Tuesday, February 23, 2010 4:13 AM To: r-help@r-project.org Subject: Re: [R] Normal distribution (Lillie.test()) Hi, Thanks for your reaction; How do you come to the decision that my data not is normal distributed? With the 69-95-99.7 test and Q-Q plot seems it ok! But these test are not exact, they only give you an image. Gr. Bosken -- View this message in context: http://n4.nabble.com/Normal-distribution- Lillie-test-tp1565083p1565762.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] two questions for R beginners
I started using statistical software with the commercial product S+ when I obtained a new HP735 workstation. We kept the S+ license going for a number of years until I heard about R. It was an easy transition and because I have been proficient in fortran and perl, the scripting came naturally--except for some syntax similarities/differences between perl and R interacting with a natural tendency towards dyslexia. I especially like that I can slice and dice the data to ferret out relationships e.g., concentration by hour of day, by month, by wind speed, by wind direction--love those boxplots. I also find that even the default settings produce some pretty attractive plots that are useable in many settings--I've also produced some pretty awful ones. And the price always reminds me that I need to find every way possible to contribute to the overall good--I've forgotten too much of my fortran and C programming skills to contribute directly to the R Project. Clint -- Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 407-6815 PO Box 47600FAX:(360) 407-7534 Olympia, WA 98504-7600 On Thu, 25 Feb 2010, Ralf B wrote: My biggest blocker was my misconception that R is extremely difficult to start with. It is powerful and one can do very complicated things ( that consequently turn things complicated) but it comes with very nice defaults and one can produce great results with standard tasks in very little time - especially if one has done programming and/or scripting before. I pushed it away for too long that way. I wish I would have used it years ago and avoided SPSS altogether - must have wasted 100s of hours doing repetitive tasks by click and partial scripts in SPSS. Not to mention a horrible license policy and a visualization unit that is simply embarrassing for a product that is in its 18th or 19th version. Ralf On Thu, Feb 25, 2010 at 1:11 PM, Tal Galili tal.gal...@gmail.com wrote: My biggest stumbling blocks to getting up and running with R was whenever I was lazy and impatient. The more you love R, the more it loves you back. Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Thu, Feb 25, 2010 at 7:31 PM, Patrick Burns pbu...@pburns.seanet.comwrote: * What were your biggest misconceptions or stumbling blocks to getting up and running with R? * What documents helped you the most in this initial phase? I especially want to hear from people who are lazy and impatient. Feel free to write to me off-list. Definitely write off-list if you are just confirming what has been said on-list. -- Patrick Burns pbu...@pburns.seanet.com http://www.burns-stat.com (home of 'The R Inferno' and 'A Guide for the Unwilling S User') __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Bimodal distribution
You could use: library(TeachingDemos) x - c(rnorm(1000,0,1),rnorm(1000,3,1)) TeachingDemos:::vis.test( x, TeachingDemos:::vt.normhist ) Then click on the plot that looks most different. Sorry about needing TeachingDemos::: for now, the functions were accidentally left out of the NAMESPACE file, this has been fixed and will not be needed for version 2.6 on. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Samor Gandhi Sent: Wednesday, February 24, 2010 5:23 AM To: r-help@r-project.org Subject: [R] Bimodal distribution Hello, Is there any test for bimodality in R that x - c(rnorm(1000,0,1),rnorm(1000,3,1)) hist(x,nclass=100) Thank you in advance for any help. Regards, Samor [[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] Building R packages in Windows 7
On 25/02/2010 11:49 AM, Eric Ferreira wrote: Ok, I'm working under: Windows 7 Professional 32bits, 4 GB RAM, 320 GB HD, Intel Core 2 Duo processor R 2.10.1 I've installed: Rtools211 MikteX 2.8 HTML Help Workshop Setting my PATH to: c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin;c:\Arquivos de Programas\R\R-2.10.1pat\bin;c:\Arquivos de Programas\MikTeX 2.8\miktex\bin;c:\Program Files\HTML Help Workshop ...creating the package called ExpDes and asking (at the prompt) : Rcmd build --binary ExpDes Among others, a warning message is printed: WARNING: some HTML links may not be found, and no html files are produced. Right, HTML help files are produced on demand, they aren`t stored in the binary package zip file. HTML Help Workshop is not being used at all. Duncan Murdoch Thank you again. On 25 February 2010 13:02, Duncan Murdoch murd...@stats.uwo.ca wrote: On 25/02/2010 10:56 AM, Eric Ferreira wrote: This is my first package. I'm just getting started doing that, following the steps described on you website... I really don't know how I asking for CHMs to be produced, sorry. All I can suggest is that you need to be less stingy with information. Tell us what you did. Tell us what symptoms you saw. Do both of those by cut and paste from your console, don't paraphrase, or refer to vague instructions like your website. Duncan Murdoch On 25 February 2010 12:52, Duncan Murdoch murd...@stats.uwo.ca wrote: On 25/02/2010 10:40 AM, Eric Ferreira wrote: Dear Duncan Thank so much for your reply. Actually, I'm using the latest version of R and the problem persists. What do you use instead of HTML Help Workshop for newer R versions? We just produce text and HTML help pages on demand, and LaTeX ones for the pdf manuals. How are you asking for CHMs to be produced? Duncan Murdoch Best regards Eric. On 25 February 2010 11:43, Duncan Murdoch murd...@stats.uwo.ca wrote: On 25/02/2010 9:06 AM, Eric Ferreira wrote: Dear useRs, I'm having trouble building R packages in Windows 7 regarding HTML help Workshop. Pointing PATH to c:\Program Files\HTML help Workshop does work in Windows (e.g. Vista) and does not in Windows 7. Some tips?? We don't use the HTML Help Workshop any more since R 2.10.0, so you could upgrade to the current R, and the problem will go away. Otherwise, I think you'll have to ask Microsoft for help. But they aren't likely to be helpful: Win XP is the most recent OS listed as supported. 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] angle phase mapping
Look at the my.symbols function in the TeachingDemos package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Magali teurlai Sent: Thursday, February 25, 2010 3:51 AM To: r-help@r-project.org Subject: Re: [R] angle phase mapping Hi all, sorry, here is the pdf and I re post my question : could anyone give me a clue for the name of a function that would allow me to create the same kind of plot as the attached image in R? I know how to create a map (shapefile polygons), I just want to add the phase information as triangles , pointing in the direction according to the phase, and the colors of the triangle describing as well the phase I will have a vector of phases : one scalr (the phase) per polygon plotted on the map Thanks very much for any help Magali 2010/2/25 Magali teurlai teurlaima...@gmail.com Hi all, could anyone give me a clue for the name of a function that would allow me create the same kind of plot as the attached image in R? I know how to create a map (shapfile polygons), I just want to add the phase information Thanks very much for any help Magali __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Minimum Spanning Trees
Hi, On Thu, Feb 25, 2010 at 12:16 PM, harunpirim harunpi...@gmail.com wrote: Hi, I need to find all minimum spanning trees of an unweighted graph. Is there a way in R to do that? If you're working with graphs in R, you'll probably want to see what the igraph library has to offer. For instance, it has a minimum.spanning.tree function ... -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] read.table (trying one more time)
Hey listers, I've posted this doubt other day... But I am still having a hard time... I have a MAC and I am not getting how to use the read.table command... At the bottom of the FINDER application I have the following path: Macintosh HDUsuáriosUserMarcioUdeMTravail DirigéDataMU284 Population.txt I didn't find out how I could copy and paste this path as it is possible to do with the Windows. But, it's ok, cause I am trying the following command with all possible choices, as below: file-read.table(/User/Marcio/UdeM/Travail Dirigé/Data/MU284 Population.txt,header=T,skip=24) file-read.table(/Users/Marcio/UdeM/Travail Dirigé/Data/MU284 Population.txt,header=T,skip=24) file-read.table(/Usuários/User/Marcio/UdeM/Travail Dirigé/Data/MU284 Population.txt,header=T,skip=24) file-read.table(/Usuários/Users/Marcio/UdeM/Travail Dirigé/Data/MU284 Population.txt,header=T,skip=24) I've checked already the forum and I found a similar post that says to use the command with the following path: /Users/Marcio/UdeM/Travail Dirigé/Data/MU284 Population.txt But at the bottom of the FINDER application is just USER. Anyway I tried those options and other... But didn't work... If anybody could give me a clue... THANKS A LOT!!! Marcio -- View this message in context: http://n4.nabble.com/read-table-trying-one-more-time-tp1569653p1569653.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with simple bootstrap test
The boot() function in the 'boot' package expects to find a function for the statistic with two arguments: The data object plus a row index object. You don't indicate enough to see how you will be resampling. It you sum all elements in your table, resampling would have to be one of: 1. A sample with replacement of rows, or 2. A sample with replacement of columns, or 3. A sample with replacement of elements in the whole table. Assuming you want sampling with replacement of rows: sumf- function (x, i) { sum(x[i,]) } result- boot(mytable, sumf, 1000) boot.ci(result, type='bca') A simulation: mytable- matrix(rnorm(2000), ncol=20) sum(mytable) [1] -14.92842 sumf- function(x,i) sum(x[i,]) require('boot') Loading required package: boot b1- boot(mytable, sumf, 1000) boot.ci(b1, type='bca') BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS Based on 1000 bootstrap replicates CALL : boot.ci(boot.out = b1, type = bca) Intervals : Level BCa 95% (-101.49, 85.20 ) Calculations and Intervals on Original Scale At 01:28 PM 2/25/2010, xonix wrote: Hi all Forgive me, I'm a total R newbie, and this seems to be a straightforward simple bootstrap problem, but after a whole day of trying to figure out how to do it I'm ready to give up. Part of the problem is that every example and every help page seems to be about doing something more far more complex. I'm got a table with 40 columns and 750 rows. I sum all the values across the whole table (and subsets of the columns). I want to bootstrap to get the 95% confidence intervals for that sum value. result - boot(table, function, 1000) boot.ci (result, bca) It seems to me that the 'function' is something to sum all the columns and rows of the table (or a subset should I desire). I've tried writing 'sum' for the function, but this gives me a huge figure which can't possibly be right. Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail: r...@lcfltd.com Least Cost Formulations, Ltd.URL: http://lcfltd.com/ 824 Timberlake Drive Tel: 757-467-0954 Virginia Beach, VA 23464-3239Fax: 757-467-2947 Vere scire est per causas scire __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] two questions for R beginners
Apparently I need to explain the lazy and impatient comment. No offence was intended (quite the contrary). The meaning of it is that the higher your level of frustration, the more valuable your comments are likely to be to me. On 25/02/2010 17:31, Patrick Burns wrote: * What were your biggest misconceptions or stumbling blocks to getting up and running with R? * What documents helped you the most in this initial phase? I especially want to hear from people who are lazy and impatient. Feel free to write to me off-list. Definitely write off-list if you are just confirming what has been said on-list. -- Patrick Burns pbu...@pburns.seanet.com http://www.burns-stat.com (home of 'The R Inferno' and 'A Guide for the Unwilling S User') __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] two questions for R beginners
On 2/25/10, Patrick Burns pbu...@pburns.seanet.com wrote: * What were your biggest misconceptions or stumbling blocks to getting up and running with R? * What documents helped you the most in this initial phase? I especially want to hear from people who are lazy and impatient. I'm quite resilient so I don't think I got to the point of frustration, but getting up to speed was a lengthy process. The biggest stumbler was getting onto the console, and not knowing what to do next. (My first encounter with stats was SPSS, so it was similar to getting onto a UNIX virtual console after a life-long experience with point-and-click windows: it's not very reassuring to know that there are man pages.) I stayed in the what-do-I-do-next state of mind for about 6-12 months (I learned R myself, and my professors were quite reticent when I first introduced them to R). Of particular help to making progress were JGR (arguments suggestions, editor with syntax highlighting, object browser, etc.), Rcmdr (quick access to examples for performing specific tasks, etc.) and Sweave + LyX (for easy results transfer and report creation, without the burden of learning LaTeX). For graphics, playwith latticist and rggobi come in very handy. From the documentation, right now I can recall Quick-R and R for SAS and SPSS users. And of course, RSiteSearch (also via the sos package), Rseek and the vignettes are a must. Regards Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] nested design
This is a nested design where team is nested in group. Method is fixed, while team and group are random. Is this the correct R code for this? gunload.aov - aov(rounds ~ method+group + Error((team %in% group)/method),data=gunload, qr=T) -- View this message in context: http://n4.nabble.com/nested-design-tp1569449p1569449.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Minimum Spanning Trees
Hi, I need to find all minimum spanning trees of an unweighted graph. Is there a way in R to do that? Thanks -- View this message in context: http://n4.nabble.com/Minimum-Spanning-Trees-tp1569351p1569351.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] two questions for R beginners
Patrick, I would add one more question: * where did you look for help expecting answers, but did not find them? If you add hubris to laziness and impatience, you have Larry Wall's 3 virtues of a programmer. To new users of R who may not understand why Patrick is asking: Patrick Burns is the author of some great tutorials/references on S/R and is probably looking for questions to answer in his next contribution. Lately there have been a large number of questions on some fairly basic issues (and some rather complex issues that people expected to be simple/basic). My initial response (and probably others as well) to some of these requests was to quickly think that the answer is obvious and that the obvious place to look is ..., but then I realize that I am a high school dropout who has been using S/R for over 20 years, majored in statistics but reads Shakespeare for fun, and have been known to saw people in half for the entertainment of others; so I am probably not representative of most beginners. Fortune(89) probably applies here. If R beginners will share their frustrations, where they looked but did not find answers (and why they looked there), what would have helped them, etc. Then we (well probably Patrick mostly) can do more to help the next set of beginners. It does not matter how good our answers are if they answer the wrong questions or are in places that the questioner never sees them. The best way to spread information is to tell someone that it is a secret, the best way to keep it secret is to put it in a manual. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Patrick Burns Sent: Thursday, February 25, 2010 10:31 AM To: r-help@r-project.org Subject: [R] two questions for R beginners * What were your biggest misconceptions or stumbling blocks to getting up and running with R? * What documents helped you the most in this initial phase? I especially want to hear from people who are lazy and impatient. Feel free to write to me off-list. Definitely write off-list if you are just confirming what has been said on-list. -- Patrick Burns pbu...@pburns.seanet.com http://www.burns-stat.com (home of 'The R Inferno' and 'A Guide for the Unwilling S User') __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] How to add a title to represent four different plot in lm function
Try something like: par(oma=c(0,0,3,0)) your plotting commands here mtext(your text here, outer=TRUE Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of FMH Sent: Thursday, February 25, 2010 9:01 AM To: r-help@r-project.org Cc: r-sig...@stat.math.ethz.ch Subject: [R] How to add a title to represent four different plot in lm function Dear All, A linear regression model could be fitted by using lm function and the plot function can be used to check the assumptions of the model. The example is as followed. require(graphics) ## Annette Dobson (1990) An Introduction to Generalized Linear Models. ## Page 9: Plant Weight Data. ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) anova(lm.D9 - lm(weight ~ group)) opar - par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) plot(lm.D9, las = 1) Could someone advice me the way to add a single title either at the above or bottom of these 4 plots, entitled The verification of model assumtion via four different plots ? Thanks Fir __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] How to fill in a region with different patterns?
The rect function will draw a rectangle and can fill it with diagonal lines at specified angle and density. But before you do that, really consider if and why you want to. Using the diagonal lines became popular when the only way to get quality graphics was with a pen plotter (mechanical arm actually drawing the plot with a pen), filling an area was not reasonable (you could use a really high density of lines, but that usually made you unpopular with everyone else waiting for their turns, and often just wore a hole in your paper). Research has shown (see Tufte's book) that patterns of lines are not the best approach, they can produce what is called the Moire effect which gives an illusion of color and movement. These pattern fills are better at producing headaches and nausea and less effective at conveying information and producing useful plots. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of St.Jeff Shang Sent: Wednesday, February 24, 2010 8:34 PM To: r-help@r-project.org Subject: [R] How to fill in a region with different patterns? Hi to all, Here is a question which I cannot solve. Appreciate so much for any suggestions! I have a squared region which is irregularly divided into many rectangular patches. Each patch is associated with a value, and two patches possibly share a common value. I hope to fill in each patch a pattern according to its value. For instance, if a patch has value 1, then I fill in that patch with pattern A; if it has value 2, then fill in it with pattern B,... The pattern is something like a rectangular region with certain colored lines in it. For instance, pattern A may be a white rectangular region filled in by two thick black lines; pattern B may be a white rectagular region filled in by 10 thick black lines,... Is this available in matlab? I have serached polygnon in matlab user guide and found a fill function may work, however, there is still a long way to finally complete it. Many thanks again! Jeff [[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] Single character input without Enter
Greg Snow-2 wrote: The playSudoku function in the sudoku package has 2 examples/methods of responding to single key strokes, whether those methods will work for your application or not depends on what you are trying to do. Thanks, Greg, it boils down to the rather basic getGraphicsEvent(prompt = Waiting for input, onMouseDown = NULL, onMouseMove = NULL, onMouseUp = NULL, onKeybd = NULL) in grDevices; so no tclk needed. Strange that nobody told me Dieter -- View this message in context: http://n4.nabble.com/Single-character-input-without-Enter-tp1564153p1569460.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Inverse function
?uniroot -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of li li Sent: Wednesday, February 24, 2010 2:31 PM To: Bert Gunter Cc: r-help Subject: Re: [R] Inverse function This is not a homework problem. How to solve numerically for y from f(y,r) - a=g(y)=0? I am not too sure. Thanks! Hannah 2010/2/24 Bert Gunter gunter.ber...@gene.com 1. Is this a homework problem? 2. Etiquette on this list is to sign with your full real name. Adhering to the list etiquette may enhance your chance of a useful response, especially in view of (1), as we (or at least some of us) do not wish to do students' homework for them. 3. Hint: f(y,r) = a == g(y) = 0 where g(y) == f(y,r) - a (for numerical solutions). Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of li li Sent: Wednesday, February 24, 2010 12:46 PM To: r-help Subject: [R] Inverse function Hi all, I have a function like the following: f - function(r, y){r/(2*pi)*exp(1)^(-y)*(1+r*(y/2)+r^(2)*(y-1)^(2)/6)} For fixed r, I want to find the inverse funtion in terms y. In other words, for fixed r, if the value of the function is given, I want to find the corrsponding y value that will achieve the specific function value. Can anyone help me? Hannah [[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.htmlhttp://www.r- project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Normal distribution (Lillie.test())
Hi, Thanks for your reaction. The purpose of my test is to check if my NoiseGenerators really are Normal Distributed en witch circuit is the best! So I need some good test to do this. But what with: Fortune(117) and fortune(234), can't find anything about it.. Thanks for the help! Bosken -- View this message in context: http://n4.nabble.com/Normal-distribution-Lillie-test-tp1565083p1569361.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Restructure some data
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Doran, Harold Sent: Thursday, February 25, 2010 10:35 AM To: r-help@r-project.org Subject: [R] Restructure some data Suppose I have a data frame like dat below. For some context, this is the format that represents student's taking a computer adaptive test. first.item is the first item that student was administered and then score.1 is the student's response to that item and so forth. item.pool - paste(item, 1:10, sep = ) set.seed(54321) dat - data.frame(id = c(1,2,3,4,5), first.item = sample(item.pool, 5, replace=TRUE), second.item = sample(item.pool, 5,replace=TRUE), third.item = sample(item.pool, 5,replace=TRUE), score1 = sample(c(0,1), 5,replace=TRUE), score2 = sample(c(0,1), 5,replace=TRUE), score3 = sample(c(0,1), 5,replace=TRUE)) I need to restructure this into a new format. The new matrix df (after the loop) is exactly what I want in the end. But, I'm annoyed at myself for not thinking of a more efficient way to restructure this without using a loop. df - matrix(NA, ncol = length(item.pool), nrow = nrow(dat)) colnames(df) - unique(item.pool) for(i in 1:5){ for(j in 2:4){ rr - which(dat[i,j] == colnames(df)) df[i,rr] - dat[i, (j+3)] } } Any thoughts? You can try subscripting by a 2-column matrix, the first giving the row index and the second the column index. E.g., f - function(dat) { allItems - paste(item, 1:10, sep = ) items - as.matrix(dat[2:4]) scores - as.matrix(dat[, 5:7]) retval - matrix(NA_real_, nrow = nrow(dat), ncol = 10, dimnames = list(character(), allItems)) retval[cbind(dat$id, match(items, allItems))] - scores retval } identical(f(dat), df) [1] TRUE That was a very nice problem description, letting me reproduce the example data and desired output with just copy and paste. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com Harold [[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] Help with simple bootstrap test
Hi all Forgive me, I'm a total R newbie, and this seems to be a straightforward simple bootstrap problem, but after a whole day of trying to figure out how to do it I'm ready to give up. Part of the problem is that every example and every help page seems to be about doing something more far more complex. I'm got a table with 40 columns and 750 rows. I sum all the values across the whole table (and subsets of the columns). I want to bootstrap to get the 95% confidence intervals for that sum value. result - boot(table, function, 1000) boot.ci (result, bca) It seems to me that the 'function' is something to sum all the columns and rows of the table (or a subset should I desire). I've tried writing 'sum' for the function, but this gives me a huge figure which can't possibly be right. Thanks, -- View this message in context: http://n4.nabble.com/Help-with-simple-bootstrap-test-tp1569459p1569459.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Odp: How to read percentage and currency data?
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Hrishi Mittal Sent: Wednesday, February 24, 2010 8:56 AM To: r-help@r-project.org Subject: Re: [R] Odp: How to read percentage and currency data? [snip] It's a shame that something which Excel deals with trivially is such a hack in R. I believe that this is a consequence of a fundamental difference in the philosophies of the authors of R and the authors of MS Excel. The authors of R assume that their users are intelligent and have a greater understanding of their own data than the authors do. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Alternatives to linear regression with multiple variables
Well, the help page for the loess function says that the formula can include up to 4 predictor variables. There are also additive models (mgcv or gam (or other) package). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Guy Green Sent: Monday, February 22, 2010 5:47 AM To: r-help@r-project.org Subject: [R] Alternatives to linear regression with multiple variables I wonder if someone can give some pointers on alternatives to linear regression (e.g. Loess) when dealing with multiple variables. Taking any simple table with three variables, you can very easily get the intercept and coefficients with: summary(lm(read_table)) For obvious reasons, the coefficients in a multiple regression are quite different from what you get if you calculate regressions for the single variables separately. Alternative approaches such as Loess seem straightforward when you have only one variable, and have the advantage that they can cope even if the relationship is not linear. My question is: how can you extend a flexible approach like Loess to a multi-variable scenario? I assume that any non-parametric calculation becomes very resource-intensive very quickly. Can anyone suggest alternatives (preferably R-based) that cope with multiple variables, even when the relationship (linear, etc) is not known in advance? Thanks, Guy -- View this message in context: http://n4.nabble.com/Alternatives-to- linear-regression-with-multiple-variables-tp1564370p1564370.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Linear models interaction
My data looks like following: cera3[i, ] batch lcl29 pdt Untreated 3.185867 1 0 0 Untreated.4 3.185867 0 0 0 LCL29 4.357552 1 1 0 LCL29.6 3.446256 0 1 0 PDT 2.765535 1 0 1 PDT.5 3.584963 0 0 1 PDT+LCL29.1 2.867896 1 1 1 PDT+LCL29.3 2.827819 0 1 1 As you can see there are three factorls batch , lcl29 and pdt. I am trying to fit the model: Y = batch +pdt*lcl29. I get the following coefficients: Estimate Std. Errort value Pr(|t|) (Intercept) 3.1524122 0.2487796 12.6715049 1.242191e-12 batch1 -0.2267947 0.2291590 -0.9896827 3.314508e-01 lcl291 0.6350186 0.3122910 2.0334194 5.233525e-02 pdt1 0.1046388 0.3122910 0.3350684 7.402619e-01 lcl291:pdt1 -0.6633316 0.4521381 -1.4670995 1.543419e-01 I know that the coef. of lcl291 i.e 0.635 is difference in means between rows with lcl29 present alone and untreated ones. Same is true for the coef of PDT1. However I am not sure about the coefficient of lcl291:pdt1. where does this value come from? How is it calculated? what does it tell? Is it Interaction versus all the rest because it is certailnly not interaction versus untreated? Thank You -- View this message in context: http://n4.nabble.com/Linear-models-interaction-tp1569497p1569497.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to fill in a region with different patterns?
Hi, If you are curious you might like to try a highly experimental Grid function I wrote some time ago, library(grid) source(http://gridextra.googlecode.com/svn/trunk/R/patternGrob.r;) grid.newpage() grid.pattern(x=seq(1/6, 5/6, length=6), width=unit(1/8,npc), height=unit(0.5,npc), motif.width=unit(10, mm), pattern=c(1:6), orientation=45, motif.alpha=0.5, motif.cex=c(1, 0.5), motif.col=1:2, motif.fill=NA, gp=gpar(fill=blue, lwd=2, alpha=0.5), clip=T) If you really insist on using shading patterns despite Greg's sound advice, it might give you some inspiration. HTH, baptiste On 25 February 2010 04:34, St.Jeff Shang mathsh...@yahoo.com wrote: Hi to all, Here is a question which I cannot solve. Appreciate so much for any suggestions! I have a squared region which is irregularly divided into many rectangular patches. Each patch is associated with a value, and two patches possibly share a common value. I hope to fill in each patch a pattern according to its value. For instance, if a patch has value 1, then I fill in that patch with pattern A; if it has value 2, then fill in it with pattern B,... The pattern is something like a rectangular region with certain colored lines in it. For instance, pattern A may be a white rectangular region filled in by two thick black lines; pattern B may be a white rectagular region filled in by 10 thick black lines,... Is this available in matlab? I have serached polygnon in matlab user guide and found a fill function may work, however, there is still a long way to finally complete it. Many thanks again! Jeff [[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. -- Baptiste Auguié Departamento de Química Física, Universidade de Vigo, Campus Universitario, 36310, Vigo, Spain tel: +34 9868 18617 http://webs.uvigo.es/coloides __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] read.table (trying one more time)
On Feb 25, 2010, at 3:10 PM, Mestat wrote: Hey listers, I've posted this doubt other day... But I am still having a hard time... I have a MAC and I am not getting how to use the read.table command... At the bottom of the FINDER application I have the following path: Macintosh HDUsuáriosUserMarcioUdeMTravail DirigéDataMU284 Population.txt I didn't find out how I could copy and paste this path as it is possible to do with the Windows. But, it's ok, cause I am trying the following command with all possible choices, as below: file-read.table(/User/Marcio/UdeM/Travail Dirigé/Data/MU284 Population.txt,header=T,skip=24) file-read.table(/Users/Marcio/UdeM/Travail Dirigé/Data/MU284 Population.txt,header=T,skip=24) file-read.table(/Usuários/User/Marcio/UdeM/Travail Dirigé/Data/MU284 Population.txt,header=T,skip=24) file-read.table(/Usuários/Users/Marcio/UdeM/Travail Dirigé/Data/ MU284 Population.txt,header=T,skip=24) I've checked already the forum and I found a similar post that says to use the command with the following path: /Users/Marcio/UdeM/Travail Dirigé/Data/MU284 Population.txt But at the bottom of the FINDER application is just USER. Anyway I tried those options and other... But didn't work... If anybody could give me a clue... THANKS A LOT!!! Two choices (and in any case, don't call your input dataframe just file, although that is probably not why you are having problems): option 1) Type in: file_inp -read.table(,header=T,skip=24) ### then click-hold-drag the file from a Finder window to the R console until the cursor bar is between the two quotes, then release- click. optiuon 2) file_inp-read.table(file=file.choose(),header=T,skip=24) ## and then navigate to the location of your file using the Mac File Chooser window. And in the future, such questions should go to the Mac-SIG list. -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Restructure some data
Suppose I have a data frame like dat below. For some context, this is the format that represents student's taking a computer adaptive test. first.item is the first item that student was administered and then score.1 is the student's response to that item and so forth. item.pool - paste(item, 1:10, sep = ) set.seed(54321) dat - data.frame(id = c(1,2,3,4,5), first.item = sample(item.pool, 5, replace=TRUE), second.item = sample(item.pool, 5,replace=TRUE), third.item = sample(item.pool, 5,replace=TRUE), score1 = sample(c(0,1), 5,replace=TRUE), score2 = sample(c(0,1), 5,replace=TRUE), score3 = sample(c(0,1), 5,replace=TRUE)) I need to restructure this into a new format. The new matrix df (after the loop) is exactly what I want in the end. But, I'm annoyed at myself for not thinking of a more efficient way to restructure this without using a loop. df - matrix(NA, ncol = length(item.pool), nrow = nrow(dat)) colnames(df) - unique(item.pool) for(i in 1:5){ for(j in 2:4){ rr - which(dat[i,j] == colnames(df)) df[i,rr] - dat[i, (j+3)] } } Any thoughts? Harold [[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 to add a title to represent four different plot in lm function
Hi there, Try this: par(mfrow=c(2,2)) for( i in 1:4 ) plot(1:10) mtext(Title,side=3,outer=TRUE,padj=3) Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Thu, Feb 25, 2010 at 10:43 PM, Greg Snow greg.s...@imail.org wrote: Try something like: par(oma=c(0,0,3,0)) your plotting commands here mtext(your text here, outer=TRUE Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of FMH Sent: Thursday, February 25, 2010 9:01 AM To: r-help@r-project.org Cc: r-sig...@stat.math.ethz.ch Subject: [R] How to add a title to represent four different plot in lm function Dear All, A linear regression model could be fitted by using lm function and the plot function can be used to check the assumptions of the model. The example is as followed. require(graphics) ## Annette Dobson (1990) An Introduction to Generalized Linear Models. ## Page 9: Plant Weight Data. ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) anova(lm.D9 - lm(weight ~ group)) opar - par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) plot(lm.D9, las = 1) Could someone advice me the way to add a single title either at the above or bottom of these 4 plots, entitled The verification of model assumtion via four different plots ? Thanks Fir __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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. [[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.