[R] qvalue package: checking I'm using the right output values.
Can I ask, when I run the below code: library(qvalue) pvals <-c(0.01,0.02,0.03,0.10,0.67,0.08,0.55,0.10,0.81,0.08,0.94,0.10,0.81,0.08,0.72,0.10,0.22,0.08,0.72,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.01,0.02,0.03,0.10,0.67,0.08,0.55,0.10,0.81,0.08,0.94,0.10,0.81,0.089,0.72,0.10,0.22,0.08,0.72,0.01,0.02,0.03,0.04,0.05,0.06,0.07) qobj <-qvalue(p=pvals) pvals qobj$qvalues qobj$lfdr the qobj$qvalues list is: [1] 0.03592311 0.03592311 0.03592311 0.03991457 0.22490992 0.03991457 [7] 0.19757712 0.03991457 0.23278177 0.03991457 0.25975174 0.03991457 [13] 0.23278177 0.03991457 0.22490992 0.03991457 0.08319037 0.03991457 [19] 0.22490992 0.03592311 0.03592311 0.03592311 0.03991457 0.03991457 [25] 0.03991457 0.03991457 0.03592311 0.03592311 0.03592311 0.03991457 [31] 0.22490992 0.03991457 0.19757712 0.03991457 0.23278177 0.03991457 [37] 0.25975174 0.03991457 0.23278177 0.03991457 0.22490992 0.03991457 [43] 0.08319037 0.03991457 0.22490992 0.03592311 0.03592311 0.03592311 [49] 0.03991457 0.03991457 0.03991457 0.03991457 and the qobj$lfdr list is: [1] 0.03070397 0.04312982 0.05458114 0.13925884 0.79081046 0.11311424 [7] 0.79081046 0.13925884 0.79081046 0.11311424 0.79081046 0.13925884 [13] 0.79081046 0.11311424 0.79081046 0.13925884 0.34265237 0.11311424 [19] 0.79081046 0.03070397 0.04312982 0.05458114 0.06583569 0.07718949 [25] 0.08879583 0.10074920 0.03070397 0.04312982 0.05458114 0.13925884 [31] 0.79081046 0.11311424 0.79081046 0.13925884 0.79081046 0.11311424 [37] 0.79081046 0.13925884 0.79081046 0.12463425 0.79081046 0.13925884 [43] 0.34265237 0.11311424 0.79081046 0.03070397 0.04312982 0.05458114 [49] 0.06583569 0.07718949 0.08879583 0.10074920 Can I check that the qobj$lfdr are the FDR Q values (i.e. the number of expected false positives over the number of significant results) for each gene? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Fwd:
Dear all, I am hoping to use the mt.maxT package, so I'm trying to understand how the maxT algorithm works in the multtest package. I have an example of data: SNP1 p value= 0.02 SNP1 permutation p values = 0.03, 0.03, 0.03, 0.04, 0.04. SNP2 p value =0.03 SNP2 permutation p values = 0.4,0.5,0.5,0.6,0.7 SNP3 p value = 0.3 SNP3 p value permutation p values = 0.8,0.9,0.9,0.9,0.9 I was told that for this data set, the corrected P value for SNP1 is 1/6, for SNP2 is 5/12 and SNP3 is 1. I am so confused as to how these numbers were reached. I've tried to come up with an explanation in my head, I would appreciate if someone could tell me where I'm going wrong; 1. First, you get the smallest permuted P Value across all of the SNPs for each permutation. In this case, it's: Perm1 smallest P val= 0.03 Perm2 = 0.03 Perm3 = 0.03 Perm4 = 0.04 Perm5 = 0.04 2. Then I was told that the corrected p value for SNP1 is 1/6. To get the 6, is this the 5 permuted p values + my p value? So it's 1/6 chance of seeing a p value as low as mine in the original p value + permuted p value set. 3. For SNP2 with an uncorrected p value of 0.03, I am totally confused as to how the answer is 5/12. I know ties count as 0.5. So in my smallest permuted data set: 0.03, 0.03, 0.03, 0.04, 0.04: if you add them up (allowing 0.03 and 0.04 to be worth 0.5 each since they are both ties), the sum of the 5 permuted values is 2.5. So then the chance of seeing 0.03, using the logic from step 1, is that it's 2.5/5, or 3.5/6 if you add in the uncorrected p value? Which isn't 5/12, but if you don't add in the original p value 0.03, the answer will be 2.5/6, which is 5/12but I don't understand why not to add in the original p value in this step, when I did it in step 1. I'm obviously not understanding something, if someone could really simply explain the calculation process/algorithm for maxT corrected p values for this example I would appreciate it. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] egscore - lambda will not go below 1.1
Hi all, I want to associate mortality with ~100K SNPs, in 6,500 samples that are divided up into 60 breeds. So it's important to account for population stratification in my analysis. I'm using egscore (the eigenstrat method) for the association (and I've tried using the polygen and grammar packages too). The problem is that I cannot get lambda (the inflation factor) to go below the accepted inflation threshold of 1.1, it seems to converge around 1.5-1.6 when I include an increasing number of PC axes into the analysis. Then, I also tried to use the polygen and grammar packages, but the same thing happens. Here is the code that I am using: library(GenABEL) #Load the data as a gwaa.class my.geno.data <- load.gwaa.data(phenofile = "pheno.dat",genofile="youroutput.dat") #Calculate the IBS matrix kin<-ibs(my.geno.data, weight="freq", snpfreq=NULL) diag(kin) <-hom(my.geno.data)$Var # Estimation of polygenic model, This estimates the residuals when the effect of covariates breeds are factored out. polygen <-polygenic(mortality~breed,kin=kin,my.geno.data) grammarobject <-qtscore(polygen$pgres,data=my.geno.data,clam=FALSE) so then you found that the lambda was still > 1.1 #So then I used egscore on the output from polygen output <-egscore(polygen$pgresidualY,data=my.geno.data,kin=kin,naxes=X) where I iteratively included an increasing number of PC axes (naxes=X), lambda still > 1.1, and doesn't change if I run egscore on the raw data instead of the environmental residuals (again iterating through axes), and it also doesn't change regardless of if I include breed as a co-variate, or as a stratification variable. output <-egscore(mortality~breed,data=my.geno.data,kin=kin,naxes=X) Am I doing something wrong? What else can I try to properly account for population stratification in an association between trait and SNPs? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] convert.snp.ped in GenAbel
Having a problem with convert.snp.ped in GenABEL (on linux). My map file looks like this (tab-separated) (called Genotype.map) chrom name position 13 SNP1 39703523 My ped file looks like this (Called Genotype.ped) PF1 PF1 0 0 2 -9 C C PF2 PF2 0 0 2 -9 C A PF3 PF3 0 0 1 -9 C C PF4 PF4 0 0 1 -9 C C The commands I'm using are: > library("GenABEL") > data <-convert.snp.ped(pedfile="~/Genotype.ped" ,mapfile="~/Genotype.map", outfile="~/Genotype.out") The error I get is: Error in convert.snp.ped(pedfile = "~/Genotype.ped", : could not open file '~/Genotype.map' ! Any idea? It's in the same directory as the ped file, so I don't know why it can find the ped file and not the map file? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Cox model -missing data.
Hi all, I have a data set like this: Test.cox file: V1V2 V3 Survival Event ann 13 WTHomo 41 ben 20 *51 tom 40 Variant 61 where * indicates that I don't know what the value is for V3 for Ben. I've set up a Cox model to run like this: #!/usr/bin/Rscript library(bdsmatrix) library(kinship2) library(survival) library(coxme) death.dat - read.table(Test.cox,header=T) deathdat.kmat -2*with(death.dat,makekinship(famid,ID,faid,moid)) sink(Test.cox.R.Output) Model - coxme(Surv(Survival,Event)~ strata(factor(V1)) + strata(factor(V2)) + factor(V3)) + (1|ID),data=death.dat,varlist=deathdat.kmat) Model sink() As you can see from the Test.cox file, I have a missing value *. How and where do I tell the R script treat * as a missing variable. If I can't incorporate missing values into the model, I assume the alternative is to remove all of the rows with missing data, which will greatly reduce my data set, as most rows have at least one missing variable. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Cox model -missing data.
Many thanks, I appreciate the response. When I convert the missing values to NA and run the cox model as described in previous post, the cox model seems to remove all of the rows with a missing value (as the number of rows n in the cox output after I completely remove any row with missing data is the same as the number of rows n in the cox output after I change the missing values to NA). What I had been hoping to do is not completely remove a row with missing data for a co-variable, but rather somehow censor or estimate a value for the missing value? In reality, I have ~600 people with survival data and say 6 variables attached to them. After I incorporate a 7th variable (for which the information isn't available for every individual), I have 400 people left. Since I still have survival data and almost all of the information for the other 200 people (the only thing missing is information about that 7th variable), it seems a waste to remove all of the survival data for 200 people over one co-variate. So I was hoping instead of completely removing the rows, to just somehow acknowledge that the data for this particular co-variate is missing in the model but not completely remove the row? This is more what I was hoping someone would know if it's possible to incorporate into the model I described above? Thanks On Fri, Dec 19, 2014 at 10:21 AM, Ted Harding ted.hard...@wlandres.net wrote: Hi Aoife, I think that if you simply replace each * in the data file with NA, then it should work (NA is usually interpreted as missing for those functions for which missingness is relevant). How you subsequently deal with records which have missing values is another question (or many questions ... ). So your data should look like: V1 V2 V3 Survival Event ann 13 WTHomo 41 ben 20 NA 51 tom 40 Variant 61 Hoping this helps, Ted. On 19-Dec-2014 10:12:00 aoife doherty wrote: Hi all, I have a data set like this: Test.cox file: V1V2 V3 Survival Event ann 13 WTHomo 41 ben 20 *51 tom 40 Variant 61 where * indicates that I don't know what the value is for V3 for Ben. I've set up a Cox model to run like this: #!/usr/bin/Rscript library(bdsmatrix) library(kinship2) library(survival) library(coxme) death.dat - read.table(Test.cox,header=T) deathdat.kmat -2*with(death.dat,makekinship(famid,ID,faid,moid)) sink(Test.cox.R.Output) Model - coxme(Surv(Survival,Event)~ strata(factor(V1)) + strata(factor(V2)) + factor(V3)) + (1|ID),data=death.dat,varlist=deathdat.kmat) Model sink() As you can see from the Test.cox file, I have a missing value *. How and where do I tell the R script treat * as a missing variable. If I can't incorporate missing values into the model, I assume the alternative is to remove all of the rows with missing data, which will greatly reduce my data set, as most rows have at least one missing variable. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 19-Dec-2014 Time: 10:21:23 This message was sent by XFMail - [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] exclude missing co-variable data in cox model
Hi all, I have a data set like this: Test.cox file: V1V2 V3Survival Event ann 13 WTHomo 41 ben 20 *51 tom 40 Variant 61 where * indicates that I don't know what the value is for V3 for Ben. I've set up a Cox model to run like this: #!/usr/bin/Rscript library(bdsmatrix) library(kinship2) library(survival) library(coxme) death.dat - read.table(Test.cox,header=T) deathdat.kmat -2*with(death.dat,makekinship(famid,ID,faid,moid)) sink(Test.cox.R.Output) Model - coxme(Surv(Survival,Event)~ strata(factor(V1)) + strata(factor(V2)) + factor(V3)) + (1|ID),data=death.dat,varlist=deathdat.kmat) Model sink() As you can see from the Test.cox file, I have a missing value *. How do I alter the R script to include treat * as a missing variable. If I can't incorporate missing values into the model, I assume the alternative is to remove all of the rows with missing data, which will greatly reduce my data set, as most rows have at least one missing variable. Thanks On Wed, Dec 17, 2014 at 5:19 PM, r-help-ow...@r-project.org wrote: Message rejected by filter rule match -- Forwarded message -- From: Eva Marie aoife.marie.dohe...@gmail.com To: r-help@r-project.org Cc: Date: Wed, 17 Dec 2014 09:09:52 -0800 (PST) Subject: exclude missing co-variable data in cox model Hi all, I have a data set like this: Test.cox file: where * indicates that I don't know what the value is for V3 for Ben. I've set up a Cox model to run like this: As you can see from the Test.cox file, I have a missing value *. How and where do I tell the R script treat * as a missing variable. If I can't incorporate missing values into the model, I assume the alternative is to remove all of the rows with missing data, which will greatly reduce my data set, as most rows have at least one missing variable. Thanks -- View this message in context: http://r.789695.n4.nabble.com/exclude-missing-co-variable-data-in-cox-model-tp4700864.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R shell script
Hey guys, Does anyone have an example of a REALLY simple shell script in R. Basically i want to run this command: library(MASS) wilcox.test(list1,list2,paired=TRUE,alternative=c(greater),correct=TRUE,exact=FALSE) in a shell script something like this: #!/bin/bash R library(MASS) for i in *.out do wilcox.test($i,${i/out}.out2,paired=TRUE) $i.out done that i can run on a command line this this: sh R.sh because i've SO many files to run this command on. I've been googling, but i'm having trouble of just finding a simple example explaining how to make this shell script. Any help appreciated :) Aoife [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R shell script
Thanks for replying. My problem is that i have say 50 input files, that i wanted to run a particular command on, get 50 output files, and then when i close R, have them in my directory? so for example if i say: R library(MASS) list.files(pattern = .out) sapply(list.files(pattern = *.out), function(x) wilcox.test ( ... ) ) send each output to a different file, and save it in such a way that when i close R the outputs are still there i thought this might be easier in a shell way? On Wed, Apr 25, 2012 at 4:03 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: You can do this in bash but why not just do it in R directly? You probably need list.files(pattern = .out) to get started. Then just wrap your script in a function and pass it to (s|l)apply something like: sapply(list.files(pattern = *.out), function(x) wilcox.test ( ... ) ) Michael On Wed, Apr 25, 2012 at 6:47 AM, aoife doherty aoife.m.dohe...@gmail.com wrote: Hey guys, Does anyone have an example of a REALLY simple shell script in R. Basically i want to run this command: library(MASS) wilcox.test(list1,list2,paired=TRUE,alternative=c(greater),correct=TRUE,exact=FALSE) in a shell script something like this: #!/bin/bash R library(MASS) for i in *.out do wilcox.test($i,${i/out}.out2,paired=TRUE) $i.out done that i can run on a command line this this: sh R.sh because i've SO many files to run this command on. I've been googling, but i'm having trouble of just finding a simple example explaining how to make this shell script. Any help appreciated :) Aoife [[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] check for difference.
Hello I have two lists of numbers, each list is ~800 numbers long. I want to know if the two lists are significantly different from each other. Could anyone suggest what library in R to use? I think maybe the mann-whitney test, as it is not parametric, but i am unsure if it is suitable as my list of items are so long.So i am unsure which library would suit best. Aaral. [[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] plot columns
Hey guys, can anyone help? i have a sample table: table - structure(c(4, 7, 0.2, 3, .1, 7, 222, 3, 10, 5, 11, 8, 8, 10, 7), .Dim = c(5L, 3L), .Dimnames = list(c(gene1, gene2, gene3, gene4, gene5), c(codon1, codon2, codon3))) table codon1 codon2 codon3 gene14.0 7 11 gene27.0222 8 gene30.2 3 8 gene43.0 10 10 gene50.1 5 7 i want to plot column 1 versus column 3. Does anyone know how to read in particular columns and plot? i was looking at this: https://stat.ethz.ch/pipermail/r-help/2007-July/137638.html but i can't seem to alter it to my needs Thank you Aoife [[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] (no subject)
Hey guys, if i do a correspondance analysis, e.g.: table - structure(c(4, 7, 0.2, 3, .1, 7, 222, 3, 10, 5, 11, 8, 8, 10, 7), .Dim = c(5L, 3L), .Dimnames = list(c(gene1, gene2, gene3, gene4, gene5), c(codon1, codon2, codon3))) Library(ca) plot(ca(table)) is there a way that i can see the second principal axis of this analysis? Aoife [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help please. 2 tables, which test?
Thank you for the replies. So what my test wants to do is this: I have a big matrix, 30 rows (students in a class) X 50 columns (students grades for the year). An example of the matrix is as such: grade1 grade2grade3 . grade 50 student 1 student 2*** student 3 student 4*** student 5*** student 6 . . . . . student 30*** As you can see, four students (students 2,4,5 and 30) have stars beside their name. I have chosen these students based on a particular characteristic that they all share.I then pulled these students out to make a new table: grade1 grade2 grade3 ... grade 50 student 2 student 4 student 5 student 30 and what i want to see is basically is there any difference between the grades this particular set of students(i.e. student 2,4,5 and 30) got, and the class as a whole? So my null hypothesis is that there is no difference between this set of students grades, and what you would expect from the class as a whole. Aaral On Sat, Mar 10, 2012 at 12:18 AM, Greg Snow 538...@gmail.com wrote: Just what null hypothesis are you trying to test or what question are you trying to answer by comparing 2 matrices of different size? I think you need to figure out what your real question is before worrying about which test might work on it. Trying to get your data to fit a given test rather than finding the appropriate test or other procedure to answer your question is like buying a new suit then having plastic surgery to make you fit the suit rather than having the tailor modify the suit to fit you. If you can give us more information about what your question is we have a better chance of actually helping you. On Fri, Mar 9, 2012 at 9:46 AM, aoife doherty aaral.si...@gmail.com wrote: Thank you. Can the chi-squared test compare two matrices that are not the same size, eg if matrix 1 is a 2 X 4 table, and matrix 2 is a 3 X 5 matrix? On Fri, Mar 9, 2012 at 4:37 PM, Greg Snow 538...@gmail.com wrote: The chi-squared test is one option (and seems reasonable to me if it the the proportions/patterns that you want to test). One way to do the test is to combine your 2 matrices into a 3 dimensional array (the abind package may help here) and test using the loglin function. On Thu, Mar 8, 2012 at 5:46 AM, aaral singh aaral.si...@gmail.com wrote: Hi.Please help if someone can. Problem: I have 2 matrices Eg matrix 1: Freq None Some Heavy32 5 Never8 13 8 Occas14 4 Regul 95 7 matrix 2: Freq None Some Heavy7 1 3 Never 87 18 84 Occas 12 34 Regul917 I want to see if matrix 1 is significantly different from matrix 2. I consider using a chi-squared test. Is this appropriate? Could anyone advise? Many thank you. Aaral Singh -- View this message in context: http://r.789695.n4.nabble.com/help-please-2-tables-which-test-tp4456312p4456312.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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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] max.print
Hey i have a similar size dataset and ran into the same problem, but i found this command works fine: options(max.print=100) to fix it? On Sat, Mar 10, 2012 at 4:35 PM, sybil kennelly sybilkenne...@gmail.comwrote: Dear all. I wanted to read in a 20,000 row X 60 column matrix (called table) into R. i did this: R table - read.table(table, header=TRUE) table it prints out the start of my table (~1 rows by 7 columns) and then this error: [ reached getOption(max.print) -- omitted 5465 rows ]] There were 50 or more warnings (use warnings() to see the first 50) I have tried: options(max.print = Inf) and options(max.print = 9) but i still get the same error. I have seen many people on R help have this problem. However the solution of options(max.print = Inf) does not seem to work for me. Any ideas? Syb [[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] layer plots.
Many thanks for reply. I have trouble understanding how to use response, i am sorry. My question is i have two matrices. I then plot two matrices. Then I have 2 seperate plots. I can color the nodes in the plots in two different colors. Then, how do i merge the two plots to view one overlapping the other? i.e. to view two sets of data in one 2D space? Many thanks On Fri, Mar 9, 2012 at 3:51 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: No idea what table1, table2 are plot(1:5, type = l) points(5:1, col = 2) should get you started. Michael On Fri, Mar 9, 2012 at 10:17 AM, aaral singh aaral.si...@gmail.com wrote: Hello. I have 2 plots. plot1 -plot(table1) plot2 -plot(table2) How may i plot these both on the same graph, i.e. layer one graph on top of the other one. The result should look similar to this the image below, where the black lines indicate one plot, and the red dots indicate the second plot. http://r.789695.n4.nabble.com/file/n4459732/R_screen_shot.png Aaral. -- View this message in context: http://r.789695.n4.nabble.com/layer-plots-tp4459732p4459732.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. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help please. 2 tables, which test?
Thank you. Can the chi-squared test compare two matrices that are not the same size, eg if matrix 1 is a 2 X 4 table, and matrix 2 is a 3 X 5 matrix? On Fri, Mar 9, 2012 at 4:37 PM, Greg Snow 538...@gmail.com wrote: The chi-squared test is one option (and seems reasonable to me if it the the proportions/patterns that you want to test). One way to do the test is to combine your 2 matrices into a 3 dimensional array (the abind package may help here) and test using the loglin function. On Thu, Mar 8, 2012 at 5:46 AM, aaral singh aaral.si...@gmail.com wrote: Hi.Please help if someone can. Problem: I have 2 matrices Eg matrix 1: Freq None Some Heavy32 5 Never8 13 8 Occas14 4 Regul 95 7 matrix 2: Freq None Some Heavy7 1 3 Never 87 18 84 Occas 12 34 Regul917 I want to see if matrix 1 is significantly different from matrix 2. I consider using a chi-squared test. Is this appropriate? Could anyone advise? Many thank you. Aaral Singh -- View this message in context: http://r.789695.n4.nabble.com/help-please-2-tables-which-test-tp4456312p4456312.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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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.