Re: [R] categorical data analysis - fisher.exact for 2x2 and greater
Hi Simon and all, I'm pretty sure that you are correct about this. I think it is a misconception to say that the fisher exact test is only for a 2 by 2 table. It is presented that way in textbooks because, for a 2x2 table, it is easy to perform. For larger tables, it becomes complex quickly due to the rate at which the permutations increase. When I use it for larger tables, it is hit or miss as to whether R will be able to do it. It's not uncommon to get an error implying that R is out of memory. Check out Agresti's Categorical Data Analysis on the use of the fisher exact for larger than 2x2 tables, and check out the R archives (and Google search) for all the posts about the error message people run into sometimes. On April 29th, Marc Schwartz replied to my question about this as follows: Take a look at the 'workspace' argument in ?fisher.test and review the second paragraph in Details: For 2 by 2 cases, p-values are obtained directly using the (central or non-central) hypergeometric distribution. Otherwise, computations are based on a C version of the FORTRAN subroutine FEXACT which implements the network developed by Mehta and Patel (1986) and improved by Clarkson, Fan and Joe (1993). The FORTRAN code can be obtained from http://www.netlib.org/toms/643. Note this fails (with an error message) when the entries of the table are too large. (It transposes the table if necessary so it has no more rows than columns. One constraint is that the product of the row marginals be less than 2^31 - 1.) Thank you, Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Greg Snow Sent: Wednesday, May 07, 2008 9:55 AM To: David Winsemius; [EMAIL PROTECTED] Subject: Re: [R] categorical data analysis The last example in ?fisher.test is not a 2x2 table, in fact it uses levels with a natural ordering similar to the original question. Why would this not be applicable to the situation? From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of David Winsemius [EMAIL PROTECTED] Sent: Wednesday, May 07, 2008 7:34 AM To: [EMAIL PROTECTED] Subject: Re: [R] categorical data analysis Simon Blomberg [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: But see these posts: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/119079.html http://finzi.psych.upenn.edu/R/Rhelp02a/archive/119080.html Simon. Interesting reading, but the OP specifically said he was not dealing with 2x2 tables, so neither fisher.test nor the suggested alternatives would be applicable to his data situation. -- David Winsemius __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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. Internal Virus Database is out-of-date. 11:27 AM Internal Virus Database is out-of-date. 11:27 AM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] problem with fisher.test
I posted this last night but I think I figured out the problem. I checked on the underlying equation for the Fisher Exact Test for tables greater than 2X2. It looks like I have an insane amount of factorials to be multiplied. Is that problem? Is it an overflow issue? Jeff Last nights post: I just a ran a fisher.test on a 9x5 table and received the following message Error in fisher.test(apaslg.t) : FEXACT error 30. Stack length exceeded in f3xact. This problem should not occur. I agree. The problem should not occur. I did some searching but only found other reports of the problem. Does anyone know of a fix? Jeff Internal Virus Database is out-of-date. Checked by AVG Free Edition. 11:27 AM [[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] Documentation General Comments
Bert, I don't think the documentation in of itself is the core of the problem presented in the original post about this. The problem is one of organization. I commented about it possibly being time for an exhaustive R Guide (similar to those huge books put out for commercial software) that compiles all available documentation. Most importantly, it would have a cross-referencing feature. The documentation files have a See Also file but they are incomplete and/or obsolete. In my case, I was exacerbated that it took over an hour just to find the libraries needed to fully reproduce output from SAS PROC FREQ. And, I thought, Wow, I could have just written a function. But, why do that when the info is out there? It just needs to be more readily and easily accessible. But, now getting to the proposed solution of then do something about it...are there any legal issues? It would be time-consuming but not that difficult to put help files online that are duplicates of the existing help files with the exception that additional See Also terms are included. Original text in an author help file would not be edited or deleted without author permission. Another benefit is that other links could be added. For example, the existing help files have an Examples section but more could be done with this. Links could be provided for annotated examples or to other websites. I'm glad to be involved in this. I'm far from being a guru in R programming; this would be a good way to contribute and to continue learning. Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bert Gunter Sent: Tuesday, April 22, 2008 11:29 AM To: r-help@r-project.org Subject: Re: [R] Documentation General Comments FWIW: I consider the documentation of Core R to be one of its great strengths: it is terse (read: to the point), detailed, and accurate. I find it eminently useful and helpful. Indeed, it was why I made the decision some years ago to switch from S-Plus to R (I readily acknowledge that S-Plus may have improved its docs since then -- haven't looked at it in years). While I understand that it may not suit everyone -- learning styles differ, after all -- may I at least say that there is one user out here who is appreciative of the hard work and care that has gone into the documentation. Far FAR better than anything I could do! -- Bert Gunter Genentech -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Greg Snow Sent: Tuesday, April 22, 2008 8:16 AM To: Beck, Kenneth (STP); r-help@r-project.org Subject: Re: [R] Documentation General Comments This is a case of you can't please everyone. A while back there was some complaint that Introduction to R spent to much time on talking about the different types of variables, just the opposite complaint of yours. There are several other sources of documentation (look under the books link on the R homepage or the contributed documentation link on any CRAN site, also browse through the newsletter). For more in depth information on variable types and object oriented programming in R you may want to invest in a copy of S Programming by Venables and Ripley. If you have specific questions (about data types, or other) then tell us what you have read and what you still do not understand and you are more likely to get a useful answer. (also read the posting guide that is referenced at the bottom of almost all posts to the list). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Beck, Kenneth (STP) Sent: Monday, April 21, 2008 3:56 PM To: r-help@r-project.org Subject: [R] Documentation General Comments I realize the R developers are probably overwhelmed and have little time for this, but the documentation really needs some serious reorganizaton. A good through description of basic variable types would help a lot, e.g. the difference between lists, arrays, matrices and frames. And, it appears there is some object-orientation to R, but it is not complete. I can't, for instance find a metafile method for a recordedplot type, using either the variable direclty or the replayPlot() method. I am sorry to post this, but I am really having trouble sorting out certain methods in R. The basic tutorial Introduction to R is so basic, it hardly helps at all, then digging through documentation is really an exercise in frustration. The SimpleR is also so basic it is of little help other than to just get started. I occasionally find answers in the mailing list. See my later post on recordPlot for a good example. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented,
Re: [R] Documentation General Comments
I agree completely. Maybe it's time for an exhaustive manual (with weekly downloadable updates, of course). It would also be nice if it were cross-referenced. For example, to get what I wanted last weekend from a simple 2x2 contingency analysis, I had to bounce between 4 different libraries. (All I was trying to do was replicate the output from SAS Proc Freq). A lot of the library documentations have a See Also section but these may be getting out of date. But maybe our request is too monumental to be feasible. (?) Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Beck, Kenneth (STP) Sent: Monday, April 21, 2008 5:56 PM To: r-help@r-project.org Subject: [R] Documentation General Comments I realize the R developers are probably overwhelmed and have little time for this, but the documentation really needs some serious reorganizaton. A good through description of basic variable types would help a lot, e.g. the difference between lists, arrays, matrices and frames. And, it appears there is some object-orientation to R, but it is not complete. I can't, for instance find a metafile method for a recordedplot type, using either the variable direclty or the replayPlot() method. I am sorry to post this, but I am really having trouble sorting out certain methods in R. The basic tutorial Introduction to R is so basic, it hardly helps at all, then digging through documentation is really an exercise in frustration. The SimpleR is also so basic it is of little help other than to just get started. I occasionally find answers in the mailing list. See my later post on recordPlot for a good example. Internal Virus Database is out-of-date. Checked by AVG Free Edition. 11:27 AM Internal Virus Database is out-of-date. Checked by AVG Free Edition. 11:27 AM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Mantel-Haenszel for 2x2
Rob, I had tried that but mhor requires 3 variables (i.e., a conditional test). I didn't think to just create a third variable...vector of 1's. Now it works fine. Thanks! Jeff -Original Message- From: Robert Baer [mailto:[EMAIL PROTECTED] Sent: Saturday, April 19, 2008 6:48 PM To: Dr. Jeff Miller; [EMAIL PROTECTED] Subject: Re: [R] Mantel-Haenszel for 2x2 See if this is what you are looking for: library(epicalc) data(Oswego) use(Oswego) cc(ill, chocolate) mhor(ill, chocolate, sex) You might also wish to read the details of: mantelhaen.test HTH], Rob Baer - Original Message - From: Dr. Jeff Miller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 19, 2008 1:30 AM Subject: [R] Mantel-Haenszel for 2x2 Hi all, Does anyone know if an R function for the Mantel-Haenszel chi-square for a 2x2 table exists? I've also seen it called the randomization Q statistic. Note that I'm not looking for the Cochran-Mantel-Haenszel.I did see that out there as cmh.test. Thanks in advance, Jeff Internal Virus Database is out-of-date. Checked by AVG Free Edition. 11:27 AM [[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. Internal Virus Database is out-of-date. Checked by AVG Free Edition. 11:27 AM Internal Virus Database is out-of-date. Checked by AVG Free Edition. 11:27 AM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] cronbach's alpha
Try cronbach in the psy package Regarding your other question, see classic web reference below. http://www.ats.ucla.edu/STAT/SPSS/library/negalpha.htm Also, note Harold Doran's explanation from a similar R listserv post back in January http://tolstoy.newcastle.edu.au/R/e2/help/07/01/9125.html HTH, Jeff Miller Jeffrey M. Miller, PhD AlphaPoint05, Inc. Statistics Consultant 2792 SE 27th Ave. Gainesville, FL 32641 H: 352.505.2798 C: 352.359.6611 Checked by AVG Free Edition. 9:50 PM ---BeginMessage--- alpha.scale (psych) cronbach (multilevel) On Nov 14, 2007 7:33 AM, raymond chiruka [EMAIL PROTECTED] wrote: hie 1...i'm trying to carryout a relibility testusing cronbach's alpha what fuctin do i use. 2.. this is more of a statistical question.if the alpha value for all the variables is negative what does it mean. and if the alpha value is negative for all tyha variables but is greater than 0.7 for some sections of the variables what does that mean thanks in advance - Never miss a thing. Make Yahoo your homepage. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list [1]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [2]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- CH Chan Research Assistant - KWH [3]http://www.macgrass.com __ R-help@r-project.org mailing list [4]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [5]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. No virus found in this incoming message. 11/11/07 9:50 PM References 1. https://stat.ethz.ch/mailman/listinfo/r-help 2. http://www.R-project.org/posting-guide.html 3. http://www.macgrass.com/ 4. https://stat.ethz.ch/mailman/listinfo/r-help 5. http://www.R-project.org/posting-guide.html ---End Message--- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] simple averaging question?
Hi all, Suppose I have a column vector of 600 measurements taken in 1s intervals. What I want is a new vector with the averages for each min (so there would be 10 entries). Is there an efficient way to do this? Ive been doing it with a for loop but something tells me there is a simple command that is more efficient. Jeff Internal Virus Database is out-of-date. Checked by AVG Free Edition. 3:09 PM [[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] simple averaging question?
Moshe, Ted, Chuck, All THREE approaches worked fine for me. Thank you! Sincerely, Jeff Miller Internal Virus Database is out-of-date. Checked by AVG Free Edition. 3:09 PM ---BeginMessage--- Jeff Miller wrote: Hi all, Suppose I have a column vector of 600 measurements taken in 1s intervals. What I want is a new vector with the averages for each min (so there would be 10 entries). Is there an efficient way to do this? I’ve been doing it with a ‘for’ loop but something tells me there is a simple command that is more efficient. How about something like this? y - runif(600) df - data.frame(minute = rep(1:10, each=60), y = y) with(df, tapply(y, minute, mean)) 1 2 3 4 5 0.4664301 0.4622071 0.5159511 0.4744836 0.5282750 6 7 8 910 0.4670941 0.5091410 0.4648349 0.5227221 0.5251926 Jeff Internal Virus Database is out-of-date. Checked by AVG Free Edition. 3:09 PM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list [1]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [2]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 Internal Virus Database is out-of-date. Checked by AVG Free Edition. 10/21/07 3:09 PM References 1. https://stat.ethz.ch/mailman/listinfo/r-help 2. http://www.R-project.org/posting-guide.html ---End Message--- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Mplus and R
Has anyone successfully linked Mplus and R and have code on how to do it? It would be great to use R to simulate datasets and then ship to Mplus for SEM analysis. I know one researcher who does this quite regularly but I cant get ahold of him right now. Sincerely, Jeff Miller Jeffrey M. Miller, PhD HYPERLINK http://www.alphapoint05.netAlphaPoint05, Inc. Statistics Consultant 2792 SE 27th Ave. Gainesville, FL 32641 H: 352.505.2798 C: 352.359.6611 Internal Virus Database is out-of-date. Checked by AVG Free Edition. 3:09 PM [[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] linking Tinn-R to a new R version
While on the Tinn-R topic... I absolutely love Tinn-R but I have noticed one quirk and am wondering if anyone else experiences it. In the middle typing a line of code, sometimes everything will slow down. I will have to type a letter, wait a second, type a letter, wait a second, etcuntil I get to the end of the line. Sincerely, Jeff Miller Jeffrey M. Miller, PhD AlphaPoint05, Inc. Statistics Consultant 2792 SE 27th Ave. Gainesville, FL 32641 H: 352.505.2798 C: 352.359.6611 Checked by AVG Free Edition. 3:09 PM ---BeginMessage--- What version of Tinn-R (not sure it matters, though)? In 1.19.2.3 you have to tell Tinn-R where the GUI is by giving it's path in the path to preferred GUI slot in the Options --Main -- Application --R tab dialog box. (which can be entered by browsing after clicking on the Path to Preferred GUI bar if you don't want to type it in). Bert Gunter Genentcah Nonclinical Statistics -Original Message- From:[EMAIL PROTECTED]:[EMAIL PROTECTED] On Behalf Of Silvia Lomascolo Sent: Friday, October 26, 2007 11:31 AM To: r-help@r-project.org Subject: [R] linking Tinn-R to a new R version Hi all, Can anyone please tell me how to start R from Tinn-R's Toogle start/close Rgui button, after I've updated to a new version of R? It seems like Tinn-R keeps looking for the previous version of R. I have updated R twice already since I started using Tinn-R and I haven't been able to make that button work again. It tells me The specified file was not found, probably because it's looking for R 2.4.1. Thanks! Silvia. -- View this message in context: [2]http://www.nabble.com/linking-Tinn-R-to-a-new-R-version-tf4699061.html#a1 343 3013 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list [3]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [4]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list [5]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [6]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. No virus found in this incoming message. 10/21/07 3:09 PM References 1. mailto:[EMAIL PROTECTED] 2. http://www.nabble.com/linking-Tinn-R-to-a-new-R-version-tf4699061.html#a1343 3. https://stat.ethz.ch/mailman/listinfo/r-help 4. http://www.R-project.org/posting-guide.html 5. https://stat.ethz.ch/mailman/listinfo/r-help 6. http://www.R-project.org/posting-guide.html ---End Message--- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Repeated Measures/Linear Mixed Effects function
---BeginMessage--- Hi Keith, it seems like a good starting position. I recommend that you spend some time studying Pinheiro and Bates's book to see where t ogo from here. Cheers Andrew On Mon, Oct 22, 2007 at 02:58:51PM -0800, Keith Cox wrote: I have three columns of data, Xc, Trt and fish. This was a repeated measures design with 6 measurements taken from each of 5 fish. Xc is the actual measurement, Trt is the treatment, and fish is the fish number. Data can be seen below (hopefully it is in the column format). I would like to look for differences between treatments in a repeated measures format. I used the following code library(nlme) summary(lme(Xc~trt,data=R.exp,random=~1|fish)) This seems to work and I would like to know if 1)this is the right function for my question, if so, then 2)in the summary, value is the first column, but what value is this. I have searched in vain and cannot find the answer. Any help or links to examples would be appreciated greatly. Fixed effects: Xc ~ trt Value Std.Error DF t-value p-value (Intercept) 103.62 2.619657 20 39.55480 0 trtB-33.28 1.991197 20 -16.71356 0 trtC-39.38 1.991197 20 -19.77705 0 trtD-32.60 1.991197 20 -16.37206 0 trtE-47.32 1.991197 20 -23.76460 0 trtF-39.58 1.991197 20 -19.87749 0 Xc Trt fish 109.1 a 1 73 b 1 68.4 c 1 74.8 d 1 60.3 e 1 57 f 1 106 a 2 72.3 b 2 67 c 2 70.6 d 2 58.2 e 2 66.2 f 2 102 a 3 67.1 b 3 61 c 3 68.4 d 3 50.2 e 3 64.7 f 3 105 a 4 76.6 b 4 68.8 c 4 77.7 d 4 61.8 e 4 75.7 f 4 96 a 5 62.7 b 5 56 c 5 63.6 d 5 51 e 5 56.6 f 5 Marlin Keith Cox Ph.D. At-Sea Processor Professorship of Fisheries Biology Science Chair Sheldon Jackson College Sitka, Alaska 99835 907.747.5296 [1]http://www.sheldonjackson.edu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list [2]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [3]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 [4]http://www.ms.unimelb.edu.au/~andrewpr [5]http://blogs.mbs.edu/fishing-in-the-bay/ __ R-help@r-project.org mailing list [6]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [7]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. No virus found in this incoming message. 10/21/07 3:09 PM References 1. http://www.sheldonjackson.edu/ 2. https://stat.ethz.ch/mailman/listinfo/r-help 3. http://www.R-project.org/posting-guide.html 4. http://www.ms.unimelb.edu.au/~andrewpr 5. http://blogs.mbs.edu/fishing-in-the-bay/ 6. https://stat.ethz.ch/mailman/listinfo/r-help 7. http://www.R-project.org/posting-guide.html ---End Message--- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.