Re: [R] 2 sample wilcox.test != kruskal.test
2012/1/11 syrvn ment...@gmx.net Hi, thanks for your answer. Unfortunately I cannot reproduce your results. In my example the results still differ when I use your approach: x - c(10,11,15,8,16,12,20) y - c(10,14,18,25,28,30,35) f - as.factor(c(rep(a,7), rep(b,7))) d - c(x,y) kruskal.test(x,y) Try to compare wilcox.test and right formula in kruskal, I got: all.equal(wilcox.test(x,y, correct = F,exact=F)$p.value,kruskal.test(d~f)$p.value) [1] TRUE -- Mi³ego dnia [[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] 2 sample wilcox.test != kruskal.test
2012/1/10 syrvn ment...@gmx.net And why does kruskal.test(x~y) differ from kruskal.test(f~d)?? Your formula is wrong, but function doesn't see errors. formula a formula of the form lhs ~ rhs where lhs gives the data values and rhs the corresponding groups. And that leads to kruskal.test(d~as.factor(f)) which is fine. -- Mi³ego dnia [[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] Can R handle a matrix with 8 billion entries?
2011/8/11 Chris Howden ch...@trickysolutions.com.au In that my distance matrix has too many entries for R's architecture to know how to store in memory There was an multiv package with hierclust function and a bign option. Is n big? If storage is problemsome, a different implementation of the Ward criterion may be tried. This determines dissimilarities on the fly, and hence requires O(n) storage. But it's orphaned now and makeconf has troubles with making dll. -- Mi³ego dnia [[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] Can R handle a matrix with 8 billion entries?
W dniu 12 sierpnia 2011 05:19 u¿ytkownik Chris Howden ch...@trickysolutions.com.au napisa³: Thanks for the suggestion, I'll look into it It seems to work! :) library(multiv) data(iris) iris - as.matrix(iris[,1:4]) h - hierclust(iris, method=2) d- dist(iris) hk-hclust(d) str(hk) List of 7 $ merge : int [1:149, 1:2] -102 -8 -1 -10 -129 -11 -5 -20 -30 -58 ... $ height : num [1:149] 0 0.1 0.1 0.1 0.1 ... $ order : int [1:150] 108 131 103 126 130 119 106 123 118 132 ... $ labels : NULL $ method : chr complete $ call : language hclust(d = d) $ dist.method: chr euclidean - attr(*, class)= chr hclust str(h) List of 3 $ merge : int [1:149, 1:2] -102 -8 -1 -10 -129 -11 -41 -5 -20 7 ... $ height: num [1:149] 0 0.01 0.01 0.01 0.01 ... $ order : int [1:150] 42 23 15 16 45 34 33 17 21 32 ... test.mat-matrix(rnorm(90523*24),,24) out-hierclust(test.mat, method = 1, bign = T) print(object.size(out),u=Mb) 1.7 Mb str(out) List of 3 $ merge : int [1:90522, 1:2] -35562 -19476 -60344 -66060 -38949 -14537 -3322 -20248 -19464 -78693 ... $ height: num [1:90522] 1.93 1.94 1.96 1.98 2 ... $ order : int [1:90523] 24026 61915 71685 16317 85828 11577 36034 37324 65754 55381 ... R.version$os [1] mingw32 -- Mi³ego dnia [[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] In ppls package kernel method is unsupported?
require(ppls) data(BOD) X-BOD[,1] y-BOD[,2] Xtest=seq(min(X),max(X),length=200) dummy-X2s(X,Xtest,deg=3,nknot=20) Z-dummy$Z Ztest-dummy$Ztest size-dummy$sizeZ P-Penalty.matrix(size,order=2) lambda-200 number.comp-3 penalized.pls(Z,y,P=lambda*P,ncomp=number.comp)$coefficients # By default kernel=F penalized.pls(Z,y,P=lambda*P,ncomp=number.comp,kernel=TRUE)$coefficients # Same as above...?! penalized.pls.kernel(Z,y,M=lambda*P,ncomp=number.comp) # But using directly, coefficients are different. -- Mi³ego dnia [[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] In ppls package kernel method is unsupported?
W dniu 22 marca 2011 10:27 u¿ytkownik £ukasz Rêc³awowicz lukasz.reclawow...@gmail.com napisa³: penalized.pls.kernel(Z,y,M=lambda*P,ncomp=number.comp) # But using directly, coefficients are different. I see me error P=!M, but still results are the same... p - ncol(Z) Minv - diag(p) + P M - solve(Minv) penalized.pls.default(Z,y,M=M,ncomp=number.comp) penalized.pls.kernel(Z,y,M=M,ncomp=number.comp) -- Mi³ego dnia [[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] Is there an exact binomial k-sample test of equivalence?
2011/3/11 Albyn Jones jo...@reed.edu but presumably what you really want would be based on a joint confidence region for all the proportions. I've had read On Exact Methods for Testing Equality of Binomial Proportions by Akihito Matsuo, but still, this concept is for me unclear and I got lost... We have H0: |pi1-pi2-pi3| = 0.05 n1-40;n2-40;n3-40 s1-list(1:11);s2-list(1:17);s3-list(1:15) pi1-max(s1[[1]])/n1;pi2-max(s2[[1]])/n2;pi3-max(s3[[1]])/n3 epsilon-.05 t(c(pi1,pi2,pi3)) T_chi.sq-sum(sapply(s1,(function(s1){(s1-n1*pi1)^2/n1*pi1*(1-pi1)}))) T_binom-sum(sapply(s1,function(s1){choose(n1,s1)*(pi1-epsilon)^s1*(pi1+epsilon)^(n1-s1)})) # Or it's about sum of all s-list(1:43) and n-n1+n2+n3 ? Am I going to right direction? -- Mi³ego dnia [[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] Is there an exact binomial k-sample test of equivalence?
Hi, I've got one silly question for evening. I don't know is this reasonable, but can test with two the most extreme proportions from the samples could be good enough evidence for testing equivalence, or should I have to look for something else...? -- Mi³ego dnia [[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] exact logistic regression
I believe that this code will work (...for very small) samples, but let some correct me if there is something wrong. require(logistf);require(combinat) permY-permn(data$y) ntimes-length(permY) results-matrix(nrows=ntimes,ncols=number_of_coefficients) for(i in 1:ntimes){ results[i,]-logistf(unlist(permY[i])~factor_A+factor_B,data=data)} observed-logistf(y~factor_A+factor_B,data=data)$coefficients # Exact p-values will be: sum(results[,1]=observed[1])/ntimes # One for intercept sum(results[,2]=observed[2])/ntimes sum(results[,3]=observed[3])/ntimes -- Mi³ego dnia [[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] exact logistic regression
2011/2/4 Den d.kazakiew...@gmail.com To use elrm() I have to aggregate my data,which is really time consuming when I look for the way out through many variables. You don't have to do that. *One exception is that the binomial response should be specified as success/trials, where success gives the number of successes and trials gives the number of binomial trials for each row of dataset. * So... when one row = one trial: data2elrm-cbind(mydata,n=rep(1,dim(mydata)[1]))* * But the worst thing is that I am not not sure if I can trust to p-values in output. It depends, but it's always a guess. -- Mi³ego dnia [[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] exact logistic regression
data2elrm-cbind(mydata,n=rep(1,dim(mydata)[1])) More logic would be: data2elrm2-cbind(mydata,n=rep(1,nrow(mydata))) Sorry for obfuscation. -- Mi³ego dnia [[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] exact logistic regression
2011/2/3 Den d.kazakiew...@gmail.com Thank you again It is funny how stupid I was Elrm, clogit {survival} or exactLoglinTest are only exact-like, the truth is, R don't have it... and glm is poor. http://sas-and-r.blogspot.com/2010/12/example-818-monte-carlo-experiment.html http://sas-and-r.blogspot.com/2010/11/example-816-exact-logistic-regression.html http://www.cytel.com/Papers/scra-2003.pdf http://support.sas.com/rnd/app/papers/exactlogistic2009.pdf -- Mi³ego dnia [[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
We don't need a loop! require(Rmpfr) factorial(mpfr(1:500,3800)) 2011/2/2 Waclaw Kusnierczyk w...@idi.ntnu.no library(bc) factorial = function(n) bc(sprintf(' define factorial(n) { if (n 2) return (1) f = 2 i = 2 while (i n) f *= ++i return (f) } factorial(%d)', n)) -- Mi³ego dnia [[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
W dniu 2 lutego 2011 16:35 u¿ytkownik Wacek Kusnierczyk w...@idi.ntnu.nonapisa³: On 2/2/11 3:59 AM, £ukasz Rêc³awowicz wrote: We don't need a loop! require(Rmpfr) factorial(mpfr(1:500,3800)) This is very good! But it has just a few functions... I get an unexpected warning, though: Warning message: In if (mpfr.is.integer(x)) round(r) else r : the condition has length 1 and only the first element will be used This is strange... when you run this twice it's ok, no warning. str(j[500]) Formal class 'mpfr' [package Rmpfr] with 1 slots ..@ .Data:List of 1 .. ..$ :Formal class 'mpfr1' [package Rmpfr] with 4 slots .. .. .. ..@ prec: int 4000 .. .. .. ..@ exp : int 3768 So setting 3800 bits should be enough, 4e3 bits gives no rounding warning. You can use this factorials without any numeric problems with second loop (but you have to wait looonger...). Changing code it's a very good idea. -- Mi³ego dnia [[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] Problem with lme4 package
2010/12/15 suchy tomasz.sucho...@gmail.com /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lgfortran collect2: ld returned 1 exit status Similar situation I have for other packages. Could You help me? Did you install gfortran first? -- Mi³ego dnia [[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] weighted Spearman correlation coefficient
2010/11/29 Daniel Rabczenko dan...@medstat.waw.pl I would be grateful if anybody can help me in finding an R function to compute weighted Spearman correlation coefficient? There is someone, he lives here http://finzi.psych.upenn.edu/search.html But you can write R-code for this coefficient using: ?rank ?var ?cov.wt [[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] plotting a timeline
2010/11/20 Marcin Gomulka mrgo...@gmail.com I'd rather do this with a dedicated package function ( like axis() ). Probably you have to write your own function, or tune up manually plot. plot(the_data$eventtime, abs(the_data$impact), type=h, frame.plot=FALSE, axes = FALSE, xlab=,ylab=, col=grey,lwd=2,ylim=c(-2,2),xlim=c(1913,2005)) text(the_data$eventtime,the_data$impact+.1, the_data$label,cex=.6,adj=1) lines(x=c(1914,2003),y=c(0,0),lwd=2,col=blue,t=l) axis(1,the_data$eventtime,pos=0,cex.axis=.5,padj=-2,tck=-.01) -- Mi³ego dnia [[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] negative axis values in image() and scalebar in cor.plot() {psych}
2010/11/19 Lara Poplarski larapoplar...@gmail.com In order to make the output more readable You can just copy the style of the cor.plot. mat-matrix(rnorm(256e4),16e2,16e2) image(cor(mat),axes=F,col= grey((dim(mat)[1]:0)/dim(mat)[1]),main=Like this) -- Mi³ego dnia [[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] Extending the accuracy of exp(1) in R
2010/11/9 Shant Ch sha1...@yahoo.com Can anyone let me know how can I increase the accuracy level. library(Rmpfr) exp(mpfr(1,128)) 1 'mpfr' number of precision 128 bits [1] 2.718281828459045235360287471352662497759 -- Mi³ego dnia [[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] Please help me about Monte Carlo Permutation
2010/11/2 Chitra cbban...@gmail.com yes Me too. So you want to do a MC test for Pearson's product-moment correlation, right...? So for sample sizes from 3 to about 10 we can use all permutations [permn(combinat)]- test will be exact! (In our case 7!=5040) lg-lightgreen g-green dg-darkgreen plot((gamma(1:31)),t=p,main=Suggested tests for r,ylab=Number of permutations,xlab=n,lwd=2,col=c(rep(lg,10),rep(g,4),rep(dg,17)),log=yx,pch=-,cex=2) legend(1,range(gamma(4:31))[2],c(exact,MC,cor.test),col=c(lg,g,dg),pch=-,pt.cex=2) abline(h=.Machine$integer.max,col=2,lty=3) We use MC when the number of permutations is very large and we cannot use them all. Beside, the difference between theoretical distribution for larger samples 25 will be negligible. Let's use your data: data Qtot Itot 1 73 684 2 64 451 3 71 378 4 65 284 5 47 179 6 31 117 7 19 69 We get 0.01494540 from cor.test cor.test(data[,1],data[,2]) Let's write a function for our test, it might be something like: cor.test.mc-function(x,y,n=1e3){ our.data-cbind(x,y) if (!is.numeric(our.data[,1]) || !is.numeric(our.data[,2])) stop(Only numeric variables are allowed.) l-length(our.data[,1]) if (l 3) stop(At least 3 samples are required.) DNAME - paste(deparse(substitute(x)), and ,deparse(substitute(y))) samples-unique(t(replicate(n,(sample(our.data[,1]) loop-dim(samples)[1] correlations-rep(NA,loop) for(i in 1:loop){ correlations[i]-cor(our.data[,2],samples[i,]) } observed-cor(our.data[,1],our.data[,2]) GE-sum(correlations=observed) LT-sum(correlations(-observed)) two.tailed.p-(GE+LT)/loop rea-(loop/gamma(l+1))*100 RVAL - list(statistic = c(r = observed), p.value = two.tailed.p, method = Monte Carlo Pearson's r test , data.name = DNAME,samples=c( Number of used unique permutations=loop),total=c(Percent of all possible permutations=round(rea,2))) class(RVAL) - htest #But what kind of plot you wish to have - I don't know... #hist(correlations,col=blue,xlab=r,xlim=c(-1,1),breaks=50) return(RVAL) gc() } cor.test.mc(data[,1],data[,2]) test-cor.test.mc(data[,1],data[,2],6e4) test test$samples test$total # And that's it. Our p-value is sum of 7/5040 (GE) and 61/5040 (LT). You may also take a look @ library(MChtest). Hope this helps! -- Mi³ego dnia [[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] Please help me about Monte Carlo Permutation
2010/10/29 Chitra cbban...@gmail.com I am sorry I got lost here. Me too. So you want to do a MC test for Pearson's product-moment correlation, right...? -- Mi³ego dnia [[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] Please help me about Monte Carlo Permutation
2010/10/29 Chitra cbban...@gmail.com £ukasz Rêc³awowicz, Thanks. I got this p-value. It's exact upper tail (=), for lower you have to add ((-test.statistic)) to obtain two-sided p-vaule. test() [1] P-value: 0.00139 I still could not figure out how to plot 5000 permuted Qtot vs Itot. Result of permuted.Qtot-permn(data$Qtot) is the list class object, so we can plot something very strange like a plot(rep(data$Itot,5040)~unlist(permuted.Qtot)) But I don't think it's what you want to get... -- Mi³ego dnia [[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] RGTK2 - Entry Point not found
The stable version of RGtk2 requires GTK version 2.8.0 or higher (and its dependencies). -- Mi³ego dnia [[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] RGTK2 - Entry Point not found
W dniu 28 pa¼dziernika 2010 16:09 u¿ytkownik W Eryk Wolski wewol...@gmail.com napisa³: Any other ideas? Restart R and then try load library :) -- Mi³ego dnia [[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] Please help me about Monte Carlo Permutation
I'm not sure is this correct, but maybe you are looking for something like this: test-function(){ permuted.Qtot-permn(data$Qtot) n-length(permuted.Qtot) correlation-rep(NA,n) for(i in 1:n){ correlation[i]-cor(data$Itot,permuted.Qtot[[i]])} p-sum(correlation=cor(data$Qtot,data$Itot))/n print(paste(P-value:, round(p,5)),quote=F) } test() -- Mi³ego dnia [[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] Reading in a tab delimitated file
2010/10/26 amindlessbrain jillianrowe91...@gmail.com (I'm not sure why the disease column isn't showing up as a tab here, but it is sep by \t in my file. You've got a double tab space, I don't know is there a prettier way, but paste this: pd-read.delim(new_treat.txt,sep=) -- Mi³ego dnia [[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] font.lab and font.axis
2010/10/25 Jim Lemon j...@bitwrit.com.au Would someone like to suggest a better way to get axis to look at the font it's supposed to be using? Are you looking for something like this? x-rnorm(100) hist(x,axes=F,font.lab=12,font.main=9) axis(1,font.axis=4) axis(2,font.axis=3) -- Mi³ego dnia [[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] font.lab and font.axis
W dniu 25 pa¼dziernika 2010 13:14 u¿ytkownik Jim Lemon j...@bitwrit.com.aunapisa³: On 10/25/2010 08:02 PM, £ukasz Rêc³awowicz wrote: 2010/10/25 Jim Lemon j...@bitwrit.com.au mailto:j...@bitwrit.com.au Would someone like to suggest a better way to get axis to look at the font it's supposed to be using? Are you looking for something like this? x-rnorm(100) hist(x,axes=F,font.lab=12,font.main=9) axis(1,font.axis=4) axis(2,font.axis=3) -- Something like that, except that I was thinking of a par command that would affect subsequent calls to axis, not as an argument to the function itself. Jim Could you give an example code which doesn't work with par()? -- Mi³ego dnia [[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] CI using ci.numeric
2010/10/20 David A. dasol...@hotmail.com I am trying to calculate confidence intervals using ci.numeric from epicalc package. If I generate a normal set of data and find the 99% and 95% CI, they seem too narrow to me. Am I doing something wrong?? Yes. set.seed(123) x- rnorm(200,0,1) ci.numeric(x=mean(x),n=length(x),sds=sd(x),alpha=0.05) # nmeansd se lower95ci upper95ci # 200 -0.008570445 0.9431599 0.06669147 -0.1400831 0.1229422 # Let's compute lower CI of a mean usnig t-distribution as it is in ci.numeric mean(x) - qt(p = (1 - .05/2),df=length(x)-1) * sd(x)/sqrt(length(x)) # [1] -0.1400831 # now using normal distribution mean(x) - qnorm(p = (1 - .05/2)) * sd(x)/sqrt(length(x)) # [1] -0.1392833 -- Mi³ego dnia [[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] The width argument of stem()
Or here (kill R feature): stem(islands, width=NULL) It may looks like a bug. 2010/10/14 Marcin Kozak nyg...@gmail.com: Could anyone pleaase clarify what is going on here? -- Miłego dnia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 do I tell whether two vectors are identical?
benchmark( + all_eq = {isTRUE(all.equal.numeric(x,y))}, + dfrm = {compare-data.frame(id-seq(1,43e3,1),x,y); + compare$id[compare$x!=compare$y]}, + int = {(compare$x!=compare$y)}, + slf = {differences-compare$id[compare$x!=compare$y]}, + replications=1000) test replications elapsed relative user.self sys.self 1 all_eq 1000 14.61 11.068182 12.59 0.02 2 dfrm 1000 27.08 20.515152 23.38 0.00 3 int 10001.32 1.00 1.20 0.00 4 slf 10003.45 2.613636 2.91 0.00 Because: a) in many real cases data frame may exist, so you create it only once b) loop was unfair ;) c) my approach gives an information about the indices of positions at which the vectors differ Time of evaluation of differences is also mesured, not only assignment to vector. Summary: If you already got a data frame, slf method can be a few times faster. If you don't have it, and you only need to know are they differ as a whole check by all_eq. It depends on needs and stored format. W dniu 13 października 2010 00:16 użytkownik David Winsemius dwinsem...@comcast.net napisał: And as a result you have chosen not to include the creation of the data.frame inside your loop. David Winsemius, MD West Hartford, CT -- Miłego dnia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] bootstrap in pROC package
Try: ci.auc(all$D,all$pre,m=b) 2010/10/13 zhu yao mailzhu...@gmail.com: Dear useRs: I use pROC package to compute the bootstrap C.I. of AUC. The command was as follows: roc1-roc(all$D,all$pre,ci=TRUE,boot.n=200) -- Miłego dnia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Bootstrapping Krippendorff's alpha coefficient
Hi, I don't know how to sample such data, it can't be done by row sampling as default method on matrix in boot. Function takes matrix and returns single coefficient. #There is a macro but I want use R :) http://www.comm.ohio-state.edu/ahayes/SPSS%20programs/kalphav2_1.SPS library(concord) library(boot) # The data are rates among observers with NA's nmm-matrix(c(1,1,NA,1,2,2,3,2,3,3,3,3,3,3,3,3,2,2,2,2,1,2,3,4,4,4,4,4, + 1,1,2,1,2,2,2,2,NA,5,5,5,NA,NA,1,1,NA,NA,3,NA),nrow=4) sample.rates-function(matrix.data,i){ #mixed.rates-sample individual rates and put back in new matrix (?) return(kripp.alpha(mixed.rates)$statistic[i]) } to.get-boot(nmm, sample.rates, R=1e4, stype=i) -- Miłego dnia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] non-numerical values as input using nnet
Response can be (?multinom) factor (?as.factor), while predictors (don't know, but i think not) can be turned into numbers via varius distance measures. -- Miłego dnia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 do I tell whether two vectors are identical?
Or just: id-seq(1,45e3,1) compare-data.frame(id,a,b) differences-compare$id[a!=b] -- Miłego dnia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 do I tell whether two vectors are identical?
Let's test speed in this way: benchmark(isTRUE(all.equal.numeric(x,y)),replications=1e3) replications elapsed relative user.self sys.self 1000 34.011 29.09 0.16 benchmark(differences-compare$id[compare$x!=compare$y],replications=1e3) replications elapsed relative user.self sys.self 10004.331 40 2010/10/12 David Winsemius dwinsem...@comcast.net: The method of embedding in a dataframe is going to be really slow. -- Miłego dnia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.