Re: rnorm works correctly (was [R] rnorm??)
On Mon, 21 Feb 2005, Scholz, Fritz wrote: I am wondering whether there is a bug in rnorm. I am wondering if there is a bug in your procedures, or if you used a very old version of R. If you call `bug', do have the courtesy to present your reasons. See the posting guide for other missing information, like the R version, and in this case RNGkind() [1] Mersenne-Twister Inversion which shows the default. When generating rnorm(100) and counting the cases 4 and the cases (-4) I get rather unexpectedly low counts for the latter. The problem goes away when using qnorm(runif(100)). That is the algorithm used by default internally (since 1.7.0, mid-2003, it seems). x - rnorm(100); mean(x 4); mean(x -4) [1] 3.5e-05 [1] 2.8e-05 x - rnorm(100); mean(x 4); mean(x -4) [1] 3.5e-05 [1] 3.5e-05 x - rnorm(100); mean(x 4); mean(x -4) [1] 2.7e-05 [1] 2.9e-05 x - rnorm(100); mean(x 4); mean(x -4) [1] 4.3e-05 [1] 3.7e-05 looks about right. As does cnt - 0 for(i in 1:100) {x - rnorm(100); cnt - cnt + sum(x -4)} cnt [1] 3157 which is (to a good approximation) Poisson(3167) ppois(3157, 1e8*pnorm(-4)) [1] 0.4332376 or more exactly pbinom(3157, 1e8, pnorm(-4)) [1] 0.4332365 However, this is not a good way to generate such random events, and has many times tripped up people: see the cover of my 1987 simulation book for the theory behind one famous (and published) instance. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Treatment-Contrast Interactions
se.contrast computes standard errors of contrasts. It does not compute the contrast itself, which is fairly simple to do directly. c1 - c(1,-1)[A]*c(1,-1,0)[B] sum(c1*score) [1] -18 se.contrast(fit, as.matrix(c1)) Contrast 1 14.24547 (18/14.24547)^2 [1] 1.596583 so the contrast has value -18, standard error 14.24547, and the squared t-ratio is the F statistic 1.5966 you were asking for. (That's a piece of the theory of linear models.) On Mon, 21 Feb 2005, Lorin Hochstein wrote: Peter Dalgaard wrote: Lorin Hochstein [EMAIL PROTECTED] writes: I'd like to understand this approach as well, but I can't reproduce my results using se.contrast. In particular, I get the same standard error even though I tried to use different contrasts: c1 - c(1,-1)[A]*c(1,-1,0)[B] c2 - c(1,-1)[A]*c(1,0,-1)[B] c3 - c(1,-1)[A]*c(0,1,-1)[B] se.contrast(fit, as.matrix(c1)) Contrast 1 14.24547 se.contrast(fit,as.matrix(c2)) Contrast 1 14.24547 se.contrast(fit,as.matrix(c3)) Contrast 1 14.24547 They could well _be_ the same if the design is balanced... Hmmm... One of my problems is that I don't know how to interpret the output of se.contrast. Here's my example again. score - c(12, 8,10, 6, 8, 4, 10,12, 8, 6,10,14, 9, 7, 9, 5,11,12, 7,13, 9, 9, 5,11, 8, 7, 3, 8,12,10, 13,14,19, 9,16,14) n - 6 A - gl(2,3*n,labels=c(a1,a2)) B - rep(gl(3,n,labels=c(b1,b2,b3)),2) contrasts(B) - c(1,-1,0) fit - aov(score~A*B) summary(fit, split=list(B=1:2), expand.split = T) Df Sum Sq Mean Sq F value Pr(F) A1 18.778 18.778 2.2208 0.146606 B2 62.000 31.000 3.6662 0.037629 * B: C1 1 1.500 1.500 0.1774 0.676621 B: C2 1 60.500 60.500 7.1551 0.011986 * A:B 2 81.556 40.778 4.8226 0.015274 * A:B: C11 13.500 13.500 1.5966 0.216119 # --- A:B: C21 68.056 68.056 8.0486 0.008085 ** Residuals 30 253.667 8.456 What I'm really looking for is that F value that's labelled A:B: C1, 1.5966 in this case. (I'm not sure what to call this term, AB interaction?) I thought that it might be possible to use se.contrast to compute this (or at least, to get the numerator so that I could compute the F value once I had the mean square error of the residuals), but I'm not sure how to specify the contrast, and I don't know the relationship between the standard error output by se.contrast and the mean square error which is the fourth column of the output above. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problems with nonlinear fits using nls
Corey Bradshaw [EMAIL PROTECTED] writes: Hello colleagues, I am attempting to determine the nonlinear least-squares estimates of the nonlinear model parameters using nls. I have come across a common problem that R users have reported when I attempt to fit a particular 3-parameter nonlinear function to my dataset: Error in nls(r ~ tlm(a, N.fix, k, theta), data = tlm.data, start = list(a = a.st, : step factor 0.000488281 reduced below `minFactor' of 0.000976563 My function is: tlm - function(a,N,k,theta) (a*(1-((N/k)^theta))) The nls fit I've coded is: tlm.fit - try(nls(r~tlm(a,N.fix,k,theta), data=tlm.data, start=list(a=a.st,k=k.st,theta=1), trace=TRUE, control=nls.control(maxiter=6000,tol=1e-05,minFactor=1/1024))) When you wrap the expresssion to fit in the tlm function, you are effectively keeping nls from using algebraic derivatives and forcing it to do something like dtlm/da =~ (tlm(a+1e-7,...) - tlm(a,...))/1e-7. So you might try sticking in the actual expression r ~ a * (1 - (N.fix/k)^theta) or modify tlm to return a gradient attribute. Reparametrizing in terms of log(k) might also help keeping you out fo trouble. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] rnorm??
Is it possible that you've mistyped sum(x-4) instead of sum(x -4)? Oscar -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] nombre de Adaikalavan Ramasamy Enviado el: martes, 22 de febrero de 2005 2:24 Para: Scholz, Fritz CC: R-help Asunto: Re: [R] rnorm?? 1) Why do you think there is a bug in rnorm. What is your expected numbers for cases 4 or cases -4 ? If you can show your calculations then maybe we can see if there is an error in how you calculated it or with R. 2) Please give a reproducible example. It might be low or high in one instance on a single run but if you do it several times you may not see a consistent bias. If you do, then there could be a bug. Otherwise it could be an element of randomness. B- 10 # increase this if you can out1 - matrix( nr=B, nc=2 ) out2 - matrix( nr=B, nc=2 ) thr - 4 set.seed(1) for(i in 1:B){ x - rnorm(100) out1[ i, 1 ] - mean( x thr )# empirical upper tail prob out1[ i, 2 ] - mean( x -1*thr ) # empirical lower tail prob y - qnorm(runif(100)) out2[ i, 1 ] - mean( y thr ) out2[ i, 2 ] - mean( y -1*thr ) rm(x, y); print(i) } out1 [,1][,2] [1,] 3.6e-05 3.7e-05 [2,] 3.2e-05 2.6e-05 [3,] 3.2e-05 2.9e-05 [4,] 3.7e-05 2.8e-05 [5,] 3.5e-05 2.5e-05 [6,] 4.3e-05 3.3e-05 [7,] 3.9e-05 3.0e-05 [8,] 3.2e-05 4.8e-05 [9,] 3.0e-05 3.1e-05 [10,] 3.4e-05 3.7e-05 out2 [,1][,2] [1,] 3.5e-05 2.4e-05 [2,] 2.4e-05 3.5e-05 [3,] 4.1e-05 2.6e-05 [4,] 2.5e-05 3.9e-05 [5,] 4.1e-05 2.5e-05 [6,] 4.0e-05 3.1e-05 [7,] 2.9e-05 2.7e-05 [8,] 3.1e-05 3.3e-05 [9,] 3.5e-05 2.5e-05 [10,] 2.7e-05 3.4e-05 The probability of observing any value above 4 or below -4 is pnorm(4, lower.tail=FALSE) = 3.167124e-05. There does not seem to be anything suspicious from the run of 10. 3) I think this question might be more appropriate to post this question to R-devel. Please use an informative subject line. Please read the posting guide. Thanks. Regards, Adai On Mon, 2005-02-21 at 15:45 -0800, Scholz, Fritz wrote: I am wondering whether there is a bug in rnorm. When generating rnorm(100) and counting the cases 4 and the cases (-4) I get rather unexpectedly low counts for the latter. The problem goes away when using qnorm(runif(100)). Fritz Scholz, PhD Applied Statistics Group Boeing Phantom Works [EMAIL PROTECTED] 425-865-3623 Tu/We 206-542-6545 (most likely) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] rodbc or unixodbc error
Hi Sebastian. Another option you may want to entertain is the Rdbi packages from GRASS, http://grass.itc.it/statsgrass/r_and_dbms.html. This page begins with Postgresql but does have an option for MySQL. I'm running FreeBSD and unixODBC and never got RODBC running as it should. Also, the stats these guys thow up from a speed standpoint are fairly impressive. Again, another option for you to consider if you haven't already. Charles [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Reproducing SAS GLM in R
Hi, I'm still trying to figure out that GLM procedure in SAS. Let's start with the simple example: PROC GLM; MODEL col1 col3 col5 col7 col9 col11 col13 col15 col17 col19 col21 col23 =/nouni; repeated roi 6, ord 2/nom mean; TITLE 'ABDERUS lat ACC 300-500'; That's the same setup that I had in my last email. I have three factors: facSubj,facCond and facRoi. I had this pretty much figured out with three lengthy calls to lm(), but I have to extend my code to also work on models with four, five or even six factors, so that doesn't seem like a practical method any more. I've tried with the following code with glm(),anova() and drop1() (I use sum contrasts to reproduce those Type III SS values); I've also tried many other things, but this is the only somewhat reasonable result I get with glm. options(contrasts=c(contr.sum,contr.poly)) test.glm - glm(vecData ~ (facCond+facSubj+facRoi)^2) anova(test.glm,test=F) Analysis of Deviance Table Model: gaussian, link: identity Response: vecData Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev FPr(F) NULL 2391429.30 facCond 1 2.21 2381427.09 3.0764 0.08266 . facSubj 19 685.94 219 741.16 50.2463 2.2e-16 *** facRoi5 258.77 214 482.38 72.0316 2.2e-16 *** facCond:facSubj 19 172.70 195 309.68 12.6510 2.2e-16 *** facCond:facRoi510.37 190 299.31 2.8867 0.01803 * facSubj:facRoi 95 231.0595 68.26 3.3850 4.266e-09 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 drop1(test.glm,scope=.~.,test=F) Single term deletions Model: vecData ~ (facCond + facSubj + facRoi)^2 Df Deviance AIC F value Pr(F) none68.26 671.33 facCond 170.47 676.97 3.0764 0.08266 . facSubj 19 754.19 1209.89 50.2463 2.2e-16 *** facRoi 5 327.03 1037.35 72.0316 2.2e-16 *** facCond:facSubj 19 240.96 936.05 12.6510 2.2e-16 *** facCond:facRoi 578.63 695.27 2.8867 0.01803 * facSubj:facRoi 95 299.31 836.09 3.3850 4.266e-09 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Now, unfortunately this just isn't the output of SAS (roi corresponds to facRoi, ord corresponds to facCond) SourceDF Type III SS Mean Square F Value Pr F roi5 258.772680651.754536121.28 .0001 Error(roi)95 231.0511739 2.4321176 Adj Pr F Source G - G H - F roi .0001.0001 Error(roi) Greenhouse-Geisser Epsilon0.5367 Huynh-Feldt Epsilon 0.6333 SourceDF Type III SS Mean Square F Value Pr F ord1 2.2104107 2.2104107 0.24 0.6276 Error(ord)19 172.7047994 9.0897263 SourceDF Type III SS Mean Square F Value Pr F roi*ord5 10.370349182.07406984 2.89 0.0180 Error(roi*ord)95 68.257322550.71849813 Adj Pr F Source G - G H - F roi*ord 0.06630.0591 Error(roi*ord) Greenhouse-Geisser Epsilon0.4116 Huynh-Feldt Epsilon 0.4623 As you can see, I get a correct p and F values for the facCond:facRoi interaction, but everything else doesn't come out right. The drop1() call gives me the correct degrees of freedom, but residual degrees of freedom seem to be wrong. Could you give me any hints how I could get to the SAS results? For the lm() calls that work (in special cases), refer to my posting from last Friday. I also have a 4-factorial example, and I've been told that people around here do 5- or 6-factorial multivariant ANOVAs, too, so I need a general solution. Thanks a lot! Bela __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reproducing SAS GLM in R
Bela Bauer wrote: snip A quick addition: I've read https://stat.ethz.ch/pipermail/r-help/2000-November/007457.html but I really can't get around using those mechanisms because it will already be quite a transition for users to go from SAS to R...and I can't give them different results, too! I've also seen http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf, which originally made me try drop1() and all that, but it doesn't seem to help me either... Bela __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Run Sweave and LaTeX directly from command line
Hello! Those of you, who use Sweave a lot, will probably find my shell script usable. You can get it at: http://www.bfro.uni-lj.si/MR/ggorjan/programs/shell/Sweave.sh No warranty, however don't hesitate to contact me if you find an error or have a patch! -- Lep pozdrav / With regards, Gregor GORJANC --- University of Ljubljana Biotechnical Faculty URI: http://www.bfro.uni-lj.si Zootechnical Departmentmail: gregor.gorjanc at bfro.uni-lj.si Groblje 3 tel: +386 (0)1 72 17 861 SI-1230 Domzalefax: +386 (0)1 72 17 888 Slovenia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reproducing SAS GLM in R
Bela Bauer [EMAIL PROTECTED] writes: Hi, I'm still trying to figure out that GLM procedure in SAS. Let's start with the simple example: PROC GLM; MODEL col1 col3 col5 col7 col9 col11 col13 col15 col17 col19 col21 col23 =/nouni; repeated roi 6, ord 2/nom mean; TITLE 'ABDERUS lat ACC 300-500'; That's the same setup that I had in my last email. I have three factors: facSubj,facCond and facRoi. I had this pretty much figured out with three lengthy calls to lm(), but I have to extend my code to also work on models with four, five or even six factors, so that doesn't seem like a practical method any more. I've tried with the following code with glm(),anova() and drop1() (I use sum contrasts to reproduce those Type III SS values); I've also tried many other things, but this is the only somewhat reasonable result I get with glm. options(contrasts=c(contr.sum,contr.poly)) test.glm - glm(vecData ~ (facCond+facSubj+facRoi)^2) anova(test.glm,test=F) Why glm() and not lm()?? However, the real crucial thing here is that SAS is de facto fitting a mixed-effects model, with random effects being everything with Subject inside. So, except for the GG/HF business, you should get something similar if you try summary(aov(vecData ~ facCond*facRoi + Error(facSubj/(facCond*facRoi)) )) (If you want a closer parallel to the SAS approach, you have to wait for the mlm extensions that I have planned. I'll get to the GG/HF issue Real Soon Now.) Analysis of Deviance Table Model: gaussian, link: identity Response: vecData Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev FPr(F) NULL 2391429.30 facCond 1 2.21 2381427.09 3.0764 0.08266 . facSubj 19 685.94 219 741.16 50.2463 2.2e-16 *** facRoi5 258.77 214 482.38 72.0316 2.2e-16 *** facCond:facSubj 19 172.70 195 309.68 12.6510 2.2e-16 *** facCond:facRoi510.37 190 299.31 2.8867 0.01803 * facSubj:facRoi 95 231.0595 68.26 3.3850 4.266e-09 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 drop1(test.glm,scope=.~.,test=F) Single term deletions Model: vecData ~ (facCond + facSubj + facRoi)^2 Df Deviance AIC F value Pr(F) none68.26 671.33 facCond 170.47 676.97 3.0764 0.08266 . facSubj 19 754.19 1209.89 50.2463 2.2e-16 *** facRoi 5 327.03 1037.35 72.0316 2.2e-16 *** facCond:facSubj 19 240.96 936.05 12.6510 2.2e-16 *** facCond:facRoi 578.63 695.27 2.8867 0.01803 * facSubj:facRoi 95 299.31 836.09 3.3850 4.266e-09 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Now, unfortunately this just isn't the output of SAS (roi corresponds to facRoi, ord corresponds to facCond) SourceDF Type III SS Mean Square F Value Pr F roi5 258.772680651.754536121.28 .0001 Error(roi)95 231.0511739 2.4321176 Adj Pr F Source G - G H - F roi .0001.0001 Error(roi) Greenhouse-Geisser Epsilon0.5367 Huynh-Feldt Epsilon 0.6333 SourceDF Type III SS Mean Square F Value Pr F ord1 2.2104107 2.2104107 0.24 0.6276 Error(ord)19 172.7047994 9.0897263 SourceDF Type III SS Mean Square F Value Pr F roi*ord5 10.370349182.07406984 2.89 0.0180 Error(roi*ord)95 68.257322550.71849813 Adj Pr F Source G - G H - F roi*ord 0.06630.0591 Error(roi*ord) Greenhouse-Geisser Epsilon0.4116 Huynh-Feldt Epsilon 0.4623 As you can see, I get a correct p and F values for the facCond:facRoi interaction, but everything else doesn't come out right. The drop1() call gives me the correct degrees of freedom, but residual degrees of freedom seem to be wrong. Could you give me any hints how I could get to the SAS results? For the lm() calls that work (in special cases), refer to my posting from last Friday. I also have a 4-factorial example, and I've been told that people around here do 5- or 6-factorial multivariant ANOVAs, too, so I need a general solution. Thanks a lot! Bela __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!
Re: [R] Reproducing SAS GLM in R
It seems that you want to do is in a Anova with the within factors factCond and factRoi, right? If this is correct, then you should try: summary(aov(vectdata~factCond*factRoi+Error(factCond*factRoi))) Christophe Pallier www.pallier.org Bela Bauer wrote: Hi, I'm still trying to figure out that GLM procedure in SAS. Let's start with the simple example: PROC GLM; MODEL col1 col3 col5 col7 col9 col11 col13 col15 col17 col19 col21 col23 =/nouni; repeated roi 6, ord 2/nom mean; TITLE 'ABDERUS lat ACC 300-500'; That's the same setup that I had in my last email. I have three factors: facSubj,facCond and facRoi. I had this pretty much figured out with three lengthy calls to lm(), but I have to extend my code to also work on models with four, five or even six factors, so that doesn't seem like a practical method any more. I've tried with the following code with glm(),anova() and drop1() (I use sum contrasts to reproduce those Type III SS values); I've also tried many other things, but this is the only somewhat reasonable result I get with glm. options(contrasts=c(contr.sum,contr.poly)) test.glm - glm(vecData ~ (facCond+facSubj+facRoi)^2) anova(test.glm,test=F) Analysis of Deviance Table Model: gaussian, link: identity Response: vecData Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev FPr(F) NULL 2391429.30 facCond 1 2.21 2381427.09 3.0764 0.08266 . facSubj 19 685.94 219 741.16 50.2463 2.2e-16 *** facRoi5 258.77 214 482.38 72.0316 2.2e-16 *** facCond:facSubj 19 172.70 195 309.68 12.6510 2.2e-16 *** facCond:facRoi510.37 190 299.31 2.8867 0.01803 * facSubj:facRoi 95 231.0595 68.26 3.3850 4.266e-09 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 drop1(test.glm,scope=.~.,test=F) Single term deletions Model: vecData ~ (facCond + facSubj + facRoi)^2 Df Deviance AIC F value Pr(F) none68.26 671.33 facCond 170.47 676.97 3.0764 0.08266 . facSubj 19 754.19 1209.89 50.2463 2.2e-16 *** facRoi 5 327.03 1037.35 72.0316 2.2e-16 *** facCond:facSubj 19 240.96 936.05 12.6510 2.2e-16 *** facCond:facRoi 578.63 695.27 2.8867 0.01803 * facSubj:facRoi 95 299.31 836.09 3.3850 4.266e-09 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Now, unfortunately this just isn't the output of SAS (roi corresponds to facRoi, ord corresponds to facCond) SourceDF Type III SS Mean Square F Value Pr F roi5 258.772680651.754536121.28 .0001 Error(roi)95 231.0511739 2.4321176 Adj Pr F Source G - G H - F roi .0001.0001 Error(roi) Greenhouse-Geisser Epsilon0.5367 Huynh-Feldt Epsilon 0.6333 SourceDF Type III SS Mean Square F Value Pr F ord1 2.2104107 2.2104107 0.24 0.6276 Error(ord)19 172.7047994 9.0897263 SourceDF Type III SS Mean Square F Value Pr F roi*ord5 10.370349182.07406984 2.89 0.0180 Error(roi*ord)95 68.257322550.71849813 Adj Pr F Source G - G H - F roi*ord 0.06630.0591 Error(roi*ord) Greenhouse-Geisser Epsilon0.4116 Huynh-Feldt Epsilon 0.4623 As you can see, I get a correct p and F values for the facCond:facRoi interaction, but everything else doesn't come out right. The drop1() call gives me the correct degrees of freedom, but residual degrees of freedom seem to be wrong. Could you give me any hints how I could get to the SAS results? For the lm() calls that work (in special cases), refer to my posting from last Friday. I also have a 4-factorial example, and I've been told that people around here do 5- or 6-factorial multivariant ANOVAs, too, so I need a general solution. Thanks a lot! Bela __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: Run Sweave and LaTeX directly from command line
On Tue, 22 Feb 2005 14:29:00 +0100, Gregor GORJANC (GG) wrote: Hello! Those of you, who use Sweave a lot, will probably find my shell script usable. You can get it at: http://www.bfro.uni-lj.si/MR/ggorjan/programs/shell/Sweave.sh No warranty, however don't hesitate to contact me if you find an error or have a patch! Very nice! Side note 1: R ships a version of texi2dvi, hence you might use that one in case rubber is not found. side note 2: For make afficionados the follwing 2 rules in combination with the Sweave script from the FAQ do almost the same (that's what I use :-) %.tex: %.Rnw Sweave $ %.pdf : %.tex texi2dvi --clean --pdf $ Best, Fritz Leisch -- --- Friedrich Leisch Institut für Statistik Tel: (+43 1) 58801 10715 Technische Universität WienFax: (+43 1) 58801 10798 Wiedner Hauptstraße 8-10/1071 A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Loading C functions into R
Hi everybody, I have the source of a C program that includes some archives .c and some libraries .h. I'm developing a program using R and I want it to load the C program I told before. How can I do that? I was looking for some function in R to do that and I found the .C() but I can't understand how it works. Somebody could help me? Thanx, Talita Perciano Costa Leite Graduanda em Ciência da Computação Universidade Federal de Alagoas - UFAL Departamento de Tecnologia da Informação - TCI Construção de Conhecimento por Agrupamento de Dados - CoCADa __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] ERROR NaNs produced; when comparing two logistic regression models with the ANOVA CHI test
Dear R-list, *When comparing two logistic regression models with the anova CHi test, I obtain the following error: (there are no NA's in the time series). How can this be solved such that I can compare two models on the same dataset were different explanatory variables are used? l.KBDI - glm(zna.arson2 ~ zna.KBDI,family = binomial) l.NDWI - glm(zna.arson2 ~ zna.NDWI,family = binomial) anova(l.KBDI,l.NDWI, test = Chi) Analysis of Deviance Table Model 1: zna.arson2 ~ zna.KBDI Model 2: zna.arson2 ~ zna.NDWI Resid. Df Resid. Dev Df Deviance P(|Chi|) 1 110123.227 2 110113.593 09.635 Warning message: NaNs produced in: pchisq(q, df, lower.tail, log.p) *Is this caused by the non-linearity of the data? *How can I obtain a p-value? Thanks, Jan ___ ir. Jan Verbesselt Research Associate Lab of Geomatics and Forest Engineering K.U. Leuven Vital Decosterstraat 102. B-3000 Leuven Belgium Tel:+32-16-329750 Fax: +32-16-329760 http://gloveg.kuleuven.ac.be/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R-help
R-help, I am tring to create a plot with two y-axis. I found an example which is fine but the problem is that the range of the second y-axes appears in the first y-axes causing confusion. The example I refer to is : ## dev.off() ## start with a new graphics device # X11() or postscript() plot(x-rnorm(100),y-rnorm(100)) z-rnorm(100)*250 par(new=T) ## Tell R not to reinitialize graphic device ## for subsequent plots plot(x,z,col='blue',axes=F) axis(side=4,col.axis='blue') par(new=F) ## which can be found at : http://www.demog.berkeley.edu/faq/node21.html I also have a home made-example with exactly the same problem (pretty much the same as above) Any solution? Thanks in advance. version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor0.1 year 2004 month11 day 15 language R __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reproducing SAS GLM in R
Peter Dalgaard wrote: However, the real crucial thing here is that SAS is de facto fitting a mixed-effects model, with random effects being everything with Subject inside. So, except for the GG/HF business, you should get something similar if you try summary(aov(vecData ~ facCond*facRoi + Error(facSubj/(facCond*facRoi)) )) Hm...that worked. Didn't expect it to be that simple! I had tried models that were almost the same, but I didn't try that one... (If you want a closer parallel to the SAS approach, you have to wait for the mlm extensions that I have planned. I'll get to the GG/HF issue Real Soon Now.) Well, I'll probably be the first one to be all over testing it! Thanks a lot! Bela __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] ERROR NaNs produced; when comparing two logistic regression models with the ANOVA CHI test
You need the models to be NESTED for this test to be valid. Look up `analysis of deviance' in your textbooks. You get the error because you have two unnested models with the same number of parameters, so the F numerator is divided by 0. (But this is merely a symptom of incorrect usage.) On Tue, 22 Feb 2005, Jan Verbesselt wrote: Dear R-list, *When comparing two logistic regression models with the anova CHi test, I obtain the following error: (there are no NA's in the time series). How can this be solved such that I can compare two models on the same dataset were different explanatory variables are used? l.KBDI - glm(zna.arson2 ~ zna.KBDI,family = binomial) l.NDWI - glm(zna.arson2 ~ zna.NDWI,family = binomial) anova(l.KBDI,l.NDWI, test = Chi) Analysis of Deviance Table Model 1: zna.arson2 ~ zna.KBDI Model 2: zna.arson2 ~ zna.NDWI Resid. Df Resid. Dev Df Deviance P(|Chi|) 1 110123.227 2 110113.593 09.635 Warning message: NaNs produced in: pchisq(q, df, lower.tail, log.p) *Is this caused by the non-linearity of the data? *How can I obtain a p-value? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] ERROR NaNs produced; when comparing two logistic regression models with the ANOVACHI test
these models are not nested and thus LRT should not be used. You get no p-value because Df=0 in your case. As an alternative you could look at the deviances. I hope it helps. Best, Dimitris p.s., you referred to `non-linearity of the data' if you mean that the probability of positive responses is a nonlinear function of your explanatory variables then you could use splines to model it (see e.g., at function `lrm()' from the Design package). Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Jan Verbesselt [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, February 22, 2005 3:19 PM Subject: [R] ERROR NaNs produced;when comparing two logistic regression models with the ANOVACHI test Dear R-list, *When comparing two logistic regression models with the anova CHi test, I obtain the following error: (there are no NA's in the time series). How can this be solved such that I can compare two models on the same dataset were different explanatory variables are used? l.KBDI - glm(zna.arson2 ~ zna.KBDI,family = binomial) l.NDWI - glm(zna.arson2 ~ zna.NDWI,family = binomial) anova(l.KBDI,l.NDWI, test = Chi) Analysis of Deviance Table Model 1: zna.arson2 ~ zna.KBDI Model 2: zna.arson2 ~ zna.NDWI Resid. Df Resid. Dev Df Deviance P(|Chi|) 1 110123.227 2 110113.593 09.635 Warning message: NaNs produced in: pchisq(q, df, lower.tail, log.p) *Is this caused by the non-linearity of the data? *How can I obtain a p-value? Thanks, Jan ___ ir. Jan Verbesselt Research Associate Lab of Geomatics and Forest Engineering K.U. Leuven Vital Decosterstraat 102. B-3000 Leuven Belgium Tel:+32-16-329750 Fax: +32-16-329760 http://gloveg.kuleuven.ac.be/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R-help
I am tring to create a plot with two y-axis. I found an example which is fine but the problem is that the range of the second y-axes appears in the first y-axes causing confusion. [...] The key is the ann = FALSE in the second plot(): n = 100 x = rnorm(n) y = rnorm(n) z = rnorm(n) * 250 par(mar = c(5, 4, 4, 5) + 0.1) plot(x, y, ann = FALSE) par(new = TRUE) plot(x, z, col = 'blue', axes = FALSE, ann = FALSE) axis(side = 4, col.axis = 'blue') title(xlab = 'x', ylab = 'y') mtext('z', side = 4, line = 3) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R-help
This is what you are trying to get at I think: dev.off() ## start with a new graphics device # X11() or postscript() #par(mar = c(3,3,1,3), oma = c(0,0,0,0), mgp = c(2, 1, 0), bg = white) par(mar = rep(5,4)) plot(x-rnorm(100),y-rnorm(100), ylab = This is y, xlab = This is x) z-rnorm(100)*250 par(new=T) ## Tell R not to reinitialize graphic device ## for subsequent plots plot(x,z,col='blue',axes=F, xlab=, ylab=) axis(side=4,col.axis='blue', labels = T) mtext(This is z, 4, 2, col = blue) par(new=F) HTH, Andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Luis Ridao Cruz Sent: Tuesday, February 22, 2005 9:29 AM To: r-help@stat.math.ethz.ch Subject: [R] R-help R-help, I am tring to create a plot with two y-axis. I found an example which is fine but the problem is that the range of the second y-axes appears in the first y-axes causing confusion. The example I refer to is : ## dev.off() ## start with a new graphics device # X11() or postscript() plot(x-rnorm(100),y-rnorm(100)) z-rnorm(100)*250 par(new=T) ## Tell R not to reinitialize graphic device ## for subsequent plots plot(x,z,col='blue',axes=F) axis(side=4,col.axis='blue') par(new=F) ## which can be found at : http://www.demog.berkeley.edu/faq/node21.html I also have a home made-example with exactly the same problem (pretty much the same as above) Any solution? Thanks in advance. version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor0.1 year 2004 month11 day 15 language R __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] using 'nice' with R
I would like to use the 'nice' command when running CPU-intensive R functions on a server. Will starting R with 'nice R' do the trick? -- Robert Burrows, PhD New England Biometrics [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] using 'nice' with R
On a Unix like system you can do `nice +19 R' or perhaps `nice +19 R CMD BATCH commands.R'. -roger Robert Burrows wrote: I would like to use the 'nice' command when running CPU-intensive R functions on a server. Will starting R with 'nice R' do the trick? -- Roger D. Peng http://www.biostat.jhsph.edu/~rpeng/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] re: rnorm??
I was not able to reproduce the behavior reported in my message below. I was trying it on the same laptop in the same workspace using again R 2.0.0, but the low counts of 4 to 7 (witnesses by some of my colleagues) did not show up again. Please do not spend any more effort on this. I am wondering whether there is a bug in rnorm. When generating rnorm(100) and counting the cases 4 and the cases (-4) I get rather unexpectedly low counts for the latter. The problem goes away when using qnorm(runif(100)). Fritz Scholz, PhD Applied Statistics Group Boeing Phantom Works [EMAIL PROTECTED] 425-865-3623 Tu/We 206-542-6545 (most likely) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with se.contrast()
Dear Prof Ripley, Dear Prof Dalgaard Thank you both for your help. I tried it with helmert contrasts and got a result that is consistent with lme. I didn't realize that the parameterization of the model has an influence on the contrasts that I tried to test. It seems that I should read a little bit more about this issue for my better understanding. I have one last point to propose: You could include (as interim solution) a warning (that there might be an in efficiency loss) in se.contrast() if one uses non-orthogonal contrasts and a multi-stratum model. Best regards, Christoph Buser -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C11 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-5414 fax: 632-1228 http://stat.ethz.ch/~buser/ -- Prof Brian Ripley writes: On Mon, 21 Feb 2005, Peter Dalgaard wrote: Prof Brian Ripley [EMAIL PROTECTED] writes: test.aov - with(testdata,aov(Measurement ~ Material + Error(Lab/Material))) se.contrast(test.aov, list(Material==A,Material==B,Material==C,Material==D), coef=c(0.5,0.5,-0.5,-0.5),data=testdata) [1] 0.1432572 I got a different result and I have admit that I didn't understand why there is a differnce between the lme model and this one. There are some comments in the help pages but I'm not sure if this is the answer. It is. You used the default `contrasts', which are not actually contrasts. With options(contrasts=c(contr.helmert, contr.poly)) it gives the same answer as the other two. Because you used non-contrasts there was an efficiency loss (to the Intercept stratum). Brian, I'm not sure how useful that contrasts-that-are-not-contrasts line is. I agree, it was not precise enough (too late at night for me). Try `non-orthogonal contrasts'. The issue was correct though, it is the choice of contrasts, and as I would automatically use orthogonal contrasts with aov() I had not encountered it and it took me a while to pick up on what Christoph had done differently from me (I had run the example and got the same result as the randomized-block analysis before my original post). There's a comment in the code for aov: ## helmert contrasts can be helpful: do we want to force them? ## this version does for the Error model. and perhaps we should make them the default for the per-stratum fits. It certainly depends on your definition of contrasts. Contrast matrices having zero column sums was not part of the definition I was taught. I have contrasts as representations of the group mean structure that are invariant to changes of the overall level, so treatment contrasts are perfectly good contrasts in my book. I don't think Yates thought in those terms, and the whole idea of dividing into strata (and the generalized Yates algorithm) is based on contrasts being orthogonal to the overall mean (and to things in other strata). It was that, not zero-sum, that I was taught, but in balanced cases such as here it is the same thing. The zero-sum condition strikes me as a bit arbitrary: after all there are perfectly nice orthogonal designs where some levels of a factor occur more frequently than others. Balance and orthogonality are not quite the same, though. This in turn makes me a bit wary of what is going on inside se.contrasts, but it's gotten too late for me to actually study the code tonight. Could you elaborate on where precisely the condition on the contrast matrices comes into play? In finding the projection lengths in eff.aovlist, here proj.len - lapply(aovlist, function(x) { asgn - x$assign[x$qr$pivot[1:x$rank]] sp - split(seq(along=asgn), attr(terms(x), term.labels)[asgn]) sapply(sp, function(x, y) sum(y[x]), y=diag(x$qr$qr)^2) }) using only the diagonal requires orthogonality of the coding. It is many years since I looked at this, and it is not immediately clear to me how best to calculate efficiencies without this assumption (which could be tested inside eff.aovlist, of course). [People wondering why this was ever useful given lme should be aware that 1) It predates the availability of lme. 2) When I first used this in 1998, lme appeared very slow. 3) People with a classical aov training (not me, but e.g. Bill Venables) think in these terms.] -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44
[R] colorbar for image
Dear colleges, Does anyone know, how to insert a color bar as used with filled.contour when using image? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with se.contrast()
On Tue, 22 Feb 2005, Christoph Buser wrote: Dear Prof Ripley, Dear Prof Dalgaard Thank you both for your help. I tried it with helmert contrasts and got a result that is consistent with lme. I didn't realize that the parameterization of the model has an influence on the contrasts that I tried to test. It seems that I should read a little bit more about this issue for my better understanding. I have one last point to propose: You could include (as interim solution) a warning (that there might be an in efficiency loss) in se.contrast() if one uses non-orthogonal contrasts and a multi-stratum model. If you meant on the help page, I have already done that. We are still thinking about how to detect the problem well enough, and possibly even to see if we can avoid it. It's trickier than I remembered, although I think I did probably once know. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Question about NA's
Hi, i got a little question about the NA's in vectors and matrices. When I want to do some operations on a matrix with some NA's it is possible to stripp them before the computation proceed (by na.rm=TRUE). But how can I stripp NA's when I want to proceed a 'if', 'for' or 'while' string? Because when I don't stripp them I always reveive the message :missing value where TRUE/FALSE needed. I don't know if I can use the method with na.rm=TRUE and if so, how I can do it. Thanks a lot in advance! Matthias Tips __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Error when using do.call
useRs, I'm using version 2.0.1 on Windows XP. I am a bit of a newbie and I am trying to learn the concept of computing on the language. I have an example that I think ought to work, but will not and I am not sure what I am doing wrong. I would like to sort a data frame by a list of columns. Eventually I would like to wrap this in a function so that I could sort data frames by a list determined from context. Any suggestions? Thanks for your patience as I strive to learn some of the finer points. Here is a reproduction of the problem: #*** * A - data.frame(X = sample(c(A,B),size=10,replace=T), Y = sample(c(T,F),size = 10, replace = T), Z = sample(1:10,size=10,replace=T)); arglist - list(); ind - 3:1 for(i in 1:3) { arglist[[i]] - as.name(paste(A[,,ind[i],],sep=)); } do.call(what=order,args=arglist) #*** * I get the following error message: do.call(what=order,args=arglist) Error in order('A[,3]','A[,2]','A[,1]') : Object A[,1] not found Thanks, -Tyler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Categories or clusters for univariate data
bounds for each group. My question is, is there a function in R that can do the same thing for more complex and subtle groupings in univariate data, and ** provide a statistical basis for the result? ** No. Others have suggested useful ways to **generate** reasonable hypotheses about subtle groupings in the data; however, by the nature and logic of hypothesis testing, one cannot then evaluate the statistical significance of any groupings that one purports to have found. One **possible** way of overcoming this dilemma is to randomly bifurcate the data into training and test sets, do ALL model development on the training set, and then evaluate statistical significance (once and only once) on the test set. However, one may argue that even this blows up type I error, as the random split likely preserves the same structures in both and thus doesn't eliminate the large bias of testing models fit to the random anomalies of the data set at hand. As A.S.C Ehrenberg argued many years ago -- and recent events on the U.S. Cox II regulatory stage have dramatized -- single sets of data cannot be used as the basis for scientific knowledge; multiple sets of data generated under different conditions and with different sources of exogenous variation are required. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Graphics
Hi, The R platform that I installed on my Windows XP crashes everytime that I try to run some sophisticated graphics (e.g. Demo Graphics). Is that to do with the configuration? Shall I reinstall it? Thanks, --- Cedric E. Ginestet PsyPAG Chair Psychology Department Thames Valley University Saint Mary's Road London W5 5RF 077-8688-4313 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Two-factorial Huynh-Feldt-Test
Bela Bauer wrote: I'm still looking for an efficient way to print the new summary. Is there any easy way to tell the summary or print functions about the corrected degrees of freedom? The standard way is not to print the adjusted df, but rather just the adjusted p-values (along with the \epsilon s) -Michael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] The system command and the LD_LIBRARY_PATH
Hi R-gurus, In my envirovment I have specified the LD_LIBRARY_PATH to /data/opt/libmy/lib After starting R the LD_LIBRARY_PATH variable is changed. Sys.getenv(LD_LIBRARY_PATH) /data/opt/R-devel//lib/R/lib:/usr/local/lib:/usr/X11R6/lib:/data/opt/libmy/lib The problem is that in /usr/local/lib is an acient version of mylib hence a call to _system_ with fails badly. Suggestions? Eryk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Run Sweave and LaTeX directly from command line
It might be possible to translate 90% of this into R leaving just a short shell portion in which case it would be easy to translate just that part into Windows batch making it available on that OS too. As someone already mentioned, using texi2dvi could be helpful too. Regards. Date: Tue, 22 Feb 2005 14:29:00 +0100 From: Gregor GORJANC [EMAIL PROTECTED] To: [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject: [R] Run Sweave and LaTeX directly from command line Hello! Those of you, who use Sweave a lot, will probably find my shell script usable. You can get it at: http://www.bfro.uni-lj.si/MR/ggorjan/programs/shell/Sweave.sh No warranty, however don't hesitate to contact me if you find an error or have a patch! -- Lep pozdrav / With regards, Gregor GORJANC --- University of Ljubljana Biotechnical Faculty URI: http://www.bfro.uni-lj.si Zootechnical Department mail: gregor.gorjanc at bfro.uni-lj.si Groblje 3 tel: +386 (0)1 72 17 861 SI-1230 Domzale fax: +386 (0)1 72 17 888 Slovenia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Graphics
On Tue, 22 Feb 2005 16:50:51 -, [EMAIL PROTECTED] wrote : Hi, The R platform that I installed on my Windows XP crashes everytime that I try to run some sophisticated graphics (e.g. Demo Graphics). Is that to do with the configuration? Shall I reinstall it? You should say what version you installed, and give the command that crashes it, but I would say there is definitely something wrong with your system or your install, because it certainly doesn't crash for most people. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Graphics
On Tue, 22 Feb 2005 [EMAIL PROTECTED] wrote: The R platform that I installed on my Windows XP crashes everytime that I try to run some sophisticated graphics (e.g. Demo Graphics). Is that to do with the configuration? Shall I reinstall it? Please consult the rw-FAQ. It is likely to be a problem with your Windows installation, as R runs on literally thousands (maybe tens of thousands) of Windows XP machines. PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html which points you at the rw-FAQ. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] colorbar for image
Klaus Ladner wrote: Does anyone know, how to insert a color bar as used with filled.contour when using image? See plot.im() (and im()) in the package spatstat. cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] The system command and the LD_LIBRARY_PATH
On Tue, 22 Feb 2005, W.E. Wolski wrote: Hi R-gurus, In my envirovment I have specified the LD_LIBRARY_PATH to /data/opt/libmy/lib After starting R the LD_LIBRARY_PATH variable is changed. Sys.getenv(LD_LIBRARY_PATH) /data/opt/R-devel//lib/R/lib:/usr/local/lib:/usr/X11R6/lib:/data/opt/libmy/lib The problem is that in /usr/local/lib is an acient version of mylib hence a call to _system_ with fails badly. Suggestions? Read the R-admin manual (as the INSTALL file asks) and set the flags correctly for your setup when you install R. In particular, read carefully what it says about LDFLAGS: this should not be a surprise to you. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Categories or clusters for univariate data
On Tue, 22 Feb 2005 08:41:07 -0800 Berton Gunter wrote: bounds for each group. My question is, is there a function in R that can do the same thing for more complex and subtle groupings in univariate data, and ** provide a statistical basis for the result? ** No. Others have suggested useful ways to **generate** reasonable hypotheses about subtle groupings in the data; however, by the nature and logic of hypothesis testing, one cannot then evaluate the statistical significance of any groupings that one purports to have found. Just one more remark on this: The above is, of course, true if standard inference would be applied on the same data that was used for finding the groupings. But it is also possible to test for the existence of such groupings using non-standard inference. For example, in a structural change context the supF test of Andrews (1993, Econometrica) is very popular in econometrics. It is essentially the LR statistic of the model without a breakpoint vs. the optimally segmented model with one breakpoint. But the distribution is then no longer Chi-squared as it has to be accounted for the selection of the breakpoint (i.e., the groupings). Hence, the standard approach in econometrics for this would be: 1. test for the existence of breaks 2. estimate breakpoints (if not already implicitely done in 1.) Of course, using a (cross-)validation approach is not a bad idea, either! Z __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] round() - strange results
Hello, I found that round() does not behave as I expected. Have you had similar experience as following? x-seq(0.5,10.5,by=1) x [1] 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 round(x) [1] 0 2 2 4 4 6 6 8 8 10 10 cbind(x,round(x)) x [1,] 0.5 0 [2,] 1.5 2 [3,] 2.5 2 [4,] 3.5 4 [5,] 4.5 4 [6,] 5.5 6 [7,] 6.5 6 [8,] 7.5 8 [9,] 8.5 8 [10,] 9.5 10 [11,] 10.5 10 Is this a well-known bug? Thanks in advance, Dongseok Choi, Ph.D. Assistant Professor Division of Biostatistics Department of Public Health Preventive Medicine Oregon Health Science University 3181 SW Sam Jackson Park Road, CB-669 Portland, OR 97239-3098 TEL) 503-494-5336 FAX) 503-494-4981 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] round() - strange results
This in NOT a bug. It is a convention (the IEEE standard). Read the help on round(). I.e. RTFM. cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] round() - strange results
Dongseok Choi wrote: Hello, I found that round() does not behave as I expected. Have you had similar experience as following? You have found the DOCUMENTED round to even rule, hence not a bug... Uwe Ligges x-seq(0.5,10.5,by=1) x [1] 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 round(x) [1] 0 2 2 4 4 6 6 8 8 10 10 cbind(x,round(x)) x [1,] 0.5 0 [2,] 1.5 2 [3,] 2.5 2 [4,] 3.5 4 [5,] 4.5 4 [6,] 5.5 6 [7,] 6.5 6 [8,] 7.5 8 [9,] 8.5 8 [10,] 9.5 10 [11,] 10.5 10 Is this a well-known bug? Thanks in advance, Dongseok Choi, Ph.D. Assistant Professor Division of Biostatistics Department of Public Health Preventive Medicine Oregon Health Science University 3181 SW Sam Jackson Park Road, CB-669 Portland, OR 97239-3098 TEL) 503-494-5336 FAX) 503-494-4981 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] round() - strange results
?round 'round' rounds the values in its first argument to the specified number of decimal places (default 0). Note that for rounding off a 5, the IEEE standard is used, _go to the even digit_. Therefore 'round(0.5)' is '0' and 'round(-1.5)' is '-2'. Dongseok Choi wrote: Hello, I found that round() does not behave as I expected. Have you had similar experience as following? x-seq(0.5,10.5,by=1) x [1] 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 round(x) [1] 0 2 2 4 4 6 6 8 8 10 10 cbind(x,round(x)) x [1,] 0.5 0 [2,] 1.5 2 [3,] 2.5 2 [4,] 3.5 4 [5,] 4.5 4 [6,] 5.5 6 [7,] 6.5 6 [8,] 7.5 8 [9,] 8.5 8 [10,] 9.5 10 [11,] 10.5 10 Is this a well-known bug? Thanks in advance, Dongseok Choi, Ph.D. Assistant Professor Division of Biostatistics Department of Public Health Preventive Medicine Oregon Health Science University 3181 SW Sam Jackson Park Road, CB-669 Portland, OR 97239-3098 TEL) 503-494-5336 FAX) 503-494-4981 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Error when using do.call
Why not just do: do.call(order, A[, ind]) ?? A data frame is already a list. Andy From: Brough, Tyler (FRS) useRs, I'm using version 2.0.1 on Windows XP. I am a bit of a newbie and I am trying to learn the concept of computing on the language. I have an example that I think ought to work, but will not and I am not sure what I am doing wrong. I would like to sort a data frame by a list of columns. Eventually I would like to wrap this in a function so that I could sort data frames by a list determined from context. Any suggestions? Thanks for your patience as I strive to learn some of the finer points. Here is a reproduction of the problem: #* ** * A - data.frame(X = sample(c(A,B),size=10,replace=T), Y = sample(c(T,F),size = 10, replace = T), Z = sample(1:10,size=10,replace=T)); arglist - list(); ind - 3:1 for(i in 1:3) { arglist[[i]] - as.name(paste(A[,,ind[i],],sep=)); } do.call(what=order,args=arglist) #* ** * I get the following error message: do.call(what=order,args=arglist) Error in order('A[,3]','A[,2]','A[,1]') : Object A[,1] not found Thanks, -Tyler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Hosting a R Graph Gallery?
Hi Hi, About any graph gallery: Philippe Grojean and me did have made some work. Our goal was to add a clip library to the SciViews project that would offer access to a graph gallery. I was workiong on the production of the gallery, where as Philippe is still working on his GUI API. One of the goal is to have automatic wizards to make easier the creation of a graphic. Here was our approach and some thoughts: - We should propose a format for a description file. Here are some elements that should be gathered for each graphic function: - Name of the function (*) - Name of the produced graphic (*) - Description of the graphic (*) - Number of variables (univariate / bivariate / multivariate...) - Types of variables - Sample code (sample graph) (*) - Package (*) The (*) are some information already available in Rd files (except maybe sample graph). - If someone deos something, I think it would be useful to ensure that all is reusable. We should focus on describing graphics. Then, for example, SciViews could use the information to create a usable graph gallery. Along similar lines, it would be useful if gallery entries could be submitted as a plain text or maybe an XML file. Something like: plot title=blah descyadda yadda/desc codeplot(1)/code /plot plot title=blah blah descyadda yadda yadda/desc codeplot(2)/code /plot This would allow people with existing sets of plots to generate an entire set of gallery submissions automagically from a script. It would also make it feasible to automagically generate gallery entries from the examples in packages such as graphics and lattice. If the central gallery repository actually stored the gallery entries in this sort of format (or possibly even in a database) then the gallery itself could be automagically published in a variety of different formats via scripts (e.g., web pages for display, web pages for editing entries, an enormous PDF document, an R package, ...). Paul If someone is interested, I ahve put in the following archive all my current code: http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/R/svGraphGallery.zip There is no explanation but I would provide comments and help to any volonteer (basically, there is a file .ggs with some descriptions as stated before and some R code to that produce HTML files). The result (the current gallery) is there. It is aimed to be something like 300 pixels large. At final step, graph would be clickable with a wizard. http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/R/svGraphGallery/dock/svGallery.html Eric At 08:46 21/02/2005, Robert Cunningham wrote: I too have often though a R-gallery would be useful. It seems to me that a Wiki-style page with a database backend would be the best bet. It also seems to be that the best place to start is a complete image gallery produced from all the examples in R base, then in packages in CRAN. In this context the graphicsQC package (http://www.stat.auckland.ac.nz/~paul/R/graphicsQC_0.4.tar.g) of Paul Murrell seems useful. Cheers, Robert Cunningham Romain Francois [EMAIL PROTECTED] writes: Hello Sander, That's a good idea and i am up to it. Right now i am in an exam period, so it's not really the better time, give me a couple of weeks and i will come up with a specific format of R files to submit to me that i could post-process to generate html documents. To my mind, those html files should show : - the plot itself + Submitter(s) - web page - email (eventually protected, I don't know how to do it) - Bibliographic references - Required R packages + Commentaries - in english - and in any other languages I'm open to any suggestion. Romain. Le 18.02.2005 14:33, Sander Oom a écrit : Dear R users, Following some of the recent questions and discussions about the R plotting abilities, it occurred to me again that it would be very valuable to have an R graph gallery. Eric Lecoutre made a very nice example in: http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/stats/fichiers/_gallery.pdf It would be very useful to many beginners, but probably also advanced users of R, to have an overview of R graph types with graphical examples and associated R code. In order to facilitate the evolution of a large gallery, some sort of wiki environment might be most suitable, thus providing access to all users, but with limited maintenance costs for the provider. Do others agree this could be a valuable resource? Would anybody have the resources to host such an R graph gallery? Yours, Sander Oom. -- Romain FRANCOIS : [EMAIL PROTECTED] page web : http://addictedtor.free.fr/ (en construction) 06 18 39 14 69 / 01 46 80 65 60 ___ Etudiant en 3eme année Institut de Statistique de l'Université de
[R] include C functions from nmath in my own C functions
Hi: I am writing a C program which need a gamma random number generator. I download the source file of R and compile, make it myself. There is a rgamma.c function in the installing directory of R(/home/zhliu/Backup/R-2.0.1/src/nmath/rgamma.c). My question is how to call this function in my own program which is in another directory. I can not copy this rgamma.c to my working directory and use #inclucdergamma.c because in the file rgamma.c, it includes other header files. Or I can use makefile, but I do not know how to edit my makefile to do this job. A related question is whether are similar .c files contains the matrix functions(product, invert) in the nmath library which I can use for my own C program? Thanks a lot! liu __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Hosting a R Graph Gallery?
Paul Murrell wrote: Along similar lines, it would be useful if gallery entries could be submitted as a plain text or maybe an XML file. Something like: plot title=blah descyadda yadda/desc codeplot(1)/code /plot plot title=blah blah descyadda yadda yadda/desc codeplot(2)/code /plot This would allow people with existing sets of plots to generate an entire set of gallery submissions automagically from a script. It would also make it feasible to automagically generate gallery entries from the examples in packages such as graphics and lattice. If the central gallery repository actually stored the gallery entries in this sort of format (or possibly even in a database) then the gallery itself could be automagically published in a variety of different formats via scripts (e.g., web pages for display, web pages for editing entries, an enormous PDF document, an R package, ...). Paul Huuumm, Paul,... all this remember me something: it is the definition of R help .Rd files! After all these are plain ASCII files, you can put various sections in them, you have one section to hold executable R code (example) and you already have tools to compile them into web pages, enormous PDF files, R packages, etc... The only thing that is missing is the possibility to include pictures in them... which seem to me quite important for a graph gallery! However, I guess this could be quite easily circumvented. The key thing would be to replace the textual index by a thumbnail of icons for the various graphs. Then, the way R packages are structured is just fine. You can even embed datasets you want to use as examples to illustrate your graphs, or custom functions for producing exotic graphs. If someone volunteers to maintain such a 'GraphGallery' package, them people could simply send .Rd pages to him, and the graph gallery would grow little by little that way. What? Why do you all look at me? No, I am not volunteer for that... at least not for the moment! I was just dreaming that it would be a nice tool for someone's R Graphics book that will be published shortly... :-) Best, Philippe ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Pentagone (3D08) ( ( ( ( (Academie Universitaire Wallonie-Bruxelles ) ) ) ) ) 8, av du Champ de Mars, 7000 Mons, Belgium ( ( ( ( ( ) ) ) ) ) phone: + 32.65.37.34.97, fax: + 32.65.37.30.54 ( ( ( ( (email: [EMAIL PROTECTED] ) ) ) ) ) ( ( ( ( (web: http://www.umh.ac.be/~econum ) ) ) ) ) http://www.sciviews.org ( ( ( ( ( .. [EMAIL PROTECTED] wrote: Hi Hi, About any graph gallery: Philippe Grojean and me did have made some work. Our goal was to add a clip library to the SciViews project that would offer access to a graph gallery. I was workiong on the production of the gallery, where as Philippe is still working on his GUI API. One of the goal is to have automatic wizards to make easier the creation of a graphic. Here was our approach and some thoughts: - We should propose a format for a description file. Here are some elements that should be gathered for each graphic function: - Name of the function (*) - Name of the produced graphic (*) - Description of the graphic (*) - Number of variables (univariate / bivariate / multivariate...) - Types of variables - Sample code (sample graph) (*) - Package (*) The (*) are some information already available in Rd files (except maybe sample graph). - If someone deos something, I think it would be useful to ensure that all is reusable. We should focus on describing graphics. Then, for example, SciViews could use the information to create a usable graph gallery. Along similar lines, it would be useful if gallery entries could be submitted as a plain text or maybe an XML file. Something like: plot title=blah descyadda yadda/desc codeplot(1)/code /plot plot title=blah blah descyadda yadda yadda/desc codeplot(2)/code /plot This would allow people with existing sets of plots to generate an entire set of gallery submissions automagically from a script. It would also make it feasible to automagically generate gallery entries from the examples in packages such as graphics and lattice. If the central gallery repository actually stored the gallery entries in this sort of format (or possibly even in a database) then the gallery itself could be automagically published in a variety of different formats via scripts (e.g., web pages for display, web pages for editing entries, an enormous PDF document, an R package, ...). Paul If someone is interested, I ahve put in the following archive all my current code: http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/R/svGraphGallery.zip There is no explanation but I would provide comments
RE: [R] Run Sweave and LaTeX directly from command line
Gabor, I definitely agree about use of R, however I am not so much in R as I am in Bash. It took me less than two hours to write this script. At home I use R under windows and I solve problem of portability with Cygwin. I know that this is not optimal solution for everyone but ... Can you provide me some insights/thoughts how this script might be written in R? I am open for discussion and cooperation on this script. What do you think Friedrich? I must look at this texi2dvi. I didn't hav any experience with it jet. I will look at it. -- Lep pozdrav / With regards, Gregor GORJANC --- University of Ljubljana Biotechnical Faculty URI: http://www.bfro.uni-lj.si Zootechnical Departmentemail: gregor.gorjanc at bfro.uni-lj.si Groblje 3 tel: +386 (0)1 72 17 861 SI-1230 Domzalefax: +386 (0)1 72 17 888 Slovenia --- -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: tor 2005-02-22 18:15 To: Gorjanc Gregor; [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Subject: RE: [R] Run Sweave and LaTeX directly from command line It might be possible to translate 90% of this into R leaving just a short shell portion in which case it would be easy to translate just that part into Windows batch making it available on that OS too. As someone already mentioned, using texi2dvi could be helpful too. Regards. Date: Tue, 22 Feb 2005 14:29:00 +0100 From: Gregor GORJANC [EMAIL PROTECTED] To: [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject: [R] Run Sweave and LaTeX directly from command line Hello! Those of you, who use Sweave a lot, will probably find my shell script usable. You can get it at: http://www.bfro.uni-lj.si/MR/ggorjan/programs/shell/Sweave.sh No warranty, however don't hesitate to contact me if you find an error or have a patch! -- Lep pozdrav / With regards, Gregor GORJANC --- University of Ljubljana Biotechnical Faculty URI: http://www.bfro.uni-lj.si Zootechnical Department mail: gregor.gorjanc at bfro.uni-lj.si Groblje 3 tel: +386 (0)1 72 17 861 SI-1230 Domzale fax: +386 (0)1 72 17 888 Slovenia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Sorting a matrix on two columns
Perhaps I read more into the question than others, but I thought he was asking about a stable sort. If that is the case, ?order says that the sort is stable except for method = quick. David L. Reiner -Original Message- From: Rau, Roland [mailto:[EMAIL PROTECTED] Sent: Monday, February 21, 2005 4:07 AM To: Jones, Glen R; r-help@stat.math.ethz.ch Subject: RE: [R] Sorting a matrix on two columns Hi Glen, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jones, Glen R If a matrix with 5 columns has been defined and the first two columns need to be sorted in ascending order, how can this be achieved whilst ensuring the other 3 columns data are in relative position to the sorted columns? does the following example-code help you? mymatrix should resemble the structure of your (original) matrix. mymatrix2 is the new, sorted matrix. mymatrix - matrix(runif(80), ncol=5) mymatrix[,1] - sample(c(1,2), size=length(mymatrix[,1]), replace=TRUE) mymatrix mymatrix2 - mymatrix[order(mymatrix[,1],mymatrix[,2]),] mymatrix2 Best, Roland + This mail has been sent through the MPI for Demographic Rese...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] include C functions from nmath in my own C functions
On Tue, 22 Feb 2005, yyan liu wrote: Hi: I am writing a C program which need a gamma random number generator. I download the source file of R and compile, make it myself. There is a rgamma.c function in the installing directory of R(/home/zhliu/Backup/R-2.0.1/src/nmath/rgamma.c). My question is how to call this function in my own program which is in another directory. I can not copy this rgamma.c to my working directory and use #inclucdergamma.c because in the file rgamma.c, it includes other header files. Or I can use makefile, but I do not know how to edit my makefile to do this job. See src/nmath/standalone/README. A related question is whether are similar .c files contains the matrix functions(product, invert) in the nmath library which I can use for my own C program? No. In general R uses LAPACK (or perhaps LINPACK) for such operations, and so can you. The API for nmath is described in the `Writing R Extensions' manual. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] innovative fun ways for teaching quality control
Hello: I was looking for innovative a fun ways of teaching quality control. Could you suggest me a resource where i could find material that might help me develop something like this. Thank you avneet (something like the paper helicopter or catapult etc.) I have no data yet. It is a capital mistake to theorize before one has data. Insensibly one begins to twist facts to suit theories instead of theories to suit facts. ~ Sir Arthur Conan Doyle (1859-1930), Sherlock Holmes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] round() - strange results
On Tue, 22 Feb 2005 10:10:58 -0800, Dongseok Choi [EMAIL PROTECTED] wrote : Hello, I found that round() does not behave as I expected. Have you had similar experience as following? x-seq(0.5,10.5,by=1) x [1] 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 round(x) [1] 0 2 2 4 4 6 6 8 8 10 10 cbind(x,round(x)) x [1,] 0.5 0 [2,] 1.5 2 [3,] 2.5 2 [4,] 3.5 4 [5,] 4.5 4 [6,] 5.5 6 [7,] 6.5 6 [8,] 7.5 8 [9,] 8.5 8 [10,] 9.5 10 [11,] 10.5 10 Is this a well-known bug? As others have said, it's not a bug at all. If you would like to round up instead, what you should do is use a function like this: roundup - function(x) trunc(x+0.5) x - -5:5 + 0.5 x [1] -4.5 -3.5 -2.5 -1.5 -0.5 0.5 1.5 2.5 3.5 4.5 5.5 round(x) [1] -4 -4 -2 -2 0 0 2 2 4 4 6 roundup(x) [1] -4 -3 -2 -1 0 1 2 3 4 5 6 If this doesn't handle negatives the way you want, play around a bit with abs(). Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Rdbi and ODBC
I have been using RODBC for a while with no complaints (R 2.0.1 patched under WinXP), then I saw a link (http://grass.itc.it/statsgrass/r_and_dbms.html) showing that Rdbi claims to run a query in 5 seconds that takes RODBC 4.3 minutes. That was hard enough for me to believe that I wanted to try some tests myself, but I cannot get Rdbi to connect to my ODBC database. Here is what works for RODBC for my setup: conn - odbcConnect(xf, xfl2, xfl2) Now for Rdbi the documentation is lacking. ?Rdbi doesn't work and ?dbConnect gives little detail and no examples. I tried all of the following without success: conn - dbConnect(ODBC(), dbname=xf, user=xfl2, password=xfl2) conn - dbConnect(ODBC, dbname=xf, user=xfl2, password=xfl2) conn - dbConnect(ODBC, dbname=xf, user=xfl2, password=xfl2) conn - dbConnect(ODBC(), dbname=xf, user=xfl2, password=xfl2) Also, if this package is so fast, how come its not available on CRAN? If I may ask a second question for my enlightenment. It seems that PostgreSQL and mySQL are pretty popular, but my database is in SQL Server and I do not have the ability to change it. How come every package has native drivers to PostreSQL and Oracle but none of them seem to have a native drive to SQL Server and I have to use ODBC? Thanks in advance for any advice. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Run Sweave and LaTeX directly from command line
Friedrich, This texi2dvi is also very nice. Dou you know of any pros and cons in comparison to rubber? Is tex2dvi also shipped with R for windows? I am not able to find a binnary in my windows installation, however I found help page. Did I missed anything? I have 2.0.1 On Tue, 22 Feb 2005 14:29:00 +0100, Gregor GORJANC (GG) wrote: Hello! Those of you, who use Sweave a lot, will probably find my shell script usable. You can get it at: http://www.bfro.uni-lj.si/MR/ggorjan/programs/shell/Sweave.sh No warranty, however don't hesitate to contact me if you find an error or have a patch! Very nice! Side note 1: R ships a version of texi2dvi, hence you might use that one in case rubber is not found. side note 2: For make afficionados the follwing 2 rules in combination with the Sweave script from the FAQ do almost the same (that's what I use :-) %.tex: %.Rnw Sweave $ %.pdf : %.tex texi2dvi --clean --pdf $ Best, Fritz Leisch -- --- Friedrich Leisch Institut fr Statistik Tel: (+43 1) 58801 10715 Technische Universitt WienFax: (+43 1) 58801 10798 Wiedner Hauptstrae 8-10/1071 A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Run Sweave and LaTeX directly from command line
There are two main TeX distributions for Windows, MiKTeX and fptex. texi2dvi.exe ships with MiKTeX but not fptex. I think fptex has a texi2dvi UNIX shell script that in principle could be used with the Cygwin shell on Windows though I have never tried it. Because of that MiKTeX is really the only one of the two distributions that fully supports R although many people who use R on Windows apparently use fptex and it does not give problems apparently provided you don't get into currently lesser used features such as vignettes (althoutgh that may change). Date: Tue, 22 Feb 2005 23:03:03 +0100 From: Gorjanc Gregor [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Cc: [EMAIL PROTECTED] Subject: RE: [R] Run Sweave and LaTeX directly from command line Friedrich, This texi2dvi is also very nice. Dou you know of any pros and cons in comparison to rubber? Is tex2dvi also shipped with R for windows? I am not able to find a binnary in my windows installation, however I found help page. Did I missed anything? I have 2.0.1 On Tue, 22 Feb 2005 14:29:00 +0100, Gregor GORJANC (GG) wrote: Hello! Those of you, who use Sweave a lot, will probably find my shell script usable. You can get it at: http://www.bfro.uni-lj.si/MR/ggorjan/programs/shell/Sweave.sh No warranty, however don't hesitate to contact me if you find an error or have a patch! Very nice! Side note 1: R ships a version of texi2dvi, hence you might use that one in case rubber is not found. side note 2: For make afficionados the follwing 2 rules in combination with the Sweave script from the FAQ do almost the same (that's what I use :-) %.tex: %.Rnw Sweave $ %.pdf : %.tex texi2dvi --clean --pdf $ Best, Fritz Leisch -- --- Friedrich Leisch Institut für Statistik Tel: (+43 1) 58801 10715 Technische Universität Wien Fax: (+43 1) 58801 10798 Wiedner Hauptstraße 8-10/1071 A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: R-help Digest, Vol 24, Issue 22
You need to give the model formula that gave your output. There are two sources of variation (at least), within and between locations; though it looks as though your analysis may have tried to account for this (but if so, the terms are not laid out in a way that makes for ready interpretation. The design is such (two locations) that you do not have much of a check that effects are consistent over locations. You need to check whether results really are similar for all cultivars and for all herbicides, so that it is legitimate to pool as happens in the overall analysis. If a herbicide:cultivar combination has little effect the variability may be large, while if it has a dramatic effect (kills everything!), there may be no variability to speak of. John Maindonald. On 22 Feb 2005, at 10:06 PM, [EMAIL PROTECTED] wrote: To: 'Bob Wheeler' [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: RE: [R] power.anova.test for interaction effects Reply-To: [EMAIL PROTECTED] It's a rather complex model. A 37*4 factorial (37 cultivars[var]; 4 herbicide treatments[trt]) with three replications[rep] was carried out at two locations[loc], with different randomizations within each rep at each location. Source DF Error Term MS Loc 1 Trt*rep(loc)12314 Rep(loc) 4 Trt*rep(loc)1230.5 Trt 3 Trt*rep(loc)64.72 Trt*loc 3 Trt*rep(loc)33.42 Trt*rep(loc) 12 Residual76.78 Var 36 Var*trt*loc 93.91 Var*trt 108 Var*trt*loc 12.06 Var*trt*loc 144 Residual43.09 Residual575 NA 21.23 -Original Message- From: Bob Wheeler [mailto:[EMAIL PROTECTED] Sent: Monday, February 21, 2005 4:33 PM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] power.anova.test for interaction effects Your F value is so low as to make me suspect your model. Where did the 144 denominator degrees of freedom come from? John Maindonald email: [EMAIL PROTECTED] phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Bioinformation Science, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] ROracle installation
Can someone tell me how to install ROracle package to PC? I couldn't find it CRAN package list. And when I tried to install from zip file, it failed. Thanks, Jane __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Memory error in Mac OS X Aqua GUI v1.01 with cluster package functions
I'm sorry if the answer to my problem is buried in the archives. I have limited experience with R and I couldn't find a solution to my particular problem. I am running Mac OS X Aqua GUI v1.01 on a new G5 running os 10.3.8 with a 1.8Ghz processor and 1GB of sdram. I just downloaded bioconducter a week ago and I'm trying to cluster a matrix I created with a simulation with dimensions dim(nca35) [1] 1048112 with size object.size(nca352) [1] 1426204 I checked my ulimits variable on the unix terminal and it says it's unlimited as does mem.limits() nsize vsize NANA But I'm still getting errors like the following with funtions in the cluster package daisy(nca352, metric= euclidean, stand=FALSE)-dnca35 Error: cannot allocate vector of size 858213 Kb *** malloc: vm_allocate(size=878813184) failed (error code=3) *** malloc[599]: error: Can't allocate region if it helps i also checked gc() used (Mb) gc trigger (Mb) Ncells 448662 12.0 741108 19.8 Vcells 847630 6.5 135357901 1032.7 I tried the suggested unix command in the memory help doc but that doesn't work in the Aqua GUI. Can someone tell me how to change the Vcells? Although to the best of my understanding (which is limited) I shouldn't have to do that. Any suggestions would be greatly appreciated. thanks, betty -- Betty Gilbert [EMAIL PROTECTED] Taylor Lab Plant and Microbial Biology 321 Koshland Hall U.C. Berkeley Berkeley, Ca 94720 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] estimate the parameter of exponential distribution, etc.
Given a numeric vector of observations, does R have any generic way to estimate the parameters of commonly used distributions (exponential, gamma, etc.) without numerically optimizing the likelihood function? Thanks, David ___ David R. Bickel http://davidbickel.com Research Scientist Pioneer Hi-Bred International Bioinformatics Exploratory Research 7250 NW 62nd Ave., PO Box 552 Johnston, Iowa 50131-0552 515-334-4739 Tel 515-334-6634 Fax [EMAIL PROTECTED], [EMAIL PROTECTED] This communication is for use by the intended recipient and ...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Does R has the function for garch-t, gjr-garch, qgarch and egarch
Dear all, I would like to know that R has the function for garch-t,gjr- garch,qgarch and egarch. Best Regards, Luck __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] nonlinear least square fit of an unknown function
Hi, I have a set of twelve points and wonder how I can get a function that can then be used to calculate the area under the curve (most important). Thanks. Eric __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Package pixmap breaks try() under circumstances
Dear R users, in some circumstances, try() shows a strange behaviour, when the pixmap package is loaded. The following piece of code works as expected, if it is either sourced in an interactive session or invoked via R CMD BATCH (the try-error is printed). However, if i invoke R using ``R --vanilla source.R'', the execution halts (without printing the try-error). # source.R library(pixmap) x - numeric() y - numeric() result - try(plot(lm(x~y))) print(result) If i don't use library(pixmap), than also R --vanilla source.R works as expected. This happens with R-2.0.1 and pixmap-0.4.2 under SuSE 9.2. Christian :-( P.S. The reason for preferring R --vanilla script.R over R CMD BATCH is, that i have to produce png images for a server and want to avoid the bitmap device for performance reasons. With R --vanilla script.R, this is possible, using the xvnc virtual X server. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Solving systems of non-linear equations in R
I'm about to write my thesis in economics and will need to setup and solve a system of non-linear equations. At our university we usually use GAMS for this, and though GAMS is a fine program, it bugs me a that I won't be able to run my code after I finish my thesis without buying a license for the program(about $3.500 :-(( ) So I've looked around for NL-stuff for R, but I can't find anything. The closest thing appears to be optim(), but it doesn't seem to allow constraints(as in fn = constant) or equations systems. So, anyone knows if there is a method in R that you can use for this purpose? regards __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Loading C functions into R
Thanx very much! I got to load the program into R with no problem! Talita Perciano Costa Leite Graduanda em Ciência da Computação Universidade Federal de Alagoas - UFAL Departamento de Tecnologia da Informação - TCI Construção de Conhecimento por Agrupamento de Dados - CoCADa From: Huntsinger, Reid [EMAIL PROTECTED] To: 'Talita Leite' [EMAIL PROTECTED] Subject: RE: [R] Loading C functions into R Date: Tue, 22 Feb 2005 16:43:21 -0500 In case you didn't get an answer: .C() works by calling a function in a shared library you've already loaded into R. So you need to 1) compile the code into a shared library (DLL) and 2) load it into R via dyn.load. The function needs to be declared as void; it passes results back via pointers passed in. (So you may need to write a simple wrapper to use your code.) .C() passes pointers to the data of the listed R objects to the function being called. (So you have to pass things like array dimensions as arguments as well.) One of those (or more) could be for output, ie, the function writes data into the area pointed to. The return value of .C() is a list with (copies of) the R objects passed in, possibly modified. See the Writing R Extensions manual for details of .C() and examples. Also, help(.C) from an R session, and the R source code itself--for example have a look at the functions in packages included with R. The file filter.c in ts (I think) is a good example. Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Talita Leite Sent: Tuesday, February 22, 2005 9:01 AM To: r-help@stat.math.ethz.ch Subject: [R] Loading C functions into R Hi everybody, I have the source of a C program that includes some archives .c and some libraries .h. I'm developing a program using R and I want it to load the C program I told before. How can I do that? I was looking for some function in R to do that and I found the .C() but I can't understand how it works. Somebody could help me? Thanx, Talita Perciano Costa Leite Graduanda em Ciência da Computação Universidade Federal de Alagoas - UFAL Departamento de Tecnologia da Informação - TCI Construção de Conhecimento por Agrupamento de Dados - CoCADa __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to calculate density of multinormal distribution at a given point?
Dear all, I am trying to estimate the point density of a posterior distribution (this to estimate a bayesian factor in aphylogenetic analysis ). The problem that I would like to look at several variable at the same time. From a quick look several of the paramaters that interest me are correlated and I need to estimate the density altogether. I would be very interest to know a kernel density (like the function density) for multinomial distribution, but I would be equally happy if somebody could tell how to estimate point density with a multinormal distribution with known mean and covariance matrix thanks Saverio Vicario Ecology and Evolutionary Biology Yale University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] data.frame error message
Dear R users, I am using v2.0.1 on Windows 2000. I have read a .dat file with several vectors, including 2 factors (2 levels x 3 levels), and a vector of responses, into R. There are no unique row names. When I try plot(x,y) or lm(y~x) the following error is returned: Error in model.frame(formula, rownames,...extranames: variable lengths differ What am I doing wrong? I am a new R user, and I didn't figure it out from the sections on data.frames in Dalgaard, Venable/Ripley, or simpleR, or the help threads. Thanks- Nic Ellis Penn State __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re: Run Sweave and LaTeX directly from command line
On 22 February 2005 at 14:58, [EMAIL PROTECTED] wrote: | side note 2: For make afficionados the follwing 2 rules in combination | with the Sweave script from the FAQ do almost the same (that's what I | use :-) Sure, but it requires a (arguably small) Makefile in every sweave project directory. Would you consider integrating Gregor's script (or a suitable modification) instead? Dirk -- Better to have an approximate answer to the right question than a precise answer to the wrong question. -- John Tukey as quoted by John Chambers __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] data.frame error message
Following the suggestions in the Posting Guide would help us to help you much better. What command(s) did you use to get the data into R? What does the `.dat' file look like? What are `x' and `y'? Data frames in R, by definition, has to have (unique) rownames. If they are not present in the data source (e.g., a file), they will be created for the data frame, and defaults to 1 through n where n is the number of rows. Andy From: Nic Ellis Dear R users, I am using v2.0.1 on Windows 2000. I have read a .dat file with several vectors, including 2 factors (2 levels x 3 levels), and a vector of responses, into R. There are no unique row names. When I try plot(x,y) or lm(y~x) the following error is returned: Error in model.frame(formula, rownames,...extranames: variable lengths differ What am I doing wrong? I am a new R user, and I didn't figure it out from the sections on data.frames in Dalgaard, Venable/Ripley, or simpleR, or the help threads. Thanks- Nic Ellis Penn State __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Solving systems of non-linear equations in R
I believe library(systemfit) has nlsytemfit function. Yh T Petersen wrote: I'm about to write my thesis in economics and will need to setup and solve a system of non-linear equations. At our university we usually use GAMS for this, and though GAMS is a fine program, it bugs me a that I won't be able to run my code after I finish my thesis without buying a license for the program(about $3.500 :-(( ) So I've looked around for NL-stuff for R, but I can't find anything. The closest thing appears to be optim(), but it doesn't seem to allow constraints(as in fn = constant) or equations systems. So, anyone knows if there is a method in R that you can use for this purpose? regards __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] estimate the parameter of exponential distribution, etc.
Le 22 Février 2005 18:01, Bickel, David a écrit : Given a numeric vector of observations, does R have any generic way to estimate the parameters of commonly used distributions (exponential, gamma, etc.) without numerically optimizing the likelihood function? Assuming you want to use maximum likelihood estimation, look into 'fitdistr' in package MASS. Hope this helps! -- Vincent Goulet, Professeur agrégé École d'actuariat Université Laval, Québec [EMAIL PROTECTED] http://vgoulet.act.ulaval.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Memory problems
Hi, I use R to do some ARIMA forecasting and R runs out of memory. The problem is that I have 20160 samples(which are quite alot) and when I try to fit the model it runs out of memory. I tried with memory.size() to change the limit, but it wouldn't work. Is there anything you can suggest? Is it possible R can use virtual memory? Thank you, Kosta __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Solving systems of non-linear equations in R
No, this doesn't seem right. What I look for is something that could solve nonlinear systems with n unknowns and n equations. So there will be zero degrees of freedom, and statistical methods can't be the right way forward. Specifically I can see that the litterature mentions's Scarf's algoritm (Scarf 1967) and Merril's refinement of Scarf's algoritm in 1972, but there might be other algoritms too... Regards...TP yutaka hamaoka wrote: I believe library(systemfit) has nlsytemfit function. Yh T Petersen wrote: I'm about to write my thesis in economics and will need to setup and solve a system of non-linear equations. At our university we usually use GAMS for this, and though GAMS is a fine program, it bugs me a that I won't be able to run my code after I finish my thesis without buying a license for the program(about $3.500 :-(( ) So I've looked around for NL-stuff for R, but I can't find anything. The closest thing appears to be optim(), but it doesn't seem to allow constraints(as in fn = constant) or equations systems. So, anyone knows if there is a method in R that you can use for this purpose? regards __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Trying to get a side-by-side barplot of data with levels (Modified by List account)
Greetings! This is probably a simple problem, but it's really got me flummoxed. I have some data, basically a vector with a factor, in the following format, which I read in via 'auth - read.table(authorship.csv, header=TRUE, sep=,)': normalized.thomistic,category 1,116.0381739855475264,1 2,131.2574467426990769,1 3,136.4285134675765673,1 ... 169,62.3858353841946951,3 170,9.7790398628375482,3 171,46.6410161421995376,3 172,103.7494315597999090,3 174,28.8608475648323846,3 What I'm tying to get is a barplot which will plot the number of data points in each category in a quartile format, with the categories side by side. For instance, there should be four groups of bars, the first being the number of data points in the bottom quartile, for categories 1, 2, and 3 side by side... next the number of data points in second quartile in the same format, etc. Thanks for any help you can offer! -Erik Norvelle [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Solving systems of non-linear equations in R
A system of n equations in n unknowns has a unique solution if the n equations are linear and linearly independent. If the system is nonlinear, then one must characterize the nonlinearity before saying anything about whether a solution exists and if so how many solutions are there? Example 1: Solve sin(x)=0 for x. Answer: x = 2*n*pi, for n = any integer. Example 2: Solve sin(x) = 2 for x. Answer: If x must be a real number, then this equation has no solutions. Are your functions monotonic? Continuous? Differentiable? Without getting into pathologies like the Cantor function (e.g., http://www.cut-the-knot.org/do_you_know/cantor.shtml), my experience with a variety of practical problem like this suggests that it is best to recast the problem as one of minimizing, e.g., the sum of squared deviations from target. Moreover, I've had good luck transforming the parameter space to eliminate constraints -- or incorporating the constraints into the objective function and then solving the superficially unconstrained problem. If my functions have singularities where I might get 0/0 or Inf-Inf, for example, I use asymptotic expansions to approximate the function(s) near the singularities more accurately than can be achieved with any finite-precision arithmetic. With all of this, I'm confident that there are better algorithms than the different methods in optim, but I don't have not had the need to hunt for them. The methods in optim provide a reasonable range of options for the problems I've encountered. The R project has another advantage over a commercial software: You can see the source code. You can trace it step by step and find out where it does not work well for the specific problems you consider. If you're clever, you might be able to find a way to improve that algorithm and make it part of your thesis -- and get a publication on it in some statistical software journal. Where else can you so easily climb up and stand on the shoulders of giants? If you find a platform for innovation better than R, please let me know. hope this helps. spencer graves T Petersen wrote: No, this doesn't seem right. What I look for is something that could solve nonlinear systems with n unknowns and n equations. So there will be zero degrees of freedom, and statistical methods can't be the right way forward. Specifically I can see that the litterature mentions's Scarf's algoritm (Scarf 1967) and Merril's refinement of Scarf's algoritm in 1972, but there might be other algoritms too... Regards...TP yutaka hamaoka wrote: I believe library(systemfit) has nlsytemfit function. Yh T Petersen wrote: I'm about to write my thesis in economics and will need to setup and solve a system of non-linear equations. At our university we usually use GAMS for this, and though GAMS is a fine program, it bugs me a that I won't be able to run my code after I finish my thesis without buying a license for the program(about $3.500 :-(( ) So I've looked around for NL-stuff for R, but I can't find anything. The closest thing appears to be optim(), but it doesn't seem to allow constraints(as in fn = constant) or equations systems. So, anyone knows if there is a method in R that you can use for this purpose? regards __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to conctruct an inner grouping for nlme random statement?
Hello. Im hoping someone can help with a grouping question related to the random= statement within the nlme function. How do you specify that some grouping levels are inner to others? I tried several things, given below. Lets say I have a data frame with five variables, resp, cov1, ran1, ran2, group1, and group 2. The formula is resp~cov1 + ran1 + ran2, where the ran are random variables. The data is of length 80, and there are 4 unique factors in group1 and 20 unique factors in group2. These are factors related to ran1 and ran2, respectively. The difficult part is that I want to estimate only 4 random variables for ran1|group1 and the full 20 for ran2|group2. I have tried many ways, and I cannot find a way to do this. Is there a way? Can someone suggest a code snippet? First I tried making the data frame a groupedData object, so that group2 is inner to group1, as it should be. Then I used the statement: random = as.formula(ran1+ran2~1). But this produced 20 estimates for both ran1 and ran2. I have also tried it without the data frame as a groupedData object, using the following: random = list(group1= c(ran1~1, group2=ran2~1)). But this gave only 4 estimates for ran2. I also tried: random = list(c(group1= ran1~1, group2=ran2~1)), but this just gave a parse error message. Any suggestions would be greatly appreciated. Is it even possible to do what I want to do? John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Memory problems
Looking at the posting guide will increase the chance to get a helpful response from this list. No one knows what kind of operating system are you running: Is it Windows,MacOS or Linux (32 or 64 bit)? Memory related problems are reported daily so it could be much beneficial to browse the help-archive ( has an efficient search facility ) Some reccent suggestions on memory limitations are found there Thomas I use R to do some ARIMA forecasting and R runs out of memory. The problem is that I have 20160 samples(which are quite alot) and when I try to fit the model it runs out of memory. I tried with memory.size() to change the limit, but it wouldn't work. Is there anything you can suggest? Is it possible R can use virtual memory? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] ROracle installation
Liu, Jane wrote: Can someone tell me how to install ROracle package to PC? I couldn't find it CRAN package list. And when I tried to install from zip file, it failed. Thanks, Jane __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Please read the ReadMe at the corresponding CRAN repository CRAN/bin/windows/contrib/2.0/ReadMe that tells you: Although the packages RMySQL, ROracle, and snow pass make check, it seems to be dangerous to distribute them: I do not have the software available these packages depend on. Uwe Ligges __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Rdbi and ODBC
roger bos wrote: I have been using RODBC for a while with no complaints (R 2.0.1 patched under WinXP), then I saw a link (http://grass.itc.it/statsgrass/r_and_dbms.html) showing that Rdbi claims to run a query in 5 seconds that takes RODBC 4.3 minutes. That was hard enough for me to believe that I wanted to try some tests myself, but I cannot get Rdbi to connect to my ODBC database. Here is what works for RODBC for my setup: conn - odbcConnect(xf, xfl2, xfl2) Now for Rdbi the documentation is lacking. ?Rdbi doesn't work and ?dbConnect gives little detail and no examples. I tried all of the following without success: conn - dbConnect(ODBC(), dbname=xf, user=xfl2, password=xfl2) conn - dbConnect(ODBC, dbname=xf, user=xfl2, password=xfl2) conn - dbConnect(ODBC, dbname=xf, user=xfl2, password=xfl2) conn - dbConnect(ODBC(), dbname=xf, user=xfl2, password=xfl2) Also, if this package is so fast, how come its not available on CRAN? Rdbi is a Bioconductor packge. Uwe Ligges If I may ask a second question for my enlightenment. It seems that PostgreSQL and mySQL are pretty popular, but my database is in SQL Server and I do not have the ability to change it. How come every package has native drivers to PostreSQL and Oracle but none of them seem to have a native drive to SQL Server and I have to use ODBC? Thanks in advance for any advice. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html