[R] Re: memory problems
Hi, well, it is always a good bet to start with a small subset of your data. Increase it and take a look what happens and how much memory it takes (object.size() should give the size of the oject in memory, use OS-tools to check the size of the whole process). There may also be some OS-related issues. There are some issues with memory management under Windows, in particular the memory may become fragmented. Try the same under UNIX if you have access to. And last -- please describe more precisely what exactly are you doing and what does your data look like. Best wishes, Ott __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] printing reals from C with digits
Hi, I want to print real numbers in C code with different values for digits. How to do that? As I have understood, what I should do is to call StringFromReal() which calls FormatReal(), that one suggests the parameters (width, decimal places and exponential form). FormatReal() includes eps = pow(10.0, -(double)R_print.digits); So I guess I have to change the value of R_print.digits. R_print.digits is defined in include/Print.h in the package source, but unfortunately the installed version (in /usr/lib/R/include/R_ext) is quite a different. I guess that is because the structure is not meant to be accessible by user, although some system routines alter R_print.digits directly. So are there any good way to achieve it? This R 1.5.0 on an RH 6.2 computer if that matters. Thanks for help. Ott __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] printing reals from C with digits
On Wed, 29 Jan 2003, Ott Toomet wrote: I want to print real numbers in C code with different values for digits. How to do that? Use Rprintf or PrintValue. You'll need to work hard to convince me that Rprintf is not adequate. As I have understood, what I should do is to call StringFromReal() That's a coercion, not a printing routine. which calls FormatReal(), that one suggests the parameters (width, decimal places and exponential form). FormatReal() includes eps = pow(10.0, -(double)R_print.digits); So I guess I have to change the value of R_print.digits. R_print.digits is defined in include/Print.h in the package source, but unfortunately the installed version (in /usr/lib/R/include/R_ext) is quite a different. R_ext/Print.h and Print.h are not the same thing: one is not a version of the other. The routines you mention are not documented in R-exts, and are not part of the API. I guess that is because the structure is not meant to be accessible by user, although some system routines alter R_print.digits directly. (Only the coercion and print routines!) So are there any good way to achieve it? Temporarily change the options(digits) and call PrintValue(). You are not meant to (and it is not safe to) mess with R's printing internals, and these structures change even at patch releases. -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Scoping rule problem?!? step does not work in function
Hello! I would like to use step() in a function because I have a list of responses (independent!) with equal influence and want to apply stepwise regression on each of them. So the function I just tested is the following: fitlms - function(y,infl,formel=NULL){ if(is.null(formel)){ var.names - names(infl) dcv - length(var.names) formel - paste(y~,paste(rep(I(,dcv), var.names, rep(^2),dcv),sep=,collapse=+),+,paste(var.names,collapse=*),sep=) formel - as.formula(formel) } erg - lm(formel,infl) erg - step(erg) return(erg)} Using this I get the following: test - fitlms(grob.erg[,1],grob.erg[,3:5]) Start: AIC= -30.84 y ~ I(f^2) + I(vS^2) + I(o^2) + f + vS + o + f:vS + f:o + vS:o + f:vS:o Df Sum of Sq RSS AIC - f:vS:o 1 0.060 2.052 -32.188 none 1.992 -30.842 - I(o^2) 1 0.762 2.754 -25.717 - I(f^2) 1 2.581 4.573 -14.558 - I(vS^2) 1 5.341 7.333 -4.170 Error in model.frame.default(formula = y ~ I(f^2) + I(vS^2) + I(o^2) + : Object infl not found So the first step carried out correctly and then it seems to look into the wrong environment (presumably the top-level). I checked with the code of step, but could not spot the cause of this behaviour. At some place it looks at the parent.frame, which should be the environment created by function fitlms if I do unserstand things correctly. I checked also whether I can give step an environment in which to operate, but could not find any such option. I presume I could just use a for-loop, which might not be much slower than lapply in this case. I simply would like to understand things better to avoid similar errors. Data is given below. Thanks for your attention and any help appreciated, Winfried grob.erg gwRZ gwRA f vS o WV 1 3.562667 0.5742667 0.185 90.000 300.000 WV 2 3.585733 0.6028333 0.185 90.000 300.000 WV 3 3.893233 0.7162333 0.185 90.000 300.000 WV 4 4.035933 0.7603667 0.139 111.213 370.711 WV 5 2.250800 0.3411000 0.120 90.000 300.000 WV 6 4.342833 0.8782667 0.231 111.213 370.711 WV 7 2.537000 0.4682333 0.231 68.787 370.711 WV 8 3.058767 0.4457333 0.185 90.000 400.000 WV 9 3.61 0.600 0.139 68.787 370.711 WV 10 4.757700 1.0705333 0.231 111.213 229.289 WV 11 4.491800 0.9555000 0.185 60.000 300.000 WV 12 3.316133 0.5622333 0.139 111.213 229.289 WV 13 3.364567 0.5709333 0.139 68.787 229.289 WV 14 3.834867 0.6982333 0.185 90.000 200.000 WV 15 4.116233 0.6855000 0.231 68.787 229.289 WV 16 3.769800 0.7355333 0.185 90.000 300.000 WV 17 6.631733 1.6468333 0.185 120.000 300.000 WV 18 4.282933 0.7365333 0.185 90.000 300.000 WV 19 3.784633 0.7029000 0.185 90.000 300.000 WV 20 3.669567 0.6854000 0.250 90.000 300.000 WV 21 4.548433 0.7231000 0.185 90.000 300.000 WV 21a 3.387467 0.5558667 0.185 90.000 300.000 - E-Mail: Winfried Theis [EMAIL PROTECTED] Date: 29-Jan-03 Dipl.-Math. Winfried Theis SFB 475, Fachbereich Statistik, Universitat Dortmund, 44221 Dortmund Tel.: +49-231-755-5903 FAX: +49-231-755-4387 -- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Analyzing an unbalanced AB/BA cross-over design
I am looking for help to analyze an unbalanced AB/BA cross-over design by requesting the type III SS ! # Example 3.1 from S. Senn (1993). Cross-over Trials in Clinical Research outcome-c(310,310,370,410,250,380,330,270,260,300,390,210,350,365,370,310,380,290,260,90,385,400,410,320,340,220) subject-as.factor(c(1,4,6,7,10,11,14,1,4,6,7,10,11,14,2,3,5,9,12,13,2,3,5,9,12,13)) period-as.factor(c(1,1,1,1,1,1,1,2,2,2,2,2,2,2,1,1,1,1,1,1,2,2,2,2,2,2)) treatment-as.factor(c('F','F','F','F','F','F','F','S','S','S','S','S','S','S','S','S','S','S','S','S','F','F','F','F','F','F')) sequence-as.factor(c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2)) example-data.frame(outcome,subject,period,treatment,sequence) The recommended SAS code equals PROC GLM DATA=example; CLASS subject period treatment sequence; MODEL outcome = treatment sequence period subject(sequence); RANDOM subject(sequence); RUN; For PROC GLM, the random effects are treated in a post hoc fashion after the complete fixed effect model is fit. This distinction affects other features in the GLM procedure, such as the results of the LSMEANS and ESTIMATE statements. Looking only on treatment, period, sequence and subject effects, the random statement can be omitted. The R code for type I SS equals example.lm-lm(outcome~treatment+period+sequence+subject%in%sequence, data=example) anova(example.lm) Response: outcome Df Sum Sq Mean Sq F valuePr(F) treatment 1 13388 13388 17.8416 0.001427 ** period1 16321632 2.1749 0.168314 sequence 1335 335 0.4467 0.517697 sequence:subject 11 114878 10443 13.9171 6.495e-05 *** Residuals11 8254 750 According to the unbalanced design, I requested the type III SS which resulted in an error statement library(car) Anova(example.lm, type=III) Error in linear.hypothesis.lm(mod, hyp.matrix, summary.model = sumry, : One or more terms aliased in model. by using glm I got results with 0 df for the sequence effect example.glm-glm(outcome~treatment+period+sequence+subject%in%sequence, data=example, family=gaussian) library(car) Anova(example.glm,type=III,test.statistic=F) Anova Table (Type III tests) Response: outcome SS Df FPr(F) treatment 14036 1 18.7044 0.001205 ** period 1632 1 2.1749 0.168314 sequence 0 0 sequence:subject 114878 11 13.9171 6.495e-05 *** Residuals 8254 11 The questions based on this output are 1) Why was there an error statement requesting type III SS based on lm ? 2) Why I got a result by using glm with 0 df for the period effect ? 3) How can I get the estimate, the StdError for the constrast (-1,1) of the treatment effect ? Thanks -- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] CGIwithR version 0.40
A new version of the CGIwithR package is now at CRAN. Version 0.40 has the following improvements: -- more comprehensive decoding of form data -- images are no longer cached by browsers -- buffering of the output page to avoid server/browser sync problems Still for unix-like systems only. David Firth Nuffield College Oxford OX1 1NF United Kingdom Phone +44 1865 278544 Fax +44 1865 278621 http://www.stats.ox.ac.uk/~firth __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] calling sweave function from latex
On Wed, 29 Jan 2003 14:12:15 +1300, Sam McClatchie (SM) wrote: System info: Mandrake 9.0 R Version 1.6.1 ESS 5.1.21 Emacs 21.2.1 --- Colleagues I've been calling R-code embedded in my LaTex document using Sweave, but would like to make things more convenient. At present as I understand it you first process the R chunks of code using the Sweave function called from within R to process a precursor file e.g. foo.sw to get a LaTex file (foo.sw.tex) that you then process with latex foo.sw.tex. example code segment %\item {\bf Matched trawl and acoustic data} \label{real data} \item {\bf Results} sweave code echo=false,results=hide= average.trawl.spp.composition() @ insert figure generated from sweave code \begin{figure} \includegraphics[scale=0.6]{../figures/bycatch_by_weight} \caption{\label{catch by weight} Proportions of selected species (from Table \ref{ts length regressions}) in the fish assemblage using catch rate ($kg\ km{-1}$) as an approximation for fish density (neglecting variable capture efficiencies). Note: there were no oblique banded rattails in this dataset, although we have a \textit{TS-length} regression for them (see Table \ref{ts length regressions}). Box plot centre line = meadian, box limits are $25^{th}$ and $75^{th}$ quartiles, whiskers represent 1.5 times the interquartile range from the median, and points outside the whiskers are the tails of the distributions.} \end{figure} --- This works fine, but it is cumbersome for someone who likes to write a bit and then latex that additional bit. Of course I can just add the new LaTex code chunks to the foo.sw.tex and latex that, but I have to remember to copy the foo.sw.tex back to foo.sw or the versions get mixed up. Trivial, but annoying. The question is: can I call the Sweave function from within LaTex so I just latex the foo.sw.tex and the Sweave chunks will also get processed. This would be much tidier. One suspects that the short answer is 'no'. One way to deal with this is to write several Sweave filew and collect them into the main latex document using \input{} statements. Then you can Sweave() only those files which have some changes, makefiles can automate that easily. I have some ideas on conditional processing of chunks and re-using previously saved results in case nothing has changed, but that has not been implemented yet. Best, Fritz -- --- 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 [EMAIL PROTECTED] A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch --- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Array of 3D
Hi, Can be created an Array of 3 dimensions in R? How? Tks, Francisco. ^^ Francisco Júnior, Computer Science - UFPE-Brazil One life has more value that the world whole ^^ __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] substitute, eval and hastables
I have the following problem. I have an automatically generated named list with stringified names: a - list(A=..., B=..., C=..., ) then I want to refer to the elements of the list, stored as an vector of names: nn - c(A, B, C), so that I could get list elements like a$nn[1], a$nn[2], etc. Obviously it doesn't work. Instead I do: nn.Exp - substitute(expression(a$b), list(b=nn[1])) eval(nn.Exp) in a result I get expession(a$A) but not the value stored in the list. Meanwhile if I manually construct expression as expression(a$A) and then evaluate it, it works fine. How do I solve that problem? Perhaps using such a list with stringified names are not very good programming style, but this is convenient to store and retrieve elements if list should be filled automatically from numerous sources. In this way I'm trying to emulate a hash-table behavior. Perhaps there is a better way? Any help is highly appreciated Thanks, -Serge __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Analyzing an unbalanced AB/BA cross-over design
martin wolfsegger [EMAIL PROTECTED] writes: I am looking for help to analyze an unbalanced AB/BA cross-over design by requesting the type III SS ! # Example 3.1 from S. Senn (1993). Cross-over Trials in Clinical Research outcome-c(310,310,370,410,250,380,330,270,260,300,390,210,350,365,370,310,380,290,260,90,385,400,410,320,340,220) subject-as.factor(c(1,4,6,7,10,11,14,1,4,6,7,10,11,14,2,3,5,9,12,13,2,3,5,9,12,13)) period-as.factor(c(1,1,1,1,1,1,1,2,2,2,2,2,2,2,1,1,1,1,1,1,2,2,2,2,2,2)) treatment-as.factor(c('F','F','F','F','F','F','F','S','S','S','S','S','S','S','S','S','S','S','S','S','F','F','F','F','F','F')) sequence-as.factor(c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2)) example-data.frame(outcome,subject,period,treatment,sequence) The recommended SAS code equals PROC GLM DATA=example; CLASS subject period treatment sequence; MODEL outcome = treatment sequence period subject(sequence); RANDOM subject(sequence); RUN; For PROC GLM, the random effects are treated in a post hoc fashion after the complete fixed effect model is fit. This distinction affects other features in the GLM procedure, such as the results of the LSMEANS and ESTIMATE statements. Looking only on treatment, period, sequence and subject effects, the random statement can be omitted. The R code for type I SS equals example.lm-lm(outcome~treatment+period+sequence+subject%in%sequence, data=example) anova(example.lm) Response: outcome Df Sum Sq Mean Sq F valuePr(F) treatment 1 13388 13388 17.8416 0.001427 ** period1 16321632 2.1749 0.168314 sequence 1335 335 0.4467 0.517697 sequence:subject 11 114878 10443 13.9171 6.495e-05 *** Residuals11 8254 750 According to the unbalanced design, I requested the type III SS which resulted in an error statement library(car) Anova(example.lm, type=III) Error in linear.hypothesis.lm(mod, hyp.matrix, summary.model = sumry, : One or more terms aliased in model. by using glm I got results with 0 df for the sequence effect example.glm-glm(outcome~treatment+period+sequence+subject%in%sequence, data=example, family=gaussian) library(car) Anova(example.glm,type=III,test.statistic=F) Anova Table (Type III tests) Response: outcome SS Df FPr(F) treatment 14036 1 18.7044 0.001205 ** period 1632 1 2.1749 0.168314 sequence 0 0 sequence:subject 114878 11 13.9171 6.495e-05 *** Residuals 8254 11 The questions based on this output are 1) Why was there an error statement requesting type III SS based on lm ? 2) Why I got a result by using glm with 0 df for the period effect ? 3) How can I get the estimate, the StdError for the constrast (-1,1) of the treatment effect ? The type I/III issues my be better left to people who actually understand them, but note that sequence is really a embedded in subject (7 subjects had one sequence and 6 subjects the other) so sequence:subject is equivalent to just subject, and this is likely also the reason that sequence is aliased within subject. Basically, this is a fixed-effects model, and if each subject has his own parameter, you can't estimate the sequence effect. I'd do this kind of design with an explicit mixed-effects model: summary(aov(outcome~treatment+period+sequence+Error(subject))) Error: subject Df Sum Sq Mean Sq F value Pr(F) sequence 1335 335 0.0321 0.861 Residuals 11 114878 10443 Error: Within Df Sum Sq Mean Sq F value Pr(F) treatment 1 13388.5 13388.5 17.8416 0.001427 ** period 1 1632.1 1632.1 2.1749 0.168314 Residuals 11 8254.5 750.4 possibly substituting treatment:period for sequence (it's the same thing). -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] substitute, eval and hastables
On Wed, Jan 29, 2003 at 01:07:52PM +0100, Serge Boiko wrote: I have the following problem. I have an automatically generated named list with stringified names: a - list(A=..., B=..., C=..., ) then I want to refer to the elements of the list, stored as an vector of names: nn - c(A, B, C), so that I could get list elements like a$nn[1], a$nn[2], etc. Obviously it doesn't work. Instead I do: nn.Exp - substitute(expression(a$b), list(b=nn[1])) eval(nn.Exp) in a result I get expession(a$A) but not the value stored in the list. Meanwhile if I manually construct expression as expression(a$A) and then evaluate it, it works fine. How do I solve that problem? Perhaps using such a list with stringified names are not very good programming style, but this is convenient to store and retrieve elements if list should be filled automatically from numerous sources. In this way I'm trying to emulate a hash-table behavior. Perhaps there is a better way? If you want hash table behavior you could try using environments (as that is really about all that they are). I have been spending some time thinking (and a little coding) about a hash table class but it is unlikely to appear before the summer. Robert Any help is highly appreciated Thanks, -Serge __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- +---+ | Robert Gentleman phone : (617) 632-5250 | | Associate Professor fax: (617) 632-2444 | | Department of Biostatistics office: M1B20 | Harvard School of Public Health email: [EMAIL PROTECTED] | +---+ __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Array of 3D
Hi, try ?array. So long, Winfried On 29-Jan-03 Francisco do Nascimento Junior wrote: Hi, Can be created an Array of 3 dimensions in R? How? Tks, Francisco. ^^ Francisco Júnior, Computer Science - UFPE-Brazil One life has more value that the world whole ^^ __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help - E-Mail: Winfried Theis [EMAIL PROTECTED] Date: 29-Jan-03 Dipl.-Math. Winfried Theis SFB 475, Fachbereich Statistik, Universitat Dortmund, 44221 Dortmund Tel.: +49-231-755-5903 FAX: +49-231-755-4387 -- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] random number generator?
Well if the base generator is to be changed, it might be a good idea to consider implementing one of Marsaglia's really long period generators. His latest, using titanic primes, has a period of 2^131086. It is extremely fast. Even more could be done, by replacing the two phase normal generator by faster generator using a single phase. Liaw, Andy wrote: Might I suggest taking a poll (even though unscientific) of how many people will be affected by a change in default RNG? My totally arbitrary guess is very few, if any. If I'm not mistaken, Python had only recently changed the default RNG to Mersenne-Twister. If Python can do it, I should think R can, too, without too much pain... Just my $0.02... Andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 28, 2003 3:53 PM To: Charles Annis, P.E. Cc: [EMAIL PROTECTED] Subject: RE: [R] random number generator? Can I suggest RNGkind(Mersenne-Twister, Inversion) and especially the use of Inversion where tail behaviour of the normal is important. Were it not for concerns about reproducibility we would have switched to Inversion a while back. On Tue, 28 Jan 2003, Charles Annis, P.E. wrote: Earlier today I reported finding an unbalanced number of observations in the p=0.0001 tails of rnorm. Many thanks to Peter Dalgaard who suggested changing the normal.kind generator. Using RNGkind(kind = NULL, normal.kind =Box-Muller) seems to have provided the remedy. For example: observed.fraction.below [1] 0.000103 observed.fraction.above [1] 0.000101 Thank you, Peter! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFAX: 503-217-5849 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Peter Dalgaard BSA Sent: Tuesday, January 28, 2003 2:36 PM To: Charles Annis, P.E. Cc: [EMAIL PROTECTED] Subject: Re: [R] random number generator? Charles Annis, P.E. [EMAIL PROTECTED] writes: Dear R-Aficionados: I realize that no random number generator is perfect, so what I report below may be a result of that simple fact. However, if I have made an error in my thinking I would greatly appreciate being corrected. I wish to illustrate the behavior of small samples (n=10) and so generate 100,000 of them. n.samples - 100 sample.size = 10 p - 0.0001 z.normal - qnorm(p) # generate n.samples of sample.size each from a normal(mean=0, sd=1) density # small.sample - matrix(rnorm(n=sample.size*n.samples, mean=0, sd=1), nrow=n.samples, ncol=sample.size) # Verify that from the entire small.sample matrix, p sampled values are below, p above. # observed.fraction.below - sum(small.sample z.normal)/length(small.sample) observed.fraction.above - sum(small.sample -z.normal)/length(small.sample) observed.fraction.below [1] 6.3e-05 observed.fraction.above [1] 0.000142 I've checked the behavior of the entire sample's mean and median and they seem fine. The total fraction in both tails is 0.0002, as it should be. However in every instance about 1/3 are in the lower tail, 2/3 in the upper. I also observe the same 1/3:2/3 ratio for one million samples of ten. Is this simply because random number generators aren't perfect? Or have I stepped in something? Thank you for your kind counsel. You stepped in something, I think, but I probably shouldn't elaborate on the metaphor ... There's an unfortunate interaction between the two methods that are used for generating uniform and normal variables (the latter uses the former). This has been reported a couple of times before and typically gives anomalous tail behaviour. Changing one of the generators (see help(RNGkind)) usually helps. -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Bob Wheeler --- http://www.bobwheeler.com/ ECHIP, Inc. --- (302) 239-6620, voice FAX 724 Yorklyn Rd., Hockessin, DE 19707 Randomness comes in bunches
RE: [R] random number generator?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] AL == Andy Liaw Liaw writes: AL Might I suggest taking a poll (even though unscientific) of how many people AL will be affected by a change in default RNG? My totally arbitrary guess is AL very few, if any. But they may tend to be important (i.e. those with large stat software projects/tools) doing heavy regression testing. But if those who want to use better RNG in R can now put RNGkind() in their .Rprofile, surely those who really need the old generator can do similar, if the default is changed? As Prof. Dalgaard said (privately), I don't think is that painful if the current default generator is kept as an option in RNGkind(). (I.e., all I'm asking is to change the default RNG, not getting rid of the current default.) Cheers, Andy AL If I'm not mistaken, Python had only recently changed the default RNG to AL Mersenne-Twister. If Python can do it, I should think R can, too, without AL too much pain... Depends on which L_p norm you measure pain by. best, -tony -- A.J. Rossini Rsrch. Asst. Prof. of Biostatistics U. of Washington Biostatistics [EMAIL PROTECTED] FHCRC/SCHARP/HIV Vaccine Trials Net [EMAIL PROTECTED] -- http://software.biostat.washington.edu/ FHCRC: M: 206-667-7025 (fax=4812)|Voicemail is pretty sketchy/use Email UW: Th: 206-543-1044 (fax=3286)|Change last 4 digits of phone to FAX (my tuesday/wednesday/friday locations are completely unpredictable.) -- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Help!!
If you have a dominating density, ie another density, say g, such that cg(x)f(x) for some coo and all x, then you can easily do this by rejection. See, e.g. Luc Devroye's Springer book, which is the bible on this sort of thing url:www.econ.uiuc.edu Roger Koenker Dept. of Economics UCL, email [EMAIL PROTECTED] Department of Economics Drayton House, vox:217-333-4558University of Illinois 30 Gorden St, fax:217-244-6678Champaign, IL 61820 London,WC1H 0AX, UK vox:020-7679-5838 On Wed, 29 Jan 2003, Duncan Murdoch wrote: On Tue, 28 Jan 2003 16:01:06 +, you wrote in message [EMAIL PROTECTED]: Dear R ers, if some can tel me how I can generate a sample from a given density. I have a complex 2D density function en I want to genearte a sample from it? Any package? __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Help!!
Duncan Murdoch [EMAIL PROTECTED] writes: On Tue, 28 Jan 2003 16:01:06 +, you wrote in message [EMAIL PROTECTED]: Dear R ers, if some can tel me how I can generate a sample from a given density. I have a complex 2D density function en I want to genearte a sample from it? Any package? That's generally a hard problem, and the answer depends a lot on the particular characteristics of your distribution. The easiest general purpose method if you can calculate the density is probably MCMC, in particular random walk Metropolis; see the book Markov Chain Monte Carlo in Practice for details. This will give you a Markov chain that (hopefully) converges to your target distribution. If you only want a small sample, it's quite inefficient, but for a large sample (e.g. for estimating moments) it can be quite good. Support in R for MCMC is pretty much non-existent, but it's easy to write the chains yourself. MCMC has big difficulty in generating *independent* samples. An alternative might be rejection methods. This essentially requires that you can find an easy density that can be scaled to be a majorant for the target density (which it might take a bit of calculus to achieve). Lets call the majorant g. Then draw X at random from this distribution (with density proportional to g) and an additional uniform variable U and return X if U f(X)/g(X), else reject X and retry. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Help!!
On 29 Jan 2003 16:28:57 +0100, Peter Dalgaard BSA [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]: MCMC has big difficulty in generating *independent* samples. That's true. For an IID sample, a rejection sampler (if you can do the calculus) is usually more efficient. To get a a truly IID sample from MCMC you need to start chains at independent starting values and take one observation from each; that's probably too slow. Duncan Murdoch __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] random number generator?
With respect to the method used to produce normals, Professor Ripley noted: Were it not for concerns about reproducibility we would have switched to Inversion a while back. Presumably this refers to reproducibility across platforms. I searched the archive and could find nothing on this point. Gentle's text on RNGs provided no answer, either. Might Professor Ripley or someone else briefly explain why the inversion method is not reproducible but Box-Muller is, or perhaps offer a citation? Thanks, Bruce __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Curve Fitting Question - Newbie
Simon Blomberg [EMAIL PROTECTED] writes: One way would be to use the nls package: library(nls) # your y values foo.dat - (0.83 * exp(-0.017 * 1:1000) + 0.5) + rnorm(1000,0,0.05) # create some x values in a data frame foo.dat - data.frame(cbind(foo.dat, 0:999)) names(foo.dat) - c(y, x) # give them names # assume you have reasonable guesses for the starting parameter values model - nls( y ~ N * exp(-r * x) + c, start = list( N = 1, r = .01, c = 0), data = foo.dat) resid(model) # display residuals Thanks for your answer Simon. I would have suggested a similar approach with two minor modifications: - use the logarithm of the rate constant r instead of r itself - take advantage of N and c being conditionally linear by using the 'plinear' algorithm in nls. The call to nls would be model - nls(y ~ cbind(exp(-exp(lr) * x), 1), start = c(lr = log(.01)), data = foo.dat, alg = 'plinear') __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] help on cut?
Dear R-users, I'm trying to recode a variable. After using cut(data.vector,breaks=my.breaks,labels=my.label) I need the data.vector to have the same values as the labels. To make it clear: x-runif(10) y-cut(x,breaks=c(0,0.3,0.7,0.9,1),labels=c(3,6,7,9)) as.numeric(y) returns something like a vector 1 3 3 2 2 1 4 2 3 4 . I need something like 3 7 7 6 6 3 7 9 6 7 9 for further use. I might be using the wrong function but a loop seems to be inefficient as I need to do it about 60 times with varying length of labels Is there a quick solution? Thanks for any help in advance! Nina Wawro R.1.6.0 on Windows2000 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] help on cut?
cut returns a factor. Try something like t1 - cut(data.vector, breaks = my.breaks, labels = my.label) as.numeric(as.character(t1)) This is an issue that comes up frequently with factor. Take a look at the help page for factor for some warnings. Hope this helps, Matt Wiener -Original Message- From: Nina Wawro [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 11:39 AM To: R-help Subject: [R] help on cut? Dear R-users, I'm trying to recode a variable. After using cut(data.vector,breaks=my.breaks,labels=my.label) I need the data.vector to have the same values as the labels. To make it clear: x-runif(10) y-cut(x,breaks=c(0,0.3,0.7,0.9,1),labels=c(3,6,7,9)) as.numeric(y) returns something like a vector 1 3 3 2 2 1 4 2 3 4 . I need something like 3 7 7 6 6 3 7 9 6 7 9 for further use. I might be using the wrong function but a loop seems to be inefficient as I need to do it about 60 times with varying length of labels Is there a quick solution? Thanks for any help in advance! Nina Wawro R.1.6.0 on Windows2000 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help on cut?
Dear R-users, I'm trying to recode a variable. After using cut(data.vector,breaks=my.breaks,labels=my.label) I need the data.vector to have the same values as the labels. To make it clear: x-runif(10) y-cut(x,breaks=c(0,0.3,0.7,0.9,1),labels=c(3,6,7,9)) as.numeric(y) returns something like a vector 1 3 3 2 2 1 4 2 3 4 . I need something like 3 7 7 6 6 3 7 9 6 7 9 for further use. y is a factor and you want a numeric representing the factor labels, this is in section 7.12 of the R-FAQ: R x-runif(10) R y-cut(x,breaks=c(0,0.3,0.7,0.9,1),labels=c(3,6,7,9)) R y [1] 3 7 9 3 6 6 7 7 3 6 Levels: 3 6 7 9 R as.numeric(as.character(y)) [1] 3 7 9 3 6 6 7 7 3 6 Torsten I might be using the wrong function but a loop seems to be inefficient as I need to do it about 60 times with varying length of labels Is there a quick solution? Thanks for any help in advance! Nina Wawro R.1.6.0 on Windows2000 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Two y-axes for a plot
Hi, how would I plot two series in the same plot, but with two y-axes (one on the left and one on the right)? Would this be possible? [The two series have quite different y-values, so using the same y-axis for both is not possible.] Thanks very much! __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] na.rm in sd()
On Wed, 29 Jan 2003, Heberto Ghezzo wrote: Hello, I think this qualify as a bug x-c(1,2,3,4,NA,6,7) mean(x) [1] NA mean(x,na.rm=T) [1] 3.83 sd(x) Error in var(as.vector(x)) : missing observations in cov/cor sd(x,na.rm=T) Error in sd(x, na.rm = T) : unused argument(s) (na.rm ...) var(x) Error in var(x) : missing observations in cov/cor var(x,na.rm=T) [1] 5.37 why sd() does not recognize the na.rm=T parameter, while var does? R 1.6.1 on Win98 It works for me in R 1.6.1 on Windows. x-c(1,2,3,4,NA,6,7) sd(x,na.rm=TRUE) [1] 2.316607 and looking at the code for sd it certainly should. Are you sure you don't have another defintion of sd() lurking? -thomas __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] na.rm in sd()
Heberto Ghezzo wrote: Hello, I think this qualify as a bug x-c(1,2,3,4,NA,6,7) mean(x) [1] NA mean(x,na.rm=T) [1] 3.83 sd(x) Error in var(as.vector(x)) : missing observations in cov/cor sd(x,na.rm=T) Error in sd(x, na.rm = T) : unused argument(s) (na.rm ...) var(x) Error in var(x) : missing observations in cov/cor var(x,na.rm=T) [1] 5.37 why sd() does not recognize the na.rm=T parameter, while var does? R 1.6.1 on Win98 It works with R-1.6.2 (!) which is recent. There was a bug fix regarding NAs and sd() in R-1.6.1, so I guess your version is older than the official release of R-1.6.1. Uwe Ligges R.Heberto Ghezzo Ph.D. Meakins-Christie Labs McGill University Montreal - Canada __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] browser() misbehavior ?
Under v1.6.2, Windows NT4 OS, when a function contains an execution error and I have placed browser() in inside the function body, the call to browser is ignored. A brief example to illustrate: foo - function(x) { + y - x ^ 2 + browser() + foo2(x) ## Intentional error + x ^ 3 + } foo(30) Called from: foo(30) Browse[1] Error in foo(30) : couldn't find function foo2 ## browser() still seems to be ignored even if a function has no execution error traceback() 1: foo(30) Has anyone else experienced this? I am using v1.6.2 on Windows NT 4. Under Linux i686 (Mandrake 9.0), the same example works as expected; execution is stopped and I can usefully browser() as it is designed. As always, any advice is welcome. Thanks, Bill Bill Pikounis, Ph.D. Biometrics Research Department Merck Research Laboratories PO Box 2000, MailDrop RY84-16 126 E. Lincoln Avenue Rahway, New Jersey 07065-0900 USA [EMAIL PROTECTED] Phone: 732 594 3913 Fax: 732 594 1565 -- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Error
people, I'm using the pixmap library and method read.pnm() for to read figures and it's giving the following error: Error in substr(inpstr, com1, stop = ns) : evaluation is nested too deeply: infinite recursion? I think that to be because of its size. Am I correct? Tks, Francisco. ^^ Francisco Júnior, Computer Science - UFPE-Brazil One life has more value that the world whole ^^ __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] random number generator?
On Wed, 29 Jan 2003, Paul Gilbert wrote: If reworking the RNG mechanism is considered seriously (and I am not advocating that), I suggest: 1/ There should be a simple mechanism for keeping track of and resetting all the information to generate random numbers, that is, seed, uniform generator, and transformations. (I have a package, which I intend to distribute shortly, that does this for normal distributions and might form a basis for this mechanism. It was previously part of my syskern package in dse, and so the mechanism has been fairly well tested over several years.) That's what RNGkind and set.seed do, and have done for a long time. The information is also stored in .Random.seed, but few users would record that (and it does not exist until the first RNG is used). -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] multinomial conditional logit models
A multinomial logit model can be specified as a conditional logit model after restructuring the data. Doing so gives flexibility in imposing restrictions on the dependent variable. One application is to specify a loglinear model for square tables, e.g. quasi-symmetry or quasi-independence, as a multinomial logit model with covariates. Further details on this technique and examples with several packages are on my homepage at http://www.xs4all.nl/~jhckx/mcl/ I've been trying to implement an MCL model in R and have been mostly succesful. However I'm still stuck on a few points and I'm hoping someone can point out how to do fix them. To estimate an MCL model, the data must be restructured into a person-choice file. * Each case must be duplicated ncat times (ncat is the number of categories of the dependent variable) * Each case must be identified by a strata variable (id) * Each duplicate must be identified by a variable indexing the choices (newy) * A dichotomous variable must indicate which duplicate corresponds with the respondent's choice (didep) I've done this as follows: mclgen - function (datamat,catvar) { ncat - nlevels(catvar) id-1:length(catvar) datamat-cbind(id,datamat) perschoice -NULL for (i in 1:ncat) { perschoice-rbind(perschoice,datamat) } perschoice-perschoice[sort.list(perschoice$id),] perschoice$newy-gl(ncat,1,length=nrow(perschoice)) dep-parse(text=paste(perschoice$,substitute(catvar),sep=)) perschoice$depvar-as.numeric(eval(dep)==perschoice$newy) perschoice } This works but I wonder if it's the most efficient method. I tried using rep rather than rbind in a loop but that replicated the dataset horizontally, not vertically. Is this the best solution? I also finally figure out how to include the argument catvar in a transformation involving another dataset but this solution seems very complicated (eval+parse+substitute). Is there a simpler solution? What I haven't figured out is how to use catvar once again but on the righthand side of the transformation. In the second to last line, I'd like to do perschoice$catvar-perschoice$newy. I've tried several possibities but I can't figure out how to let R substitute the value of catvar in that expression. eval(dep) doesn't work as it does for the lefthand side but how should it be done? My solution for now is to do it afterward. My program continues as follows: pc-mclgen(logan,occ) pc$occ-factor(pc$newy) library(survival) cl.lr-clogit(depvar~occ+occ:educ+occ:black+strata(id),data=pc) summary(cl.lr) The dataset logan is available from the website. occ is the dependent variable, educ and black are independents. Once mclgen has transformed the data into a person-choice file, a multinomial logit model can be estimated using the dichotomous dependent variable, the main effects of occ for the intercept term and interactions of educ and black with occ for the effects of these variables. This works more or less. What's unexpected though is that the reference category of occ isn't dropped in the interactions with educ and black. The highest category is dropped due to collineairity but that's not quite what I want. Could someone explain why this happens and how to let R drop the first category? A final problem is that the results of clogit are only approximate (2 digits) whereas in other packages the cl model produces exactly the same estimates as an mnl model. Is this because terms are dropped due to collinearity or are there options I should examine. clogit issues the following warnings which seem to be related to the collinearity but perhaps point to something else: Warning messages: 1: Loglik converged before variable 10 ; beta may be infinite. in: fitter(X, Y, strats, offset, init, control, weights = weights, 2: X matrix deemed to be singular; variable 9 14 in: coxph(formula = Surv(rep(1, 4190), depvar) ~ occ + occ:educ + Apologies for the length of this post. Hopefully someone will have time to read it through and help me out. As always, advance thanks for any assistance. John Hendrickx __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] random number generator?
[EMAIL PROTECTED] writes: That's what RNGkind and set.seed do, and have done for a long time. The information is also stored in .Random.seed, but few users would record that (and it does not exist until the first RNG is used). .. but if you don't set the seed, you shouldn't expect reproducible behaviour anyway: [pd@rasch pd]$ echo rnorm(2) | R --vanilla --slave [1] 2.0281025 0.8735026 [pd@rasch pd]$ echo rnorm(2) | R --vanilla --slave [1] -1.2695122 -0.0448524 I mean, if the prototypical answer to people complaining I'm not getting the same results is simply to ask them to put an RNGkind(Marsaglia-Multicarry,Kinderman-Ramage) next to their first set.seed(), how troublesome could it be? -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Course***R/Splus Fundamentals and Programming Techniques***February 2003
XLSolutions Corporation (www.xlsolutions-corp.com) is pleased to announce a two-day R course, R Fundamentals and Programming Techniques: Houston, Tx February 21-22 Atlanta February 24-25 London, UK - February 27-28 Early bird registration: 5% off ends January 31st. Payment due 7 days AFTER the class and Includes course materials, 90 days Technical Support for R, snacks and continental breakfast!) R is a freely available implementation of the S language and environment, for statistical computing and graphics similar to the commercial S-PLUS. You can download a copy of R software (Windows, Mac, Unix Linux) from http://cran.r-project.org. Course Description: This two-day R course focuses on a broad spectrum of topics, from reading raw data to a comparison of R, S and SAS. We will learn the essentials of data manipulation, graphical visualization and R programming. We will explore statistical data analysis tools, including graphics with data sets from areas such as Finance, Biopharm, manufacturing and E-commerce. However, participants are encouraged to bring their own data for an interactive session with the trainer. Registration and more information on outline, fees and trainers: Email Sue Turner: [EMAIL PROTECTED] Phone: 206-686-1578 x221 Visit us: www.xlsolutions-corp.com/training.htm Course Format: This course consists of a series of short lectures with demonstrations and interactive sessions for the participants. Each student is provided with bound copies of the notes and a CD-ROM containing all examples, exercises and software used on the course. Share Your Thoughts: Are there any additional topics you would like for this course to address? Would you like for this course to be offered in another city? Please let us know by contributing to our recommendation list: [EMAIL PROTECTED] Two-day R Fundamentals and Programming Techniques Pre-registration Form (Please email or print and fax: 206-686-1578) XLsolutions Corporation: For your Solutions needs, Consulting and Training. www.xlsolutions-corp.com Title.. First Name . Last Name Organization.. Mailing Address... ... ... Zip Code.. Country. Telephone... Fax ... E-mail Payment will be made by: (1) check (2) invoice Sincerely Elvis Miller, PhD Manager Training and Technical Support North American Division XLSolutions Corporation Email: [EMAIL PROTECTED] Phone: 206-686-1578 Web: www.xlsolutions-corp.com XLSolutions also offer customized private courses delivered by expert trainers with a track teaching and training record in their fields. XLSolutions Consulting Group meets your needs from design to development. __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] problems with by()
Hello, another problem. x-rep(1,10) y-rep(c(1,2),c(5,5)) z-seq(1:10) ab-data.frame(x,y,z) # now I want to do some work by the value of 'y' by(ab,y,mean) y: 1 x y z 1 1 3 y: 2 x y z 1 2 8 # I do not want all the means, only the mean of 'z' by(ab,y,function(x) mean(z)) y: 1 [1] 5.5 y: 2 [1] 5.5 by(ab,y,function(x) mean(z,data=x)) y: 1 [1] 5.5 y: 2 [1] 5.5 # so, how can I get the function(x) to be applied to each level of the index variable y. Actually I use my own function but the same happens, it is applied to all the data and there is no partition of the data acording to index Do not tell me that this version of R is completely buggy, I was waiting for the 1.7 to be out before upgrading R : Copyright 2002, The R Development Core Team Version 1.6.1 (2002-11-01) R.Heberto.Ghezzo Ph.D. Meakins-Christie Labs McGill University Montreal - Canada __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Error
(Please use a more informative Subject:, for example naming the package. I haven't changed the Subject:, but it should be substr() error in read.pnm) On Wed, 29 Jan 2003, Francisco do Nascimento Junior wrote: people, I'm using the pixmap library and method read.pnm() for to read figures and it's giving the following error: Error in substr(inpstr, com1, stop = ns) : evaluation is nested too deeply: infinite recursion? If you look at the code of read.pnm() you see that it calls read.pnmhead(). Within this is a function called strip.comments(). My guess is that someone has written a dissertation instead of a comment. PNM files have ASCII headers, so you could try simply shortening any comments you see. If you can put the offending file on a website I can take a look at it. At present read.pnmhead() assumes that the header is not more than 350 characters long; if you enter debug(read.pnmhead) before running read.pnm(), you will see which line it fails at. Please contact me off the list. Roger Bivand I think that to be because of its size. Am I correct? Tks, Francisco. ^^ Francisco Júnior, Computer Science - UFPE-Brazil One life has more value that the world whole ^^ __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problems with by()
x-rep(1,10) y-rep(c(1,2),c(5,5)) z-seq(1:10) ab-data.frame(x,y,z) tapply(ab$z,ab$y,mean) 1 2 3 8 ---Original Message--- From: Heberto Ghezzo [EMAIL PROTECTED] Sent: 01/29/03 03:24 PM To: r-help [EMAIL PROTECTED] Subject: [R] problems with by() so, how can I get the function(x) to be applied to each level of the index variable y. Actually I use my own function but the same happens, it is applied to all the data and there is no partition of the data acording to index __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Error using read.pnm() of pixmap
people, I'm using the pixmap library and method read.pnm() for to read figures and it's giving the following error: Error in substr(inpstr, com1, stop = ns) : evaluation is nested too deeply: infinite recursion? I think that to be because of its size. Am I correct? Tks, Francisco. ^^ Francisco Júnior, Computer Science - UFPE-Brazil One life has more value that the world whole ^^ __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] RODBC sqlSave Error
Hi, i get error after using a data.frame with subset for sqlSave. What can i do ? It seems that lines like this in a data.frame structure are after subset deleted and cause the error ? - attr(*, variable.labels)= Named chr CUSID Welle Arbeitgeberfavorit1 Aktuelle Bewerbungssituation ... ..- attr(*, names)= chr CUSID WELLE Q21 BEWERB ... sqlSave(channel,mno.x,verbose=T) Query: CREATE TABLE mno.x (rownames varchar(255) ,BEWERB double ,MEDIENPRÄSENZ double ,GESCHLECHT double ) Error in sqlSave(channel, mno.x, verbose = T) : [RODBC] ERROR: Could not SQLExecute str(mno.x) `data.frame': 583 obs. of 3 variables: $ BEWERB : num 2 2 1 2 1 1 2 2 1 1 ... $ MEDIENPRÄSENZ: num 73.3 75.0 70.0 60.0 100.0 ... $ GESCHLECHT : num 1 1 1 1 1 1 1 1 1 1 ... { RODBC-1-0-1,R-1.6.2,W2k } many thanks, christian __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] RODBC sqlSave Error
The error is quite clear: the SQLexecute command failed. That's not an R error, but an SQL error, so ask your DBMS helpline. For example, does whatever DBMS this is support German labels? Does it support table names like mno.x? Do you have permissions to create tables? On Wed, 29 Jan 2003, Christian Schulz wrote: Hi, i get error after using a data.frame with subset for sqlSave. What can i do ? It seems that lines like this in a data.frame structure are after subset deleted and cause the error ? - attr(*, variable.labels)= Named chr CUSID Welle Arbeitgeberfavorit1 Aktuelle Bewerbungssituation ... ..- attr(*, names)= chr CUSID WELLE Q21 BEWERB ... sqlSave(channel,mno.x,verbose=T) Query: CREATE TABLE mno.x (rownames varchar(255) ,BEWERB double ,MEDIENPRÄSENZ double ,GESCHLECHT double ) Error in sqlSave(channel, mno.x, verbose = T) : [RODBC] ERROR: Could not SQLExecute str(mno.x) `data.frame': 583 obs. of 3 variables: $ BEWERB : num 2 2 1 2 1 1 2 2 1 1 ... $ MEDIENPRÄSENZ: num 73.3 75.0 70.0 60.0 100.0 ... $ GESCHLECHT : num 1 1 1 1 1 1 1 1 1 1 ... { RODBC-1-0-1,R-1.6.2,W2k } many thanks, christian __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Weird options(digits=n) behaviour
I noticed some very weird behaviour of the function: options(digits=n), where n is the number of digits you would expect to get in R calculations. Let's take a example: options(digits=4) getdata(caso.pool.k3.r3.e2) [1] 6.053 2.641 -3.639 14.259 6.082 Which works fine... now, trying again, with different data: options(digits=4) getdata(controle.pool.k3.r3.e2) [1] -0.03091 1.60310 -4.90588 5.07379 -0.04418 Which gives me 6 digits instead of 6. If I try digits=2, it then works with this data: options(digits=2) getdata(controle.pool.k3.r3.e2) [1] -0.031 1.603 -4.906 5.074 -0.044 But not with the first one: getdata(caso.pool.k3.r3.e2) [1] 6.1 2.6 -3.6 14.3 6.1 getdata source code is as folllows: function(v) { o - c(mean(v),sd(v),min(v),max(v),median(v)) o } What is going on? -- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] browser() misbehavior ?
Dear Bill, Your example works fine for me with R 1.6.2 under Windows 2000. The behaviour that you report should occur if you press RETURN at the browser prompt, but that seems unlikely. John At 02:07 PM 1/29/2003 -0500, Pikounis, Bill wrote: Under v1.6.2, Windows NT4 OS, when a function contains an execution error and I have placed browser() in inside the function body, the call to browser is ignored. A brief example to illustrate: foo - function(x) { + y - x ^ 2 + browser() + foo2(x) ## Intentional error + x ^ 3 + } foo(30) Called from: foo(30) Browse[1] Error in foo(30) : couldn't find function foo2 ## browser() still seems to be ignored even if a function has no execution error traceback() 1: foo(30) Has anyone else experienced this? I am using v1.6.2 on Windows NT 4. Under Linux i686 (Mandrake 9.0), the same example works as expected; execution is stopped and I can usefully browser() as it is designed. As always, any advice is welcome. Thanks, Bill Bill Pikounis, Ph.D. Biometrics Research Department Merck Research Laboratories PO Box 2000, MailDrop RY84-16 126 E. Lincoln Avenue Rahway, New Jersey 07065-0900 USA [EMAIL PROTECTED] Phone: 732 594 3913 Fax: 732 594 1565 -- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help John Fox Department of Sociology McMaster University email: [EMAIL PROTECTED] web: http://www.socsci.mcmaster.ca/jfox __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Weird options(digits=n) behaviour
Fernando Henrique Ferraz Pereira da Rosa [EMAIL PROTECTED] writes: options(digits=4) [1] 6.053 2.641 -3.639 14.259 6.082 [1] -0.03091 1.60310 -4.90588 5.07379 -0.04418 options(digits=2) [1] -0.031 1.603 -4.906 5.074 -0.044 [1] 6.1 2.6 -3.6 14.3 6.1 What is going on? This is normal. digits=4 means that you need at least four significant digits of the result. When you print vectors all values get printed in the same format. Notice that in the second case -0.03091 has 4 significant digits and -0.04418 ditto and in the 3rd case likewise. 6.1 has two significant digits by the same conventions. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problems with by()
On Wed, 29 Jan 2003, Heberto Ghezzo wrote: Hello, another problem. x-rep(1,10) y-rep(c(1,2),c(5,5)) z-seq(1:10) ab-data.frame(x,y,z) # now I want to do some work by the value of 'y' by(ab,y,mean) y: 1 x y z 1 1 3 y: 2 x y z 1 2 8 # I do not want all the means, only the mean of 'z' by(ab,y,function(x) mean(z)) y: 1 [1] 5.5 y: 2 [1] 5.5 by(ab,y,function(x) mean(z,data=x)) y: 1 [1] 5.5 y: 2 [1] 5.5 # so, how can I get the function(x) to be applied to each level of the index variable y. Actually I use my own function but the same happens, it is applied to all the data and there is no partition of the data acording to index The function you are applying is function(x) mean(z) That is, no matter what x is supplied, it calculates the mean of the variable z, which is in your global workspace. The mean of z is 5.5 What you want is function(x) mean(x$z) That is, take a supplied data frame and compute the mean of its `z' column. I try to use argument names that remind me what is happening in functions like by() by(ab,y, function(df) mean(df$z)) or even by(ab, y, function(subset) mean(subset$z)) Do not tell me that this version of R is completely buggy, I was waiting for the 1.7 to be out before upgrading I think it's fair to characterise this sort of commment as `unhelpful'. -thomas __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] fptex link?
Hi R developers: I am collecting the elements to Build R on W2K. But I found that the www.fptex.org link, lead me to www.dante.de site. In this site I don't found where to download the fptex software. And worst: ich spreche kein Deutch!!! Danke sehr! __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] fptex link?
Get FPTeX from ctan.org On Wed, 29 Jan 2003 19:55:27 -0500 Kenneth Cabrera [EMAIL PROTECTED] wrote: Hi R developers: I am collecting the elements to Build R on W2K. But I found that the www.fptex.org link, lead me to www.dante.de site. In this site I don't found where to download the fptex software. And worst: ich spreche kein Deutch!!! Danke sehr! __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Frank E Harrell Jr Prof. of Biostatistics Statistics Div. of Biostatistics Epidem. Dept. of Health Evaluation Sciences U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Principal comp. scores in R
Hello, I am trying to run a PCA in R and I cannot get the PC scores for each of the values. Using pcX - princomp(X) then loadings(pcX) I can get a listing of the eigenvectors but not the actual PC scores for each value in the dataset. I greatly appreciate any help anyone can offer Thanks Ken __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] TukeyHSD and BIBD
Hi, the function TukeyHSD gives incorrect results for balanced incomplete block designs, as the example below shows, but I can only half fix it. There are two problems, 1. It uses model.tables to estimate treatment means, 2. It uses the wrong standard error The first problem can be fixed using dummy.coef, if the lines TukeyHSD.aov function (x, which = seq(along = tabs), ordered = FALSE, conf.level = 0.95, ...) { mm - model.tables(x, means) tabs - mm$tables[-1] tabs - tabs[which] ... are altered to TukeyHSD.aov function (x, which = seq(along = tabs), ordered = FALSE, conf.level = 0.95, ...) { mm - model.tables(x, means) tabs - dummy.coef(x) ## This line changed tabs - tabs[which] ... it calculates the right treatment differences (provided the block term preceeds the treatment in the model formula). To solve the second problem, I can manually get the correct se from summary.lm, but I can't figure out how to extract the right se from summary.lm programmatically. I don't think these changes would make TukeyHSD fail on other cases, but I haven't tested so I'm not sure. I hope these few observations can help someone a bit more knowledgable than I fix this problem. Simon. --- __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Kruskal-Wallis, Friedman tests and Tukey HSD
Dear all Is there any way of doing a Tukey HSD post-hoc test after a Kruskal- Wallis or Friedman rank sum test (in the ctest package)? Thanks in advance, Albertus Dr. Albertus J. Smit Department of Botany University of Cape Town Private Bag Rondebosch 7700 South Africa Tel. +27 21 689 3032 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help