[R] How to generate a list of lists recursively (for bayesm)
Dear all, I need to generate a list of lists as required by the bayesm-package. This means in my application that I have to generate a list which consists of 2000 elements, which are lists themselves: list(list(y1,X1),...,list(y2000,X2000)). The y are vectors and the X are matrices of different dimensions. I tried to solve this problem iteratively by the following code, but received an error message, which I do not understand: for(i in 1:1067){ + c-0 + for(j in 1:300){ + if(Sk[i,j]!=0){ + c-c+1 + if(c==1){ + X1-att[j,] + X2-attq8[j,] + y-Sk[i,j] + } + else{ + X1-rbind(X1,att[j,]) + X2-rbind(X2,attq8[j,]) + y-rbind(y,Sk[i,j]) + } + }} + regdata1[[c(i,1)]]-y + regdata1[[c(i,2)]]-X1 + regdata2[[c(i,1)]]-y + regdata2[[c(i,2)]]-X2 + } Fehler: objekt regdata1 nicht gefunden ??? So, does anybody know what I did wrong or how I can generate my list of lists? Regards, Moritz Moritz Marienfeld Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 44,85 inkl. DSL- und ISDN-Grundgebühr! __ 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.search(plot)
Dear List-Members, When typing the command: help.search(plot) in Version R2.0.1, I get the following message Error in rbind(...) : number of columns of matrices must match (see arg 2) which does not make much sense to me. I remember that some time ago I would get the information expected. I do not know what happened in the mean time. Any ideas about the problem? Thanks! Sincerely, Jean-Pierre Airoldi --- * * Dr Airoldi Jean-Pierre * Zoologisches Institut * Universität Bern * Baltzerstrasse 6 * CH - 3012 BERN (Switzerland) * * Tél. + 41 31 631 45 71 * FAX + 41 31 631 31 88 * e-mail: [EMAIL PROTECTED] * http://www.cx.unibe.ch/~airoldi __ 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
Hi, Is there a way to run a multilevel model in R with an ordered response model (either ordered logit or ordered probit)? Thank you, in advance, for any help. Joe [[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] Default lag.max in ACF
I don't know why the default lag.max is 10*log10(N/m) for m series. The acf help page includes the following: Author(s): Original: Paul Gilbert, Martyn Plummer. Extensive modifications and univariate case of 'pacf' by B.D. Ripley. I've copied these three contributors on this email. With luck, one of them will enlighten us both. Best Wishes, spencer graves Rafal Stankiewicz wrote: Hi, The default value for lag.max in ACF implementation is 10*log10(N) There several publications recommending setting lag.max to: - N/4 (Box and Jenkins, 1970; Chatfield, 1975; Anderson, 1976; Pankratz, 1983; Davis, 1986; etc.) - sqrt(N)+10 (Cryer, 1986) - 20=N=40 (Brockwell and Davis) Why R uses 10*log10(N) as a default? Please, give me a reference to a book or article where the recommendation for using lag.max=10*log10(N) is proposed and explained. Thanks Rafal __ 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.search(plot)
Dear List-Members, When typing the command: help.search(plot) in Version R2.0.1, I get the following message Error in rbind(...) : number of columns of matrices must match (see arg 2) which does not make much sense to me. I remember that some time ago I would get the information expected. I do not know what happened in the mean time. Any ideas about the problem? Thanks! Sincerely, Jean-Pierre Airoldi --- * * Dr Airoldi Jean-Pierre * Zoologisches Institut * Universität Bern * Baltzerstrasse 6 * CH - 3012 BERN (Switzerland) * * Tél. + 41 31 631 45 71 * FAX + 41 31 631 31 88 * e-mail: [EMAIL PROTECTED] * http://www.cx.unibe.ch/~airoldi __ 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] Skewed t distribution
Dear All, I am working with skewed-t copula in my research recently, so I needed to write an mle procedure instead of using a standard fit one; I stick to the sn package. On subsamples of the entire population that I deal with, everything is fine. However, on the total sample (difference in cross-sectional dimension: 30 vs 240) things go wrong - the objective function diverges to infinity. I located the rotten line to be t1 - dmst(vector, mu, P, alpha, nu) where vector is the matrix row, on which I evaluate my likelihood and the rest in parametrized in a standard way, just as the help pages give it. In large dimensions, I get a zero value of the density (which is probably due to numerical issues). I tried the following dummy example t1 - rmst(1,mu,P,alpha, nu) t2 - dmst(t1, mu, alpha,nu) and t2 remains to be zero. Can anyone help me on this one? thanks in advance, Konrad -- We are what we pretend to be, so we must be careful about what we pretend to be Kurt Vonnegut Jr. Mother Night [[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] help.search(plot)
It means you have a package installed with corrupt metadata. R 2.0.1 is 18 months old, and the problem has been worked around long since. Please upgrade, as the posting guide asked you to do (before posting). On Tue, 28 Mar 2006, Airoldi Jean-Pierre wrote: Dear List-Members, When typing the command: help.search(plot) in Version R2.0.1, I get the following message Error in rbind(...) : number of columns of matrices must match (see arg 2) which does not make much sense to me. I remember that some time ago I would get the information expected. I do not know what happened in the mean time. Any ideas about the problem? Thanks! Sincerely, Jean-Pierre Airoldi --- * * Dr Airoldi Jean-Pierre * Zoologisches Institut * Universität Bern * Baltzerstrasse 6 * CH - 3012 BERN (Switzerland) * * Tél. + 41 31 631 45 71 * FAX + 41 31 631 31 88 * e-mail: [EMAIL PROTECTED] * http://www.cx.unibe.ch/~airoldi __ 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 -- 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] How to generate a list of lists recursively (for bayesm)
1) see in ?[[: The most important distinction between '[', '[[' and '$' is that the '[' can select more than one element whereas the other two select a single element. 2) what are Sk, att, attq8, regdata1 and regdata2 ? [EMAIL PROTECTED] a écrit : Dear all, I need to generate a list of lists as required by the bayesm-package. This means in my application that I have to generate a list which consists of 2000 elements, which are lists themselves: list(list(y1,X1),...,list(y2000,X2000)). The y are vectors and the X are matrices of different dimensions. I tried to solve this problem iteratively by the following code, but received an error message, which I do not understand: for(i in 1:1067){ + c-0 + for(j in 1:300){ + if(Sk[i,j]!=0){ + c-c+1 + if(c==1){ + X1-att[j,] + X2-attq8[j,] + y-Sk[i,j] + } + else{ + X1-rbind(X1,att[j,]) + X2-rbind(X2,attq8[j,]) + y-rbind(y,Sk[i,j]) + } + }} + regdata1[[c(i,1)]]-y + regdata1[[c(i,2)]]-X1 + regdata2[[c(i,1)]]-y + regdata2[[c(i,2)]]-X2 + } Fehler: objekt regdata1 nicht gefunden ??? So, does anybody know what I did wrong or how I can generate my list of lists? Regards, Moritz Moritz Marienfeld Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 44,85 € inkl. DSL- und ISDN-Grundgebühr! __ 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] Skewed t distribution
Try maximizing the log-likelihood and using the log=TRUE argument to dmst. (You have told us so little about what you are doing that we can but guess at what you mean by `write an mle procedure': what is wrong with st.mle, for example?) On Tue, 28 Mar 2006, Konrad Banachewicz wrote: Dear All, I am working with skewed-t copula in my research recently, so I needed to write an mle procedure instead of using a standard fit one; I stick to the sn package. On subsamples of the entire population that I deal with, everything is fine. However, on the total sample (difference in cross-sectional dimension: 30 vs 240) things go wrong - the objective function diverges to infinity. I located the rotten line to be t1 - dmst(vector, mu, P, alpha, nu) where vector is the matrix row, on which I evaluate my likelihood and the rest in parametrized in a standard way, just as the help pages give it. In large dimensions, I get a zero value of the density (which is probably due to numerical issues). I tried the following dummy example t1 - rmst(1,mu,P,alpha, nu) t2 - dmst(t1, mu, alpha,nu) and t2 remains to be zero. Can anyone help me on this one? thanks in advance, Konrad -- We are what we pretend to be, so we must be careful about what we pretend to be Kurt Vonnegut Jr. Mother Night [[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 -- 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] Skewed t distribution
On Tue, 28 Mar 2006 11:41:19 +0200, Konrad Banachewicz wrote: please supply the ingredients needed to reproduce the problem that you have faced (including the values of the parameters mu,P,alpha,nu, among the rest) best wishes, Adelchi Azzalini KB Dear All, KB I am working with skewed-t copula in my research recently, so I KB needed to write an mle KB procedure instead of using a standard fit one; I stick to the sn KB package. On subsamples of the entire population that I deal with, KB everything is fine. However, on the total sample (difference in KB cross-sectional dimension: 30 vs 240) things go wrong - the KB objective function diverges to infinity. I located the rotten KB line to be KB KB t1 - dmst(vector, mu, P, alpha, nu) KB KB where vector is the matrix row, on which I evaluate my KB likelihood and the rest in parametrized in a standard KB way, just as the help pages give it. In large dimensions, I get a KB zero value of the density (which is probably due to numerical KB issues). I tried the following dummy example KB KB t1 - rmst(1,mu,P,alpha, nu) KB t2 - dmst(t1, mu, alpha,nu) KB KB and t2 remains to be zero. Can anyone help me on this one? KB KB thanks in advance, KB Konrad KB KB -- KB We are what we pretend to be, so we must be careful about what we KB pretend to be KB KB Kurt Vonnegut Jr. Mother Night KB KB [[alternative HTML version deleted]] KB KB __ KB R-help@stat.math.ethz.ch mailing list KB https://stat.ethz.ch/mailman/listinfo/r-help KB PLEASE do read the posting guide! KB http://www.R-project.org/posting-guide.html KB __ 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] Text size in select.list
Hi, I have a problem with select.list...how can I modify text size in the title?I've used the function windows changing pointsize,but it doesn't work.Thanks, Marco [[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] help.search(plot)
Airoldi Jean-Pierre wrote: Dear List-Members, When typing the command: help.search(plot) in Version R2.0.1, I get the following message Error in rbind(...) : number of columns of matrices must match (see arg 2) which does not make much sense to me. I remember that some time ago I would get the information expected. I do not know what happened in the mean time. Any ideas about the problem? Upgrade to less ancient version of R such as R-2.2.1 and be happy. Uwe Ligges Thanks! Sincerely, Jean-Pierre Airoldi --- * * Dr Airoldi Jean-Pierre * Zoologisches Institut * Universität Bern * Baltzerstrasse 6 * CH - 3012 BERN (Switzerland) * * Tél. + 41 31 631 45 71 * FAX + 41 31 631 31 88 * e-mail: [EMAIL PROTECTED] * http://www.cx.unibe.ch/~airoldi __ 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] TukeyHSD for repeated measures aov ?
Hi all, I search the archive for finding a simple solution for using TukeyHSD with a multistratum aov result (a repeated emasure anova). The Question have been asked but I've found no clear answer. res-aov(y~Fa*Fb+Error(Subject/(Fa*Fb)) ) I think that the problem is that res is an aovlist object instead of the aov object required by TukeyHSD. Is there an easy solution to this problem ? Sylvain Clément Sylvain CLEMENT (MCF) JE Neuropsychologie et Cognition Auditive UFR de Psychologie BP 60149, Université Ch. de Gaulle Lille 3 Domaine universitaire Pont de Bois 59 653 Villeneuve d'ascq Cedex FRANCE tél : (03 20 41) 64 42 __ 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] Skewed t distribution
On 3/28/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: Try maximizing the log-likelihood and using the log=TRUE argument to dmst. seems like dmst does not support this argument (the way e.g. dt does) (You have told us so little about what you are doing that we can but guess at what you mean by `write an mle procedure': what is wrong with st.mle, for example?) st.mle assumes skewed-t marginals (for a whole distribution), whereas I am working with a copula so my margins are uniform. The whole point is separating the joint and marginal dynamics. rg, konrad [[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] TukeyHSD for repeated measures aov ?
Hi all, I search the archive for finding a simple solution for using TukeyHSD with a multistratum aov result (a repeated emasure anova). The Question have been asked but I've found no clear answer. res-aov(y~Fa*Fb+Error(Subject/(Fa*Fb)) ) I think that the problem is that res is an aovlist object instead of the aov object required by TukeyHSD. Is there an easy solution to this problem ? Sylvain Clément Sylvain CLEMENT (MCF) JE Neuropsychologie et Cognition Auditive UFR de Psychologie BP 60149, Université Ch. de Gaulle Lille 3 Domaine universitaire Pont de Bois 59 653 Villeneuve d'ascq Cedex FRANCE tél : (03 20 41) 64 42 http://nca.recherche.univ-lille3.fr __ 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] Skewed t distribution
P is an identity matrix 240X240, mu and alpha are vectors of zeros 240X1, nu equals 10, so alltogether You need: P - matrix(0,244,244) diag(P) - 1 nu - 10 alpha - rep(0,244) mu - rep(0,244) require(sn) t1 - rmst(1,mu,P, alpha, nu) t2 - dmst(t1,mu,P,alpha,nu) please supply the ingredients needed to reproduce the problem that you have faced (including the values of the parameters mu,P,alpha,nu, among the rest) best wishes, Adelchi Azzalini [[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] gam y-axis interpretation
All smooths in a GAM are `centred' in order to ensure model identifiability. This means that a smooth, s, is estimated subject to the constraint that \sum_i s(x_i)=0, where, x_i, are the covariate values. So you can't transform back to the response scale just by applying the inverse link, even if there is only one smooth. In the single smooth case, you would need to add on the model intercept before applying the inverse link. If you need plots on the response scale then it is best to use the `predict' method function and have it return results on the `response' scale... best, Simon - Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY - +44 (0)1225 386603 www.maths.bath.ac.uk/~sw283/ On Thu, 23 Mar 2006, Bliese, Paul D LTC USAMH wrote: Sorry if this is an obvious question... I'm estimating a simple binomial generalized additive model using the gam function in the package mgcv. The model makes sense given my data, and the predicted values also make sense given what I know about the data. However, I'm having trouble interpreting the y-axis of the plot of the gam object. The y-axis is labeled s(x,2.52) which I understand to basically mean a smoothing estimator with approximately 2.52 degrees of freedom. The y-axis in my case ranges from -2 to 6 and I thought that it would be possible to convert the Y axis estimate to a probability via exp(Y)/(1+exp(Y)). So for instance, my lowest y-axis estimate is -2 for a probability of: exp(-2)/(1+exp(-2)) [1] 0.1192029 However, if I use the predict function my lowest estimate is -3.53862893 for a probability of 2.8%. The 2.8% estimate is a much better estimate than 11.9% given my specific data, so I'm clearly not interpreting the plot correctly. The help files say plot.gam provides the component smooth functions that make it up, on the scale of the linear predictor. I'm just not sure what that description means. Does someone have another description that might help me grasp the plot? Similar plots are on page 286 of Venables and Ripley (3rd Edition)... Thanks, Paul [[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] Skewed t distribution
You need to learn to supply adequate information. The current version of sn *does* have such an argument, and I was careful to check. So it seems that you are using an unstated obselete version of sn. Do ugrade as the posting guide asked you to. On Tue, 28 Mar 2006, Konrad Banachewicz wrote: On 3/28/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: Try maximizing the log-likelihood and using the log=TRUE argument to dmst. seems like dmst does not support this argument (the way e.g. dt does) (You have told us so little about what you are doing that we can but guess at what you mean by `write an mle procedure': what is wrong with st.mle, for example?) st.mle assumes skewed-t marginals (for a whole distribution), whereas I am working with a copula so my margins are uniform. The whole point is separating the joint and marginal dynamics. rg, konrad -- 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] Remove [1] ... from output
Hello! I am writing some numbers and character vectors to an ascii file and would like to get rid of [1] ... as shown bellow (a dummy example) R runif(20) [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252 0.506480 0.547759 [9] 0.912421 0.584382 0.987208 0.996846 0.666760 0.053637 0.327590 0.370737 [17] 0.505706 0.412316 0.887421 0.812151 I have managed to work up to remove quotes and all [*] except [1] as shown bellow. R print(paste(runif(20), collapse = ), quote = FALSE) [1] 0.790620362851769 0.45603066496551 0.563822037540376 0.812907998682931 0.726162418723106 0.37031230609864 0.681147597497329 0.29929908295162 0.209858040558174 0.304300333140418 0.105796672869474 0.743657597573474 0.409294542623684 0.825012607965618 0.282235795632005 0.21159387845546 0.620056127430871 0.337449935730547 0.754527133889496 0.280175548279658 Any hints how to solve my task? -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ 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] Still problems with step() function
On Thu, 23 Mar 2006, Kenneth Cabrera wrote: What am I doing wrong? Not paying enough attention to the posting guide. Your example works in R-patched and R-devel, because of o factor.scope() could report incorrectly that interaction terms were not in the upper scope when such terms in the model and the upper scope had different orders for the main effects. (Another manifestation of PR#7842.) in the NEWS for R 2.2.1 patched. As the posting guide says If possible, try the current R-patched or R-devel version of R (see the FAQ for details), to see if the problem has already been addressed. Ok Here is the complete command secuence -- testData-structure(list(MCHNV = c(215, 325, 435, 327, 150, 949, 417, 528, 572, 1255, 517, 221, 306, 274, 307, 203, 258, 126, 88, 85, 75, 64, 77, 49, 133, 192, 32, 73, 139, 52, 17, 307, 127, 182, 24, 51, 141, 40, 76, 40, 100, 42, 18, 20, 18, 75, 26, 21, 216, 81, 90, 69, 138, 79, 69, 52, 59, 69, 173, 29, 118, 23, 1456, 156, 26, 208, 294, 84, 57, 84, 121, 112, 25, 9281, 36, 71, 812, 135, 215, 94, 302, 148, 42, 84, 114, 54, 309, 148, 87, 75, 275, 171, 210, 209, 150, 69, 157, 110, 93, 98, 40, 132, 155, 152, 62, 52, 50, 124, 248, 52, 181, 76, 118, 73, 66, 65, 75, 33, 71, 84, 223, 229), IA = c(26.9863956381346, 21.443816698054, 24.3172115328382, 22.9861973271014, 18.1768608561301, 10.6563785744498, 15.0910419778194, 13.6340158642317, 15.2055383362367, 16.9860295444068, 17.9909267660402, 26.714962883463, 20.1507989217486, 27.4221304422647, 11.806433704469, 25.7458563535912, 27.2816742408892, 26.0150722854506, 21.6368286445013, 25.1843952723718, 18.6270125223614, 29.9515311742675, 26.2046204620462, 12.6096949435855, 18.7464907355418, 10.5534246575342, 17.2654236774291, 17.0988006853227, 15.353091109001, 19.3008705114255, 6.27750073335289, 26.0375981018434, 17.2681438238026, 15.443279313632, 7.7125328659071, 30.1453193646502, 14.8701064405557, 24.7907034861927, 17.3296398891967, 10.7364199781261, 19.3800588668138, 10.3085483055134, 8.80185302168878, 16.6951761888471, 4.50797141286421, 6.84546862896979, 8.21845174973489, 6.19588744588745, 16.9889711436773, 5.59826387611726, 8.68694955964772, 3.65186966980101, 16.1123827476325, 9.67841682127396, 13.5423542354235, 5.6497484139138, 8.7686432740111, 11.9602529358627, 6.86294126054023, 19.2194992008524, 4.64579055441478, 9.5090599349543, 2.79913286437223, 10.2515243902439, 8.66738894907909, 3.6576768917803, 12.4953778763831, 15.2370770972205, 21.2257484260568, 7.8413206434768, 12.5950805097303, 6.23108480731724, 4.72859966550099, 3.11622388590868, 15.9319508257792, 6.69567319313512, 2.47749261819931, 24.8112304583644, 3.94306597422581, 2.71509876129896, 1.79760050991181, 4.80243967117475, 18.7818696883853, 5.24955116696589, 19.0728713579217, 12.6099706744868, 3.58964845561636, 11.3911041683795, 7.48350816481021, 15.0857882809971, 19.6855832458419, 12.2966073388367, 4.08228296275315, 21.4270750408514, 9.83262770545642, 6.28415300546448, 4.2754914877677, 10.4337099078042, 13.9745206313318, 14.0491684743312, 8.79131920024113, 15.2282010300124, 19.1379750063759, 6.89338235294118, 5.51527398074409, 18.3089033659066, 23.5368956743003, 10.3041872432253, 13.7563263088668, 12.0249520153551, 12.008763169, 9.25797503467406, 11.4912313643021, 14.2689601250977, 15.2254249815225, 14.0718562874251, 9.21820303383897, 9.9353894916494, 8.6011885743498, 14.7106815614409, 8.6682462336269, 10.9155102240965), IM = c(1.07456622007468, 1.05477685097601, 1.08970363580813, 1.09309079792113, 0.983952398124775, 0.97821952889272, 1.02464131763495, 0.913249100021176, 0.999321512574634, 1.00064160401003, 1.00311566921978, 1.03642655495856, 1.05350982751705, 1.03894736842105, 1.02694423605901, 1.0255795363709, 1.08604552865165, 0.9960092095165, 1.10034379028792, 1.05835010060362, 1.09069658719028, 1.08689655172414, 1.11247966534976, 1.06872703695699, 1.09098914000587, 0.947705442902882, 1.0462158808933, 1.06583294006607, 1.03178310316816, 1.02785822645152, 0.95582329317269, 1.03257159815996, 1.05732223283745, 1.05083088954057, 1.0375, 1.18054532056006, 1.08226897069872, 1.08357198646186, 1.11061739943873, 1.09309423884014, 1.14100039385585, 1.00222807372899, 1.02085106382979, 1.11658218682114, 1.08840413318025, 0.940623825629463, 1.07633027522936, 1.24954351795496, 1.06553284443751, 1.02449921811006, 1.03136617100372, 0.890711135611907, 1.01692767267131, 1.05692478931468, 1.00617965129111, 1.01988510826337, 1.02820400409177, 1.00325732899023, 0.969987048820317, 1.0319350473613, 0.948, 0.976430976430976, 0.912491945614184, 1.03805825242718, 1.01016333938294, 0.934502240405221, 0.936918076139056, 1.03298389158783, 1.06829657188414, 1.04918881601657, 1.0427807486631, 0.99369804237061, 1.00763125763126, 0.859808006713988, 1.06752246469833, 0.976588628762542, 0.900774538520513, 1.014353041988,
Re: [R] Sheather Jones Plug-In Bandwidth
What is 'hcj'? Did you perhaps mean hsj()? The Sheather-Jones methods (or at least one of them) are implemented in packages stats (from MASS), KernSmooth and sm, and all are for Normal kernels. There is a concept of `equivalent' bandwidth for different kernels discussed in all good books on the subject of kernel density estimation, and this will enable you to convert the bandwidth to other kernels: see the help page for density (which shows the factor is very close to one for the triangular kernel). On Wed, 22 Mar 2006, duraikannan sundaramoorthi wrote: Dear All, Is there a way to find bandwidths for Normal, and Triangular Kernels using Sheather Jones plug-in method. If not, is there a way we could convert the bandwidth obtained by the default( I assume that the default is standard normal) in hcj(x,...) to other kernels. I appreciate your help. Thanks Durai - [[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 -- 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] Skewed t distribution
On Tue, 28 Mar 2006 13:11:02 +0200, Konrad Banachewicz wrote: KB P is an identity matrix 240X240, mu and alpha are vectors of zeros KB 240X1, nu equals 10, so alltogether You need: KB P - matrix(0,244,244) KB diag(P) - 1 KB nu - 10 KB alpha - rep(0,244) KB mu - rep(0,244) KB require(sn) KB t1 - rmst(1,mu,P, alpha, nu) KB t2 - dmst(t1,mu,P,alpha,nu) KB KB With such a large dimension, numerical problems are obiquitous. At the very least, I suggest that you work on the log scale: R t2 - dmst(t1,mu,P,alpha,nu, log=TRUE) R t2 [1] -250.3 R exp(t2) [1] 2.002e-109 The next release of the 'sn' package will handle this sort of things in a more consisent way (the R code is largely updated, but the documentation is far behind..) -- Adelchi Azzalini [EMAIL PROTECTED] Dipart.Scienze Statistiche, Università di Padova, Italia tel. +39 049 8274147, http://azzalini.stat.unipd.it/ KB KB KB please supply the ingredients needed to reproduce the problem KB that you have faced (including the values of the parameters KB mu,P,alpha,nu, among the rest) KB KB best wishes, KB KB Adelchi Azzalini KB KB KB __ 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 generate a list of lists recursively (for bayesm)
thanx for the reply. Sk is a 1067*300 matrix att is a 300*15 matrix attq8 is a 300*17 matrix regdata1 and regdata2 are meant to become my 2 lists of lists by this procedure - I actually do not know if they should be initialized in any other way as lists of lists and how to do this. Moritz Marienfeld Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 44,85 inkl. DSL- und ISDN-Grundgebühr! Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 44,85 inkl. DSL- und ISDN-Grundgebühr! __ 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] Why is AIC from lmer 2 less than that from lme?
I'm migrating to lmer() from lme(). I have noticed that AIC values from lmer() are 2 units smaller than those reported by lme(). Could someone please explain why? The issue can be replicated with the first example from Pinheiro Bates (2000) Mixed-effects models in S and S-plus. library(nlme) Rail2 - Rail summary(lme(travel~1,data=Rail2,random=~1|Rail)) # AIC = 128.177 detach(package:nlme) library(Matrix) lmer(travel~1+(1|Rail),data=Rail2) # AIC = 126.177 Output is given below. The parameter estimates, standard errors and log likelihood seem virtually identical. I'm using R 2.2.1 on Windows XP SP2 (details below), lmer() from Matrix 0.995-8, and lme() from nlme 3.1-68.1 Thank you in advance for your help. Sincerely, Jon Olav Vik library(nlme) summary(lme(travel~1,data=Rail,random=~1|Rail)) Linear mixed-effects model fit by REML Data: Rail AIC BIC logLik 128.177 130.6766 -61.0885 Random effects: Formula: ~1 | Rail (Intercept) Residual StdDev:24.80547 4.020779 Fixed effects: travel ~ 1 Value Std.Error DF t-value p-value (Intercept) 66.5 10.17104 12 6.538173 0 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.61882658 -0.28217671 0.03569328 0.21955784 1.61437744 Number of Observations: 18 Number of Groups: 6 library(Matrix) lmer(travel~1+(1|Rail),data=Rail) Linear mixed-effects model fit by REML Formula: travel ~ 1 + (1 | Rail) Data: Rail AIC BIC logLik MLdeviance REMLdeviance 126.177 127.9577 -61.0885 128.6251 122.177 Random effects: Groups NameVariance Std.Dev. Rail (Intercept) 615.286 24.8050 Residual 16.167 4.0208 number of obs: 18, groups: Rail, 6 Fixed effects: Estimate Std. Error t value (Intercept) 66.500 10.171 6.5383 version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 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] TukeyHSD for repeated measures aov ?
Sylvain Clément sylvain.clement at univ-lille3.fr writes: I search the archive for finding a simple solution for using TukeyHSD with a multistratum aov result (a repeated emasure anova). The Question have been asked but I've found no clear answer. res-aov(y~Fa*Fb+Error(Subject/(Fa*Fb)) ) I would suggest that you use lme in package nlme for models of this type. It's much easier to handle, and there is excellent documentation including a book by the authors of the package (Pinheiro/Bates). However, a ready made multiple-testing procedure is not available for lme. Package multcomp provides one for lm type models, and Thorsten Hothorn has shown how it could be used with glm (and possibly lme in a similar way). http://finzi.psych.upenn.edu/R/Rhelp02a/archive/21117.html Dieter __ 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] Skewed t distribution
On Tue, 28 Mar 2006 12:59:34 +0200, Konrad Banachewicz wrote: KB On 3/28/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: KB KB Try maximizing the log-likelihood and using the log=TRUE KB argument to dmst. KB KB KB seems like dmst does not support this argument (the way e.g. dt KB does) KB here I get the following R library(sn) Loading required package: mvtnorm Library 'sn', version 0.3-5 (2005-12-30) , © 1998-2005 A.Azzalini type 'help(SN)' for summary information R args(dmst) function (x, xi = rep(0, d), Omega, alpha, df = Inf, log = FALSE) NULL R notice that 0.3-5 is the current version on CRAN KB KB KB (You have told us so little about what you are doing that we can KB but guess at what you mean by `write an mle procedure': what is KB wrong with st.mle, for example?) KB KB KB st.mle assumes skewed-t marginals (for a whole distribution), KB whereas I am working with a copula so my margins are uniform. The KB whole point is separating the joint and marginal dynamics. KB I am not a copula expert, but what Brian Ripley suggests makes sense to me; and I know of people that have used st.mle to obtain the marginal components (which is what is needed for the copula mechanism) -- Adelchi Azzalini [EMAIL PROTECTED] Dipart.Scienze Statistiche, Università di Padova, Italia tel. +39 049 8274147, http://azzalini.stat.unipd.it/ __ 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] Remove [1] ... from output
On 3/28/2006 6:21 AM, Gregor Gorjanc wrote: Hello! I am writing some numbers and character vectors to an ascii file and would like to get rid of [1] ... as shown bellow (a dummy example) R runif(20) [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252 0.506480 0.547759 [9] 0.912421 0.584382 0.987208 0.996846 0.666760 0.053637 0.327590 0.370737 [17] 0.505706 0.412316 0.887421 0.812151 I have managed to work up to remove quotes and all [*] except [1] as shown bellow. R print(paste(runif(20), collapse = ), quote = FALSE) [1] 0.790620362851769 0.45603066496551 0.563822037540376 0.812907998682931 0.726162418723106 0.37031230609864 0.681147597497329 0.29929908295162 0.209858040558174 0.304300333140418 0.105796672869474 0.743657597573474 0.409294542623684 0.825012607965618 0.282235795632005 0.21159387845546 0.620056127430871 0.337449935730547 0.754527133889496 0.280175548279658 Any hints how to solve my task? Use cat() instead of print: cat(runif(20)) 0.7488857 0.7319368 0.2803859 0.3738669 0.5619917 0.3179777 0.2414058 0.7494183 0.7967387 0.9084999 0.5811184 0.1158764 0.1048582 0.8314966 0.2892489 0.1403012 0.6296523 0.3318759 0.8797555 0.8332503 There are optional parameters to cat() to insert line breaks (sep=\n), etc. 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] Remove [1] ... from output
On Tue, 28 Mar 2006 13:21:59 +0200, Gregor Gorjanc wrote: GG Hello! GG GG I am writing some numbers and character vectors to an ascii file GG and would like to get rid of [1] ... as shown bellow (a dummy GG example) GG GG R runif(20) GG [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252 GG 0.506480 0.547759 [9] 0.912421 0.584382 0.987208 0.996846 GG 0.666760 0.053637 0.327590 0.370737 GG [17] 0.505706 0.412316 0.887421 0.812151 GG GG I have managed to work up to remove quotes and all [*] except [1] GG as shown bellow. GG GG R print(paste(runif(20), collapse = ), quote = FALSE) GG [1] 0.790620362851769 0.45603066496551 0.563822037540376 GG 0.812907998682931 0.726162418723106 0.37031230609864 GG 0.681147597497329 0.29929908295162 0.209858040558174 GG 0.304300333140418 0.105796672869474 0.743657597573474 GG 0.409294542623684 0.825012607965618 0.282235795632005 GG 0.21159387845546 0.620056127430871 0.337449935730547 GG 0.754527133889496 0.280175548279658 GG GG Any hints how to solve my task? GG what about cat(format(runif(20))) ? you can improve it a bit with cat(format(runif(20)),\n) -- Adelchi Azzalini [EMAIL PROTECTED] Dipart.Scienze Statistiche, Università di Padova, Italia tel. +39 049 8274147, http://azzalini.stat.unipd.it/ __ 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] SuperParamagnetic Clustering
Hi, I would like to know if the SuperParamagnetic Clustering method (Blatt M., Domany E., Wiseman S.: Data Clustering using a model granular magnet. Neural Computation 9 (1997)) is available in R. If yes,what is the package which would contain this program ? Thanking you in anticipation, Jeanne Vallet [[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] Remove [1] ... from output
[Gregor Gorjanc] I am writing some numbers and character vectors to an ascii file and would like to get rid of [1] ... as shown bellow (a dummy example) R runif(20) [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252 0.506480 0.547759 [9] 0.912421 0.584382 0.987208 0.996846 0.666760 0.053637 0.327590 0.370737 [17] 0.505706 0.412316 0.887421 0.812151 I have managed to work up to remove quotes and all [*] except [1] as shown bellow. R print(paste(runif(20), collapse = ), quote = FALSE) [1] 0.790620362851769 0.45603066496551 0.563822037540376 0.812907998682931 0.726162418723106 0.37031230609864 0.681147597497329 0.29929908295162 0.209858040558174 0.304300333140418 0.105796672869474 0.743657597573474 0.409294542623684 0.825012607965618 0.282235795632005 0.21159387845546 0.620056127430871 0.337449935730547 0.754527133889496 0.280175548279658 Any hints how to solve my task? You may use cat instead of print. No need to paste then. -- François Pinard http://pinard.progiciels-bpi.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] atan2(1,1i)
Hi ?atan2 says that atan2(y,x)=atan(y/x) for x and y numeric or complex vectors. Well, I would expect atan2(1,1i) to be equal to atan(-1i), but atan2(1,1i) Error in atan2(y, x) : Non-numeric argument to mathematical function R.version _ platform powerpc-apple-darwin8.5.0 arch powerpc os darwin8.5.0 system powerpc, darwin8.5.0 status alpha major 2 minor 3.0 year 2006 month 03 day27 svn rev37590 language R version.string Version 2.3.0 alpha (2006-03-27 r37590) -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ 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] fixed effects
thanks, but darn: I only own your modern applied statistics text. I will buy the S programming book. is there a new edition coming soon, or should I go with the existing text? regards, /iaw On 3/28/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: There is a very similar example worked through in section 7.2 of `S Programming'. __ 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] Remove [1] ... from output
Use cat cat(runif(20)) see ?cat for additional options, for example to brake the output into several lines. Best regards, Ales Gregor Gorjanc pravi: Hello! I am writing some numbers and character vectors to an ascii file and would like to get rid of [1] ... as shown bellow (a dummy example) R runif(20) [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252 0.506480 0.547759 [9] 0.912421 0.584382 0.987208 0.996846 0.666760 0.053637 0.327590 0.370737 [17] 0.505706 0.412316 0.887421 0.812151 I have managed to work up to remove quotes and all [*] except [1] as shown bellow. R print(paste(runif(20), collapse = ), quote = FALSE) [1] 0.790620362851769 0.45603066496551 0.563822037540376 0.812907998682931 0.726162418723106 0.37031230609864 0.681147597497329 0.29929908295162 0.209858040558174 0.304300333140418 0.105796672869474 0.743657597573474 0.409294542623684 0.825012607965618 0.282235795632005 0.21159387845546 0.620056127430871 0.337449935730547 0.754527133889496 0.280175548279658 Any hints how to solve my task? __ 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] Remove [1] ... from output
On Tue, Mar 28, 2006 at 01:21:59PM +0200, Gregor Gorjanc wrote: R runif(20) [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252 0.506480 0.547759 [9] 0.912421 0.584382 0.987208 0.996846 0.666760 0.053637 0.327590 0.370737 [17] 0.505706 0.412316 0.887421 0.812151 Any hints how to solve my task? The indexes are generated by the print method for the vector. Use cat instead: cat(runif(20)) 0.01053970 0.7196873 0.08709377 0.2059949 0.9583586 0.7059125 0.8179168 0.2345666 0.4157858 0.0538792 0.4140722 0.5700817 0.7087922 0.4012365 0.6587029 0.2803821 0.7353465 0.4457628 0.09914006 0.8109087 cu Philipp -- Dr. Philipp PagelTel. +49-8161-71 2131 Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186 Technical University of Munich Science Center Weihenstephan 85350 Freising, Germany and Institute for Bioinformatics / MIPS Tel. +49-89-3187 3675 GSF - National Research Center Fax. +49-89-3187 3585 for Environment and Health Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel __ 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] fixed effects
On Tue, 28 Mar 2006, ivo welch wrote: thanks, but darn: I only own your modern applied statistics text. I will buy the S programming book. is there a new edition coming soon, or should I go with the existing text? Not soon. We are working on it, but it is at least a year away. regards, /iaw On 3/28/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: There is a very similar example worked through in section 7.2 of `S Programming'. -- 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] How to generate a list of lists recursively (for bayesm)
Hi Moritz, you need to initialize your lists somehow, before you can use them (hence the error) like: regdata1 - regdata2 - list() [some for loops] I believe it might be cleaner to use c() to concat the lists, as your code seems to add lists at the end, than to assign to list elements which do not actually exist. Cheers Am Tuesday 28 March 2006 14:39 schrieb [EMAIL PROTECTED]: thanx for the reply. Sk is a 1067*300 matrix att is a 300*15 matrix attq8 is a 300*17 matrix regdata1 and regdata2 are meant to become my 2 lists of lists by this procedure - I actually do not know if they should be initialized in any other way as lists of lists and how to do this. __ 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] wavelet basis
Dear R-list, I have difficulties to extract the wavelet basis (which I want to integrate). After performing discrete wavelet transform using certain filter, we have the lists of scaling and wavelet coefficients. Is there a simple way to reconstruct the whole basis (or basis vectors per level)? Cheers! __ 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 remove the outer rectangle in 3D plot/surface.
Hello, I plot a 3D plot/surface using cloud function in lattice package. Several days ago, I post a question about how to remove the framebox out the 3D plot/surface. However, I think I don't make me understood clearly. I just hope to romove the outer rectangle or box around the box. Thanks again. Regards, Jinsong Zhao __ 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] addition using binary
Looks as if you are dealing with bond prices (or futures, which are quoted in 32nds), and someone has been creative with the way they store them. I would convert them all to doubles (represented exactly in the computer) and just add directly. x - floor(p) + (p-floor(p))*100/32 . Finally, if you need to convert back, p - floor(x) + (x-floor(x))*32/100 . In general, I have found storing prices as rationals very useful in most contexts, although as noted above, in many circumstances, doubles are exact. David L. Reiner Rho Trading Securities, LLC Chicago IL 60605 312-362-4963 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fred J. Sent: Sunday, March 26, 2006 1:52 PM To: r-help@stat.math.ethz.ch Subject: [R] addition using binary Dear R users I looked around for a package which can help me with the task of binary arithmetic, the closest I found is sfsmisc with digitsBase function, which may help a little in this task, but still wondering how to get this problem solved. example: given the addition operation of 2 real numbers to equal as below 99.30 2.11 === 102.09 --- desired output as explained below the decimal point is for ease or reading and does carry the usual meaning. the numbers t0 the right of the decimal point are added 30 11 === 41 divided by 32 equal 1 with a reminder of 9 the numbers to the left of the decimal point are added 99 2 === 101 1 which is carried from above === 102 put together 102.09, again the decimal point doesn't carry the usual meaning but only for ease of reading. the same principle above is needed to alse apply for other operations like subtraction, thank you - [[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] atan2(1,1i)
Try this: atan2(1+0i,1i) [1] NaN-Infi Ravi. -Original Message- From: [EMAIL PROTECTED] [mailto:r-help- [EMAIL PROTECTED] On Behalf Of Robin Hankin Sent: Tuesday, March 28, 2006 9:13 AM To: RHelp Subject: [R] atan2(1,1i) Hi ?atan2 says that atan2(y,x)=atan(y/x) for x and y numeric or complex vectors. Well, I would expect atan2(1,1i) to be equal to atan(-1i), but atan2(1,1i) Error in atan2(y, x) : Non-numeric argument to mathematical function R.version _ platform powerpc-apple-darwin8.5.0 arch powerpc os darwin8.5.0 system powerpc, darwin8.5.0 status alpha major 2 minor 3.0 year 2006 month 03 day27 svn rev37590 language R version.string Version 2.3.0 alpha (2006-03-27 r37590) -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ 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] variables as arguments in formulae in aov?
Hi all, I wonder if you could help me with (what is surely) a simple R question? I've written a simple R script (attached) to perform multiple ANOVAs on the columns in a table loaded in from a a file (also attached). I loop through the list of columns for which I want to perform the ANOVAs, storing the column name in a variable. When I try to perform the ANOVA using the variable name as a reference to the column name R complains as follows: Error in the model.frame(formula, rownames, variables, varnames, extras, extranames, : invalid variable type The line causing the problem is the first line inside the for loop. The question is what have I done wrong? Is there a better way of doing the ANOVAs? Thanks in advance, Bye, Colm. roi.errs=read.table(../Group.results/allGroupsROI.errs, header=T, sep=\t); roi.stops=read.table(../Group.results/allGroupsROI.stops, header=T, sep=\t); # extract the names of the columns containing the means roi.names=names(roi.errs); meanColumns=roi.names[4:length(roi.names)]; ## open the output file, split=T also spits it to the screen sink(../Group.results/ROI.errs.txt,split=T) cat(\n); cat(*** Summary for ROI.errs\n); for (meanCol in meanColumns) { roi.err.aov-aov(meanCol ~ Group, data=roi.errs); cat(\n); cat(*** Summary of AOV for , meanCol, \n); summary(roi.err.aov); } ## close the output file sink(); ## open the output file, split=T also spits it to the screen sink(../Group.results/ROI.stops.txt,split=T) cat(\n); cat(*** Summary for ROI.stops\n); for (meanCol in meanColumns) { roi.stops.aov-aov(meanCol ~ Group, data=roi.stops); cat(\n); cat(*** Summary of AOV for , meanCol, \n); summary(roi.stops.aov); } ## close the output file sink(); __ 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] as.matrix and one row
Hi All, I have the following problem: x = c(1,2) x [1] 1 2 as.matrix(x) [,1] [1,]1 [2,]2 BUT, if I add: y = c(3,4) as.matrix(rbind(x,y)) [,1] [,2] x12 y34 It does not transpose. Since I will need as.matrix() for a list of data that is in one or more lines, I need as.matrix to behave in a consisten fashions, so I get as.matrix(x, whatever) [,1] [,2] x12 and as.matrix(rbind(x,y), whatever) [,1] [,2] x12 y34 I tried byrow =T, does not make a thing. Regards, Federico Calboli -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ 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] Cross correlation in time series
Could you please clarify your data: Do you have CO2 levels in an ecosystem over time, from which you have computed (a) time rate of change in CO2 and (b) deviation of CO2 levels from some theoretical balance? If yes, is this balance constant or varying, and if varying, are the variations driven by factors not otherwise obviously contained in the CO2 levels themselves? I ask, because it sounds to me like you may only actually have two different transformations of one series, and the analysis would be different between the two. Also, are your observations all at regular intervals? If yes, what percent of the observations are missing? If you have two series, not just one, are they sampled at the same times or at different times? Regarding ccf, this computes and plots the correlation between X[t] and Y[t-j] for different values of j. For a brief introduction to time series analysis especially in R, I recommend the following: 1. Ch. 14 in Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. (Springer) 2. The vignettes dse1, dse2, and zoo available with those packages. hope this helps, spencer graves Hufkens Koen wrote: Hi list, I'm working on time series of (bio)physical data explaining (or not) the net ecosystem exchange of a system (+_ CO2 in versus CO2 out balance). I decomposed the time series of the various explaining variable according to scale (wavelet decomposition). With the coefficients I got from the wavelet decomposition I applied a (multiple) regression, giving some expected results. The net ecosystem exchange (CO2 balance) is mostly determined by the light regime (driving photosynthesis) and the water availability (inducing stress if absent), and this over all the scales. So sadly, pinpointing a certain scale on a certain process wasn't possible. I had hoped to see for example a relation between air temperature and a response of the vegetation/ecosystem, and this for a certain scale. Global trends are present but short term responses are not present. Using regressions in this previous analysis I thought that considering that some processes do show some lag if it comes to showing a response on a changing variable a one on one regression of time series might have been the wrong approach because this states that there is also an almost direct one in one relation between action and reaction. So what I'm looking for is a method to determine that after let's say 5 warm days, the net ecosystem exchange peaks as well. Any suggestions on how to determine a certain, lag between time series. I found a post in the archives discussing convolve() but this doesn't seem the right thing. Also ccf() is mentioned, does this calculate a correlation coefficient as two time series are shifted past eachother for certain lag distances or am I mistaken? If so, what is the implication of using a smaller and smaller sampling window (increasing your time resolution say going from year level to month to day level)? Any input on how to compare two time series would be appreciated... Sorry for the rather theoretical/technical post. Best regards, Koen Hufkens __ 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] error message
Yes, the author of the message does :) Your fit is exactly collinear. From ?predict.lm If the fit is rank-deficient, some of the columns of the design matrix will have been dropped. Prediction from such a fit only makes sense if 'newdata' is contained in the same subspace as the original data. That cannot be checked accurately, so a warning is issued. (in fact predict.lm is being called here.) On Tue, 28 Mar 2006, stephenc wrote: Hi Does anyone know what this means: glm.model = glm(formula = as.factor(nextDay) ~ ., family=binomial, data=spi[1:1000,]) pred - predict(glm.model, spi[1001:1250,-9], type=response) Warning message: prediction from a rank-deficient fit may be misleading in: predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type == 9 is my determinant and I still get this message even when I remove the 9. Stephen [[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 -- 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] Regarding aov Error()
Here P is already nested in Q, so s:P suffices. You are getting the warning because most of the cells of s:P:Q are empty. On Tue, 14 Mar 2006, John Vokey wrote: The following dummy data frame has factor Q (with 2 levels) nesting factor P (with levels p1 and p2 nested under q1, and p3 and p4 nested under q2), but both crossing the random variate s, which has 8 levels. The dependent measure is dv. # The data frame: testnest dv s P Q 1 1 s1 p1 q1 2 2 s2 p1 q1 3 1 s3 p1 q1 4 2 s4 p1 q1 5 1 s5 p1 q1 6 3 s6 p1 q1 7 3 s7 p1 q1 8 4 s8 p1 q1 9 2 s1 p2 q1 10 3 s2 p2 q1 11 3 s3 p2 q1 12 1 s4 p2 q1 13 1 s5 p2 q1 14 2 s6 p2 q1 15 2 s7 p2 q1 16 3 s8 p2 q1 17 3 s1 p3 q2 18 3 s2 p3 q2 19 4 s3 p3 q2 20 1 s4 p3 q2 21 1 s5 p3 q2 22 1 s6 p3 q2 23 2 s7 p3 q2 24 2 s8 p3 q2 25 4 s1 p4 q2 26 3 s2 p4 q2 27 1 s3 p4 q2 28 2 s4 p4 q2 29 4 s5 p4 q2 30 1 s6 p4 q2 31 3 s7 p4 q2 32 1 s8 p4 q2 # The following aov() call is structurally correct with respect # to the design, and appropriate error-terms, but, as can be seen, # returns an error: testnest.aov=aov(dv~Q+P%in%Q+Error(s+s:Q+s:P:Q),data=testnest) Warning message: Error() model is singular in: aov(dv ~ Q + P %in% Q + Error(s + s:Q + s:P:Q), data = testnest) # However, applying the summary() method to the aov output, produces the correct analysis: summary(testnest.aov) Error: s Df Sum Sq Mean Sq F value Pr(F) Residuals 7 5.8750 0.8393 Error: s:Q Df Sum Sq Mean Sq F value Pr(F) Q 1 0.1250 0.1250 0.068 0.8018 Residuals 7 12.8750 1.8393 Error: s:Q:P Df Sum Sq Mean Sq F value Pr(F) Q:P2 0.250 0.125 0. 0.8956 Residuals 14 15.750 1.125 I have tried many different ways of denoting the Error() partitioning, but can't find one that produces both the correct analysis *AND* no singularity error on the aov() call. Any suggestions? -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -Dr. John R. Vokey __ 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 -- 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] cat(), Rgui, and support for carriage return \r...
Rgui now supports \r in the same way as rterm. On Sun, 19 Mar 2006, Duncan Murdoch wrote: On 3/18/2006 2:39 PM, Duncan Murdoch wrote: On 3/17/2006 9:44 AM, Jeffrey Racine wrote: Hi, and thanks in advance for your time. Background - I am working on a package and wish to have a routine's progress reported. The routine can take some time, and I would like to inform the user about the routine's progress. I have scoured the archives but to no avail, so would like to solicit input from this list. I am successfully using cat(\rBootstrap replication , i, of , boot.num,) flush.console() # To flush stdout on windows systems which works as expected on *NIX systems and using Rterm under windows. However, under Rgui the carriage return \r is ignored, and I certainly don't want to use the newline escape sequence \n. Under Rgui it appears as Bootstrap replication 1 of 399Bootstrap replication 2 of 399Bootstrap... but I want it to function properly if at all possible. My question is simply whether there is a portable way to implement this so that it works regardless of the R platform the user may be working on? Many thanks for any/all suggestions. I've just been looking at the source code for this. I think it will be relatively easy to make \r in Rgui do a destructive CR (i.e. it will return to the start of the line, but clear any existing characters). I'll play around a bit and then do that for R-devel. Oops, this was a bad idea. I did commit the change for a while, but have reverted it now. It seems that the help system displays help pages by writing CR LF at the end of each line; the CR is \r, and my change above caused it to wipe out the line it had just written. The help pages ended up completely blank. I may look into supporting \r as a non-destructive CR, but that's harder, because it means low-level changes to the console display. Right now it only writes to the end of the text buffer; this would mean it would sometimes write to a spot before the end. I don't think it would be impossible to do, but it will take more time than I have right now. 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 -- 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] variables as arguments in formulae in aov?
Try something like this: for(i in 1:4) print(summary(lm(iris[,i] ~., iris[,-i]))) for(i in 1:4) print(lm(y ~ Species, data.frame(y = iris[,i], Species = iris[,5]))) On 3/28/06, Colm Connolly [EMAIL PROTECTED] wrote: Hi all, I wonder if you could help me with (what is surely) a simple R question? I've written a simple R script (attached) to perform multiple ANOVAs on the columns in a table loaded in from a a file (also attached). I loop through the list of columns for which I want to perform the ANOVAs, storing the column name in a variable. When I try to perform the ANOVA using the variable name as a reference to the column name R complains as follows: Error in the model.frame(formula, rownames, variables, varnames, extras, extranames, : invalid variable type The line causing the problem is the first line inside the for loop. The question is what have I done wrong? Is there a better way of doing the ANOVAs? Thanks in advance, Bye, Colm. __ 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 crashes during 'eigen'
Hi all, Hi, When I want to compute the eigenvalues eigenvectors of a specific matrix, R crashes (i.e. it stops responding to any input). I've tried it with different versions of R (2.1.1, 2.2.0, 2.2.1) - all with crashing as result. What I did before the crash was: M - as.matrix(read.table(thematrix,header=T)) eigen(M) If, instead of eigen(M), I use eigen(M, EISPACK=T), R doesn't crash. So, I know a workaround my problem, but still don't understand why R crashes. Could anyone explain this? In case someone wants to download my matrix to see where it goes wrong, it can be downloaded from http://mcs.open.ac.uk/cja235/thematrix (warning: obviously, R might crash so save your unsaved work first). thanks, Casper Albers [[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] Removing columns from a matrix using a list
How does one remove columns either by name (Exp1, Exp2, Exp3, ... Exp100) or by column number from a matrix or data.frame using a list of names mynames = (Exp10,Exp20,Exp55,Exp67) I would something in the form of (I know this does not work): myMatrixEdited = myMatrix[,-mynames] Or I would like to find the column numbers of the names in the list, and use the column numbers to remove the columns in the matrix or data.frame. Peter W. __ 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] as.matrix and one row
Federico Calboli wrote: Hi All, I have the following problem: x = c(1,2) x [1] 1 2 as.matrix(x) [,1] [1,]1 [2,]2 BUT, if I add: y = c(3,4) as.matrix(rbind(x,y)) [,1] [,2] x12 y34 It does not transpose. Since I will need as.matrix() for a list of data that is in one or more lines, I need as.matrix to behave in a consisten fashions, so I get as.matrix(x, whatever) [,1] [,2] x12 and as.matrix(rbind(x,y), whatever) [,1] [,2] x12 y34 I tried byrow =T, does not make a thing. as long as you do not tell R the dimensions. Hence matrix(x, byrow = TRUE, ncol = 2, .) should do the trick. Uwe Ligges Regards, Federico Calboli __ 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] Trouble with compiling or dyn.load-ing C code
I am trying to compile a C function and make a dll using MinGW. I installed MinGW, Perl, the Murdoch-Sutherland tool collection, and then I proceed as in R for Windows FAQ Section 8. Here is my C function: -- /* C function adding two vectors (5-26-05) */ #includestdlib.h EXPORT void addvectors(double *a, double *b, int *n, double *sum) { int i; for (i = 0; i *n; i++) { sum[i] = a[i] + b[i]; } } -- Here is my command to make the dll and the output: -- z:/Stat534/Spring06/Website/Link-C-R $ c:/Progra~1/R/R-2.2.1/bin/R CMD SHLIB add-vectors.C making add-vectors.d from add-vectors.C g++ -Ic:/Progra~1/R/R-2.2.1/include -Wall -O2 -c add-vectors.C -o add-vectors.o ar cr add-vectors.a add-vectors.o ranlib add-vectors.a g++ --shared -s -o add-vectors.dll add-vectors.def add-vectors.a -Lc:/Progra~1/R/R-2.2.1/src/gnuwin32 -lg2c -lR -- I get add-vectors.dll. Here is the R code to load the dll and add two vectors: -- dll.filename - z:\\Stat534\\Spring06\\Website\\Link-C-R\\add-vectors.dll dyn.load(dll.filename) ## If the DLL needs to be re-built, it has to be unloaded first. ## dyn.unload(dll.filename) addvectors - function(a, b) { the.sum - rep(0, length(a)) res - .C(addvectors, as.double(a), as.double(b), as.integer(length(a)), as.double(the.sum)) return(res[[4]]) } a - c(1,2,3) b - c(4,5,6) addvectors(a, b) -- Here is what I get when I use addvectors: -- addvectors(a, b) Error in .C(addvectors, as.double(a), as.double(b), as.integer(length(a)), : C entry point addvectors not in load table -- What am I doing wrong? Thanks a lot, W -- Werner Stuetzle (206) 685-7431 (w) Professor, Statistics (206) 685-7419 (fax) Adjunct Professor, CSE[EMAIL PROTECTED] Director, ACMSwww.stat.washington.edu/wxs Department of Statistics, Box 354322 Office: Padelford B305 University of Washington Seattle, WA 98195-4322 __ 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] How to remove the outer rectangle in 3D plot/surface.
On 3/28/06, Jinsong Zhao [EMAIL PROTECTED] wrote: Hello, I plot a 3D plot/surface using cloud function in lattice package. Several days ago, I post a question about how to remove the framebox out the 3D plot/surface. However, I think I don't make me understood clearly. I just hope to romove the outer rectangle or box around the box. ?cloud has an example. Deepayan __ 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] Removing columns from a matrix using a list
Here are three ways: subset(iris, select = -c(Sepal.Length, Species)) nm - c(Sepal.Length, Species) iris[,!names(iris) %in% nm] nm - c(Sepal.Length, Species) iris[,setdiff(names(iris), nm)] On 3/28/06, Peter Wilkinson [EMAIL PROTECTED] wrote: How does one remove columns either by name (Exp1, Exp2, Exp3, ... Exp100) or by column number from a matrix or data.frame using a list of names mynames = (Exp10,Exp20,Exp55,Exp67) I would something in the form of (I know this does not work): myMatrixEdited = myMatrix[,-mynames] Or I would like to find the column numbers of the names in the list, and use the column numbers to remove the columns in the matrix or data.frame. Peter W. __ 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] as.matrix and one row
Federico Calboli [EMAIL PROTECTED] writes: Hi All, I have the following problem: x = c(1,2) x [1] 1 2 as.matrix(x) [,1] [1,]1 [2,]2 BUT, if I add: y = c(3,4) as.matrix(rbind(x,y)) [,1] [,2] x12 y34 It does not transpose. Since I will need as.matrix() for a list of data that is in one or more lines, I need as.matrix to behave in a consisten fashions, so I get Well, it's a NOP since the argument is a matrix already. R is not transposing in the first case either, since the argument is not a matrix. However, the convention is that vectors are treated as column vectors, even though they print horisontally. rbind(x) should get you to where you want soon enough. as.matrix(x, whatever) [,1] [,2] x12 and as.matrix(rbind(x,y), whatever) [,1] [,2] x12 y34 I tried byrow =T, does not make a thing. Regards, Federico Calboli -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ 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 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- 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] Removing columns from a matrix using a list
Peter Wilkinson wrote: How does one remove columns either by name (Exp1, Exp2, Exp3, ... Exp100) or by column number from a matrix or data.frame using a list of names mynames = (Exp10,Exp20,Exp55,Exp67) I would something in the form of (I know this does not work): myMatrixEdited = myMatrix[,-mynames] myMatrixEdited - myMatrix[ , !(colnames(myMatrix) %in% mynames)] Uwe Ligges Or I would like to find the column numbers of the names in the list, and use the column numbers to remove the columns in the matrix or data.frame. Peter W. __ 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] ansari.test (one tailed)
Hello. I am probably wrong... I am wondering if it could have a mistake in the code of the ansari.test function. For me, it seems that the function do not recover the p value at the correct side of the normal law N(0, 1) when it use the normal approximation (presence of ties) in a one tailed test. Exemple : quanti-c(197, 205, 228, 234, 237, 195, 233, 226, 244, 227, 259, 185, 198, 253, 207, 250, 215, 239, 261, 247, 215, 241, 223, 247, 231, 221, 272, 215, 222, 205, 256, 253, 237, 262, 266, 243, 242, 236) quali-as.factor(c(sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, sud, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest, ouest)) obs2-data.frame(quanti,quali) obs2 xr-sort(obs2[,1]) ci-obs2[,2] cr-ci[order(obs2[,1])] n-length(obs2[,1]) if(n%%2==0) {rAB-c(1:(n/2),(n/2):1)} else{rAB-c(1:((n-1)/2), (n+1)/2, ((n-1)/2):1)} obs3-data.frame(rAB,xr,cr) ties-as.numeric(names(which((table(obs2[,1])1)==TRUE))) # extrait les xi répétés obs4-obs3 for(i in ties){obs4$rAB[(which(obs3$xr==i))]-mean(obs3$rAB[(which(obs3$xr==i))])} obs4 classe1- split(obs2[,1], obs2[,2])$sud classe2- split(obs2[,1], obs2[,2])$ouest ansari.test(classe1, classe2, alternative = greater) # AB statistic : AB1.calc-sum(subset(obs4[,1],obs4[,3]==sud)) AB1.calc # Z statistic : n1-length(classe1) n2-length(classe2) n-n1+n2 n # n is even mAB1-n1*(n+2)/4 tj- table(obs4$xr) rABj- obs4$rAB[c(which(diff(obs4$xr)!=0),n)] s2.AB-(n1*n2*(16*sum(tj*rABj^2)-n*(n+2)^2))/(16*n*(n-1)) Z.calc-(AB1.calc-mAB1)/ (s2.AB)^0.5 Z.calc # p value : pnorm(Z.calc, lower.tail = FALSE) pnorm(Z.calc) Z is negative. So at the right of the normal law, the p value should be over 0.5 but the ansari.test function gives a p-value = 0.3737 . I used the same formule for Z as in the code. But what I can see, is it may have a mistake in this part of the code : p - pnorm(normalize(STATISTIC, r, TIES)) PVAL - switch(alternative, two.sided = 2 * min(p, 1 - p), less = 1 - p, greater = p) pnorm() is written without lowertail = FALSE. So it should be : less = p greater = 1-p Am I wrong ??? Thanks very much for your help. Gael. Gael Millot UMR 7147 et Universite Paris 6 Equipe Recombinaison et instabilite genetique Pav Trouillet Rossignol 5eme etage Institut Curie 26 rue d'Ulm 75248 Paris Cedex 05 tel : 01 42 34 66 34 fax : 01 42 34 66 44 Email : [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] R compiler for .Net CLR
Jim- You have been very helpful in doing this so far (especially for free!). Understand that I have been away until today. I will work on getting you a better picture of how much time is spent doing each step, but I suspect that our numbers are about the same. It takes you ~ 4 seconds to create 17 graphs...I am creating around 75 graphs, and in addition, i am saving them to the hard drive, so the estimate of around 18 to 19 seconds for that portion seems about right, and perhaps there isn't any way to speed that aspect up significantly. As for the other 10 seconds, you may be right on the money again regarding data transfer and type conversion. I have already tried to optimize my SQL queries to speed this part up, and it makes a difference, but obviously not to the extent I am hoping for. To address your final suggestion: In the big picture, I am looking to have an application which can take raw data from a SQL database server, analyze it with set algorithms, place the results of those algorithms back in the database, AND use the same raw data to create graphs which are saved on a hard drive. Ideally, this whole process should take under 10 seconds. Thanks for your time. leo P.S. I am using only one instance of R - that actually sped up the process quite a bit :-0 On 3/24/06, jim holtman [EMAIL PROTECTED] wrote: R may be 'interpreted', but the base functions are written in C++/FORTRAN. If you are doing a lot of matrix operations (selection, computing, etc.) you are not going to run any faster since you are already using optimized code. There are routine for profiling R. Do you know where in your code you are spending most of the time? Here is an example of some output from my script that reads in some data and then generates about 16 plots. This is done by putting some 'print' statements in the code to output the amount of CPU, elapsed time and memory that is being used; I have put some comments to show what the progress is. From this I know which portion of my program needs to be optimized: source('C:/Perf/bin/Trace CPU by PID (POSIX).r') Read 720726 records read - my.stats : 8.1 8.2 33.54 2.43 664.04 : 108.2 MB # this has read in 720,726 lines of data with 9 columns of # data and it took 8.1 seconds of CPU time (first number in the ) # the CPU time and elapsed (second number in ) are cumulative from the start) # this is mostly the conversion of character data to reals/integers. # you probably are not going to get faster unless you data is already in binary. time conversion - my.stats : 8.6 8.6 34.01 2.43 664.51 : 110.1 MB # this 0.5 seconds was the conversion of 720,726 character strings to factors for # faster processing in later parts of the program badTimes - my.stats : 12.4 12.5 37.81 2.48 668.39 : 143.5 MB # this is converting the character string mm/dd/yy hh:mm:ss from character to # binary. This took an addition 3.8 CPU seconds (12.4 - 8.6). For 720,726 character # strings, I would say this is pretty fast. Compiled code is probably not going to # be a lot faster. done; make approx functions - my.stats : 13.5 13.6 38.84 2.51 669.45 : 112.2 MB # another 1.1 CPU seconds to make five passes through 720,726 data point, # cleaning up some more data start plots - my.stats : 16.8 17.1 42.1 2.53 672.93 : 116.4 MB # the time to here was another 3.1 CPU seconds to partition the data by 'command', # (this is computer performance data) into 159 groups, sum up the CPU time that the # command in each group used. Again I would guess compiled code would not be much faster plot commands - my.stats : 17.4 17.8 42.79 2.53 673.64 : 117.6 MB # it took 0.6 seconds to generate a graph that created an 'area' plot of the top # 20 commands and all the rest grouped in 'other' indiv commands - my.stats : 21.1 21.5 46.4 2.56 677.35 : 100.1 MB # took another 3.7 CPU seconds to create individual plots for the top 15 commands as # area graphs broken down by PID. done Trace - my.stats : 23.8 24.3 49.15 2.57 680.18 : 124.9 MB # so we used 23.8 CPU seconds in 24.3 seconds of elapsed time So once you get something like this, you can see where the time is being spent. Also how many data points are we talking about? I would guess that a lot of your time may be in the interface with the data base. So can you provide some details like this to help us understand where you problem is? For my scripts, I would guess I would not get that much better performance out of compiled code since I am probably spending most of my time in the 'base' (compiled) functions in R. The time is due to the amount of data I have to process. What is the size of the data that you are processing? It is details like this that may help you reduce the time. You also have a startup of 1-2 seconds of R itself. Can you just keep a copy of R running that you send scripts to? So I will ask you one of my favorite comments that I
Re: [R] Trouble with compiling or dyn.load-ing C code
Werner, Extension .C is for C++ code, not C code. Please use the extension .c. The problem is C++ name mangling. Brian On Tue, 28 Mar 2006, Werner Stuetzle wrote: I am trying to compile a C function and make a dll using MinGW. I installed MinGW, Perl, the Murdoch-Sutherland tool collection, and then I proceed as in R for Windows FAQ Section 8. Here is my C function: -- /* C function adding two vectors (5-26-05) */ #includestdlib.h EXPORT void addvectors(double *a, double *b, int *n, double *sum) { int i; for (i = 0; i *n; i++) { sum[i] = a[i] + b[i]; } } -- Here is my command to make the dll and the output: -- z:/Stat534/Spring06/Website/Link-C-R $ c:/Progra~1/R/R-2.2.1/bin/R CMD SHLIB add-vectors.C making add-vectors.d from add-vectors.C g++ -Ic:/Progra~1/R/R-2.2.1/include -Wall -O2 -c add-vectors.C -o add-vectors.o ar cr add-vectors.a add-vectors.o ranlib add-vectors.a g++ --shared -s -o add-vectors.dll add-vectors.def add-vectors.a -Lc:/Progra~1/R/R-2.2.1/src/gnuwin32 -lg2c -lR -- I get add-vectors.dll. Here is the R code to load the dll and add two vectors: -- dll.filename - z:\\Stat534\\Spring06\\Website\\Link-C-R\\add-vectors.dll dyn.load(dll.filename) ## If the DLL needs to be re-built, it has to be unloaded first. ## dyn.unload(dll.filename) addvectors - function(a, b) { the.sum - rep(0, length(a)) res - .C(addvectors, as.double(a), as.double(b), as.integer(length(a)), as.double(the.sum)) return(res[[4]]) } a - c(1,2,3) b - c(4,5,6) addvectors(a, b) -- Here is what I get when I use addvectors: -- addvectors(a, b) Error in .C(addvectors, as.double(a), as.double(b), as.integer(length(a)), : C entry point addvectors not in load table -- What am I doing wrong? Thanks a lot, W -- Werner Stuetzle (206) 685-7431 (w) Professor, Statistics (206) 685-7419 (fax) Adjunct Professor, CSE[EMAIL PROTECTED] Director, ACMSwww.stat.washington.edu/wxs Department of Statistics, Box 354322 Office: Padelford B305 University of Washington Seattle, WA 98195-4322 __ 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 -- 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] R crashes during 'eigen'
It looks like there might be a bug in the symmetry detection routine of eigen. When I do eigen(M, symmetric=FALSE) it works fine. Eigenvalues (after omitting their imaginary parts, which are essentially zeros) are the same as the ones obtained with EISPACK to within a small multiple of machine epsilon. However, the eigenvector matrices seem different ! This happens on R-2.2.1-patched and R-2.3.0 (both compiled from daily snapshots). Andy PS. My system is Windows 2000 on a Xeon CPU. I use precompiled Pentium 4 Rblas DLL from CRAN, but the same thing happens with standard Rblas. __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 C.J.Albers [EMAIL PROTECTED] ac.uk To Sent by: r-help@stat.math.ethz.ch [EMAIL PROTECTED] cc at.math.ethz.ch Subject [R] R crashes during 'eigen' 03/28/2006 10:01 AM Hi all, Hi, When I want to compute the eigenvalues eigenvectors of a specific matrix, R crashes (i.e. it stops responding to any input). I've tried it with different versions of R (2.1.1, 2.2.0, 2.2.1) - all with crashing as result. What I did before the crash was: M - as.matrix(read.table(thematrix,header=T)) eigen(M) If, instead of eigen(M), I use eigen(M, EISPACK=T), R doesn't crash. So, I know a workaround my problem, but still don't understand why R crashes. Could anyone explain this? In case someone wants to download my matrix to see where it goes wrong, it can be downloaded from http://mcs.open.ac.uk/cja235/thematrix (warning: obviously, R might crash so save your unsaved work first). thanks, Casper Albers [[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
[R] R, RMysql, and MySQL 5 Decimal Type Support
Hi, Whenever I have a MySQL query that returns a Decimal result to R I get the following warning in R: Warning message: RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1) I get this for a simple query like SELECT 2, 2.5 !! I am using: R ver 2.1.1 RMySQL ver. 0.5-7 DBI ver. 0.1-10 MySQL Ver 14.12 Distrib 5.0.18. Please Help! Jason [[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] R crashes during 'eigen'
On 3/28/2006 11:01 AM, C.J.Albers wrote: Hi all, Hi, When I want to compute the eigenvalues eigenvectors of a specific matrix, R crashes (i.e. it stops responding to any input). I've tried it with different versions of R (2.1.1, 2.2.0, 2.2.1) - all with crashing as result. What I did before the crash was: M - as.matrix(read.table(thematrix,header=T)) eigen(M) If, instead of eigen(M), I use eigen(M, EISPACK=T), R doesn't crash. So, I know a workaround my problem, but still don't understand why R crashes. Could anyone explain this? In case someone wants to download my matrix to see where it goes wrong, it can be downloaded from http://mcs.open.ac.uk/cja235/thematrix (warning: obviously, R might crash so save your unsaved work first). I don't get a crash, but it does appear to lock up in Windows. I gave up after about 15 minutes. I don't have good facilities for interrupting a running process, but I can tell it is stuck somewhere in Rlapack.dll. 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] Reading an Rconsole file
I've just committed some code to R-devel (currently the alpha version of 2.3.0) to allow users in the Windows Rgui to load settings from an Rconsole file while R is running. Currently this is done through the Edit|GUI preferences dialog (there's now a Load button); if I have time I'll also add a loadRconsole() function. This is intended to be used to switch between different Rconsole settings, e.g. large fonts for a presentation versus regular fonts for single-user purposes. Currently it can be done through environment variables, but those are sometimes hard to manage; this should be simpler. As we're now in the alpha phase coming up to the 2.3.0 release, I'd really appreciate it if users would test this (and all other new features; see the NEWS and CHANGES files). The alpha releases are being built daily and are available on CRAN. This feature should show up in the Mar 29 build. 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] atan2(1,1i)
Robin Hankin wrote: Hi ?atan2 says that atan2(y,x)=atan(y/x) for x and y numeric or complex vectors. Well, I would expect atan2(1,1i) to be equal to atan(-1i), but atan2(1,1i) Error in atan2(y, x) : Non-numeric argument to mathematical function Ravi Varadhan pointed out that you need to make both arguments complex to address the error message you obtained... but atan2 wasn't originally designed for complex arguments. I suspect that what you really want is to use the Arg function: Arg(1/1i) [1] -1.570796 -- --- Jeff NewmillerThe . . Go Live... DCN:[EMAIL PROTECTED]Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k __ 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] opendap/dods data retrieval
Hello, I was wondering if there has been any progress in developing a package for accessing opendap/dods data using R. I see from the list archive that there was some initial work done on this. Thanks, Paul Brewin Paul E Brewin (PhD) Center for Research in Biological Systems University of California San Diego 9500 Gilman Drive MC 0505 La Jolla CA, 92093-0505 USA Ph: 858-822-0871 Fax: 858-822-3610 [[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 with the code
library(survival) library(boot)data=NULL lambda=NULL result=NULL pat=rep(1:102,each=1) trt=rep(c(1,0),51) status=rep(1,102) site=rep(1:51, each=2) nr.datasets=100 seed=2006beta=log(1/2)for (i in 1:51) { lambda[i]=1+((3-1)/50)*(i-1)} lambda1=rep(lambda, each=2) dummy=rep(c(exp(beta),1),51) elf=lambda1*dummyr=70 #the number of bootstrap replicates#mymodels=function(dataset.number){ #seed=2006*dataset.number time=rexp(102, rate=elf) data=cbind(pat,trt,status,site,time) data1=data.frame(data) Cox proportional hazard model stratified on site model1.cox=coxph(Surv(time,status) ~ trt + strata(site), data=data1, iter.max=500) model1.surv=survfit(model1.cox) Cox proportional hazard model with dummy covariates for sitemodel2.cox=coxph(Surv(time,status) ~ trt + factor(site), data=data1, iter.max=500) model2.surv=survfit(model2.cox)beta.fun1 = function(dataname) { cox = coef(coxph(Surv(dataname$time,dataname$status! ) ~ dataname$trt+strata(dataname$site))) } beta.fun2 = function(dataname) { cox =coef(coxph(Surv(dataname$time,dataname$status) ~ dataname$trt+factor(dataname$site))) #cox=cox[1] }dataname=data1 ## Calculate Cox's regression coefficients' standard error and bias using the ## ordinary Bootstrap# set.seed(1234)#set the random start cox.ord1 = censboot(data=dataname,statistic=beta.fun1,R=r,F.surv=model1.surv, cox=model1.cox,sim=ordinary) cox.ord1 cox.ord2 = censboot(data=dataname,statistic=beta.fun2,R=r,F.surv=model2.surv, cox=model2.cox,sim=ordinary) cox.ord2join=list(model1, model2) #return(join) #}#for (i in 1:2){ #result[i]=mymodels} I run the above code but for the following part: cox.ord2 = censboot(data=dataname,statistic=beta.fun2,R=r,F.surv=model2.surv, cox=model2.cox,sim=ordinary) cox.ord2 I get an error and says that it did not converge. I am not sure whats wrong in my coding. I want to calculate the bias. Any help is very much appreciated. Thanks, Orlando - [[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] opendap/dods data retrieval
On Tue, 28 Mar 2006, Paul Brewin wrote: Hello, I was wondering if there has been any progress in developing a package for accessing opendap/dods data using R. I see from the list archive that there was some initial work done on this. I could not reproduce your search in RSiteSearch(). If you can configure and compile your own GDAL, it has an optional DODS driver. If this is built into GDAL, the rgdal package should be able to access it, but trying it outside R from the command line with gdalinfo is certainly necessary. Thanks, Paul Brewin Paul E Brewin (PhD) Center for Research in Biological Systems University of California San Diego 9500 Gilman Drive MC 0505 La Jolla CA, 92093-0505 USA Ph: 858-822-0871 Fax: 858-822-3610 [[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 -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [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] object size vs. file size
Note that formulas have environments too. Do you have any of those? On 3/28/06, Steven Lacey [EMAIL PROTECTED] wrote: Duncan, I wrote an R package to process my data. The package was written in such a way that I no longer stored functions themselves in my sa objects, just their names (as strings) instead. I re-ran my analysis and found that, indeed the saved object sizes were smaller when I was not saving attached environments. However, I still find the object size discrepancy. That is, I have two objects tmp and tmp1 that are the same size in R (when calling object.size both are 870116 bytes), but vastly different sizes as save objects (tmp = 1091KB, tmp1=8436KB). While saving the environment is an issue in overall size, I am not sure it accounts for the difference in size. I am beginning to think it has to do with the code used to generate the objects. To do the fitting (which creates tmp and tmp1 objects): 1) d.rt - split a dataframe 2) define a list called arg, which defines all the parameters for the fitting My problem is that I need to call the function that does the fitting (df2sa) once for each dataframe in the list d.rt with the parameters specificed in arg. To do this I add two additional components to arg list: Arg$X - d.rt Arg$FUN - df2sa.models #This function manages the fitting for each dataframe in d.rt. Now I call: Do.call(lapply,arg) I expect it to call df2sa for each dataframe in d.rt passing in the remaining parameters in the arg list. The code works in the sense that I get the returned objects, but when I save them the sizes are strange, as described above. I obtain the small version of the same object when I call: tmp - do.call(df2sa,arg). In this case there is no lapply wrapper. Somehow lapply is adding something more to what is returned, but I am not sure what or how. What is also strange is that the object in question is not the last element in d.rt, so it's not as if lapply is returning everything in that one object. I attached the object files again and the class definitions required to view them. However, note that the object names differ from the ones used above. Tmp = incompat Tmp1 = x0302.incompatible.RT.fits Please help! Thanks, Steve -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Sunday, March 26, 2006 10:34 AM To: Gabor Grothendieck Cc: Steven Lacey; r-help@stat.math.ethz.ch Subject: Re: [R] object size vs. file size On 3/25/2006 10:16 PM, Gabor Grothendieck wrote: You can place functions in lists or environments and pass the environment to the function and have it look there first. That way you can have different versions of a function with the same name. 1. Here is an example using lists: A - list(f = sin) B - list(f = cos) f - function(x) x+2 myfun - function(x, L = NULL) with(L, f)(x) myfun(0) # 2 myfun(0, A) # 0 myfun(0, B) # 1 All three of the above make a call to f but the first uses the f in the global environment, the second uses the f in A and the third uses the f in B. 2. Above we illustrated this using lists but it can also be done using environments. In the following we use the proto package to facilitiate this. proto objects are built on top of environments., For example, you could replace the first two lines in the prior example with: library(proto) A - proto(f = sin) B - proto(f = cos) Note that in #1 and #2 myfun did have to be programmed to handle this. Another way to do this which does not require myfun to be preprogrammed is the following: library(proto) A - proto(f = sin) B - proto(f = cos) myfun - function(x) f(x) myfun(0) # 2 with(A$proto(myfun = myfun), myfun)(0) # 0 with(B$proto(myfun = myfun), myfun)(0) # 1 The first with statement defines a child object of A which contains a single method myfun, A$proto(myfun = myfun). Then it calls the myfun in that new object. Since the new object is a child of A, myfun will look for f in the new object and not finding it will search the parent A and find it there. Similarly for B in the second with statement. Regarding removing environments, if if is a function you can do this: environment(f) - NULL but you will likely need to restore the environment prior to using f. That will get you a warning in 2.3.0 (and replace the NULL with baseenv()), and an error in 2.4.0. In current and past versions, a NULL wasn't interpreted as no environment, it was interpreted as the base environment. If you want something that is like no environment, you can use emptyenv() in 2.3.0, but this would rarely make sense for an R function: even the most basic things involved in evaluation need to come from somewhere. emptyenv() is mainly designed for situations where you want an entirely separate namespace, not related to R functions at all, but using the same syntax and rules for lookups. Duncan
Re: [R] object size vs. file size
On 3/28/2006 2:54 PM, Steven Lacey wrote: Duncan, I wrote an R package to process my data. The package was written in such a way that I no longer stored functions themselves in my sa objects, just their names (as strings) instead. I re-ran my analysis and found that, indeed the saved object sizes were smaller when I was not saving attached environments. However, I still find the object size discrepancy. That is, I have two objects tmp and tmp1 that are the same size in R (when calling object.size both are 870116 bytes), but vastly different sizes as save objects (tmp = 1091KB, tmp1=8436KB). While saving the environment is an issue in overall size, I am not sure it accounts for the difference in size. I am beginning to think it has to do with the code used to generate the objects. To do the fitting (which creates tmp and tmp1 objects): 1) d.rt - split a dataframe 2) define a list called arg, which defines all the parameters for the fitting My problem is that I need to call the function that does the fitting (df2sa) once for each dataframe in the list d.rt with the parameters specificed in arg. To do this I add two additional components to arg list: Arg$X - d.rt Arg$FUN - df2sa.models #This function manages the fitting for each dataframe in d.rt. Now I call: Do.call(lapply,arg) I expect it to call df2sa for each dataframe in d.rt passing in the remaining parameters in the arg list. The code works in the sense that I get the returned objects, but when I save them the sizes are strange, as described above. I obtain the small version of the same object when I call: tmp - do.call(df2sa,arg). In this case there is no lapply wrapper. Somehow lapply is adding something more to what is returned, but I am not sure what or how. What is also strange is that the object in question is not the last element in d.rt, so it's not as if lapply is returning everything in that one object. I attached the object files again and the class definitions required to view them. However, note that the object names differ from the ones used above. Tmp = incompat Tmp1 = x0302.incompatible.RT.fits Please help! Sorry, I can't really help. I suspect it's still an issue of environments, but you'll need to find someone who knows the S4 internals better than me to figure out where the environments are hiding. Duncan Murdoch Thanks, Steve -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Sunday, March 26, 2006 10:34 AM To: Gabor Grothendieck Cc: Steven Lacey; r-help@stat.math.ethz.ch Subject: Re: [R] object size vs. file size On 3/25/2006 10:16 PM, Gabor Grothendieck wrote: You can place functions in lists or environments and pass the environment to the function and have it look there first. That way you can have different versions of a function with the same name. 1. Here is an example using lists: A - list(f = sin) B - list(f = cos) f - function(x) x+2 myfun - function(x, L = NULL) with(L, f)(x) myfun(0) # 2 myfun(0, A) # 0 myfun(0, B) # 1 All three of the above make a call to f but the first uses the f in the global environment, the second uses the f in A and the third uses the f in B. 2. Above we illustrated this using lists but it can also be done using environments. In the following we use the proto package to facilitiate this. proto objects are built on top of environments., For example, you could replace the first two lines in the prior example with: library(proto) A - proto(f = sin) B - proto(f = cos) Note that in #1 and #2 myfun did have to be programmed to handle this. Another way to do this which does not require myfun to be preprogrammed is the following: library(proto) A - proto(f = sin) B - proto(f = cos) myfun - function(x) f(x) myfun(0) # 2 with(A$proto(myfun = myfun), myfun)(0) # 0 with(B$proto(myfun = myfun), myfun)(0) # 1 The first with statement defines a child object of A which contains a single method myfun, A$proto(myfun = myfun). Then it calls the myfun in that new object. Since the new object is a child of A, myfun will look for f in the new object and not finding it will search the parent A and find it there. Similarly for B in the second with statement. Regarding removing environments, if if is a function you can do this: environment(f) - NULL but you will likely need to restore the environment prior to using f. That will get you a warning in 2.3.0 (and replace the NULL with baseenv()), and an error in 2.4.0. In current and past versions, a NULL wasn't interpreted as no environment, it was interpreted as the base environment. If you want something that is like no environment, you can use emptyenv() in 2.3.0, but this would rarely make sense for an R function: even the most basic things involved in evaluation need to come from somewhere. emptyenv() is mainly designed for situations where
[R] Welch test for equality of variance
Hello Using R 2.2.1 on a Windows machine. Has anyone programmed the Welch test for equality of variances? I tried RSiteSearch, but this gave references to t test and oneway.test, which are not quite what I need.I need the Welch test itself, for use in a meta-analysis (to determine if variances are equal). TIA Peter Peter L. Flom, PhD Assistant Director, Statistics and Data Analysis Core Center for Drug Use and HIV Research National Development and Research Institutes 71 W. 23rd St http://cduhr.ndri.org www.peterflom.com New York, NY 10010 (212) 845-4485 (voice) (917) 438-0894 (fax) __ 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] Welch test for equality of variance
?t.test t.test has a var.equal option that you can set to FALSE to use the Welch approximation. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Flom Sent: Tuesday, March 28, 2006 4:41 PM To: [EMAIL PROTECTED] Subject: [R] Welch test for equality of variance Hello Using R 2.2.1 on a Windows machine. Has anyone programmed the Welch test for equality of variances? I tried RSiteSearch, but this gave references to t test and oneway.test, which are not quite what I need.I need the Welch test itself, for use in a meta-analysis (to determine if variances are equal). TIA Peter Peter L. Flom, PhD Assistant Director, Statistics and Data Analysis Core Center for Drug Use and HIV Research National Development and Research Institutes 71 W. 23rd St http://cduhr.ndri.org www.peterflom.com New York, NY 10010 (212) 845-4485 (voice) (917) 438-0894 (fax) __ 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] graphing and scrolling
Gregory Snow [EMAIL PROTECTED] wrote: Does the following (or some simple modification of it) do what you want?: library(tkrplot) y - rnorm(1, 10, 2) + 5*sin( (1:1)/1000 ) tt - tktoplevel() left - tclVar(1) oldleft - tclVar(1) right - tclVar(100) f1 - function(){ lleft - as.numeric(tclvalue(left)) rright - as.numeric(tclvalue(right)) x - seq(lleft,rright,by=1) plot(x,y[x], type='b',ylim=range(y)) } img - tkrplot(tt, f1) f2 - function(...){ ol - as.numeric(tclvalue(oldleft)) tclvalue(oldleft) - tclvalue(left) r - as.numeric(tclvalue(right)) tclvalue(right) - as.character(r + as.numeric(...) - ol) tkrreplot(img) } f3 - function(...){ tkrreplot(img) } f4 - function(...){ ol - as.numeric(tclvalue(oldleft)) tclvalue(left) - as.character(ol+100) tclvalue(oldleft) - as.character(ol+100) r - as.numeric(tclvalue(right)) tclvalue(right) - as.character(r+100) tkrreplot(img) } s1 - tkscale(tt, command=f2, from=1, to=length(y), variable=left, orient=horiz,label='left') s2 - tkscale(tt, command=f3, from=1, to=length(y), variable=right, orient=horiz,label='right') b1 - tkbutton(tt, text='-', command=f4) tkpack(img,s1,s2,b1) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fred J. Sent: Monday, March 27, 2006 1:05 PM To: r-help@stat.math.ethz.ch Subject: [R] graphing and scrolling Dear R users graphing with plot(x) seams to work for a small length(x), when length(x) is too large it seams to clutter the display, a solution would be to display subsets of x at a time, yet a better way which I hope R supports is to place a sliding bar on the display window to control length(x) and thus the resolution, which will involve auto scaling the y axis as well as automatically place a side-to-side scrolling bar at the bottom of the chart to move through and display the subsets of x according to the resolution. is there such an implementation? thank you - [[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 thanks that was very helpful. i have been reading and trying to modify the code around to suit, but haven't been able to: first, maximize the chart with the window being maximized, the way it is it stays the same size after maximizing the window. second, plotting another sequence which share the same index with the first sequence but with different values, its scale I wish to place on the right side of the chart. - [[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] [Q] How to make a multi-line title with expression()
Dear R-lister Could anyone know how to make a multi-line title for a plot with expression()? In my plot, the title should be writeen in two lines (because it is two long for one line) and it should use a mathematical expression. I tried to use \n, but \n is ignored in expression() call: hist(diffChangeRequestHintsBeforeAnswering[,4], br = 50, xlab = Skill Change in Standard Deviation, main = expression(paste((a) HS, F[A], \nRequest hint(s)/subtask(s) before first attempt))) Thanks in advance. Young-Jin Lee [[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] graphing and scrolling
thanks that was very helpful. i have been reading and trying to modify the code around to suit, but haven't been able to: first, maximize the chart with the window being maximized, the way it is it stays the same size after maximizing the window. The function tkrplot has optional arguments hscale and vscale that can be used to adjust the initial size of the graph, but currently tkrplot does not do dynamic resizing. To make the plot 3 times as wide and 2 times as tall just change the tkrplot call to: img - tkrplot(tt,f1,hscale=3,vscale=2) second, plotting another sequence which share the same index with the first sequence but with different values, its scale I wish to place on the right side of the chart. Add your code for the second series to the f1 function. Something like: f1 - function(){ lleft - as.numeric(tclvalue(left)) rright - as.numeric(tclvalue(right)) x - seq(lleft,rright,by=1) plot(x,y[x], type='b',ylim=range(y,y2)) points(x,y2[x],type='b', col='green') axis(4) } or f1 - function(){ lleft - as.numeric(tclvalue(left)) rright - as.numeric(tclvalue(right)) x - seq(lleft,rright,by=1) plot(x,y[x], type='b',ylim=range(y)) par(new=TRUE) plot(x,y2[x], type='b', col='green', axes=F) axis(4) } Hope this helps, [[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] [Q] How to make a multi-line title with expression()
Young-Jin Lee wrote: Dear R-lister Could anyone know how to make a multi-line title for a plot with expression()? In my plot, the title should be writeen in two lines (because it is two long for one line) and it should use a mathematical expression. I tried to use \n, but \n is ignored in expression() call: hist(diffChangeRequestHintsBeforeAnswering[,4], br = 50, xlab = Skill Change in Standard Deviation, main = expression(paste((a) HS, F[A], \nRequest hint(s)/subtask(s) before first attempt))) Thanks in advance. Young-Jin Lee Try RSiteSearch(multi-line expression). Thanks, --sundar __ 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] trellis graph question
R2.2, WinXP: I am using xyplot( ) to generate time plots of plasma concentration data. The following is an edited version of my code: xyplot(log.conc ~ time| group, data = foo, groups = subject, panel = function(x, y, panel.number, ...) { panel.superpose(x, y, subscripts = TRUE, groups = foo$group, type = 'l', col = black) panel.loess(x,y,span = .66, col = red, lwd = 3) panel.grid(h=-1, v=-1, lwd = 1) } ) For each dose group, I want to plot all subjects within the group and superimpose a loess smoother so that an overall trend can be made apparent. The code above does this, but has the annoying tendency to connect the first-last points for (say) subject 1 with the last-first points of (say) subject 2. This annoyance is something that is tolerable for exploratory graphs but not for publication-quality graphs... Is there a fix to this connect-the-wrong-points problem? Much thanks and gratitude in advance, Greg __ 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] cat(), Rgui, and support for carriage return \r...
On 3/28/2006 11:00 AM, Prof Brian Ripley wrote: Rgui now supports \r in the same way as rterm. I notice that there's a slight change to the colour scheme: now the prompt is in foreground colour, rather than user colour. This might make sense (it's printed by the system, after all), but it looks a little strange at first. Duncan Murdoch On Sun, 19 Mar 2006, Duncan Murdoch wrote: On 3/18/2006 2:39 PM, Duncan Murdoch wrote: On 3/17/2006 9:44 AM, Jeffrey Racine wrote: Hi, and thanks in advance for your time. Background - I am working on a package and wish to have a routine's progress reported. The routine can take some time, and I would like to inform the user about the routine's progress. I have scoured the archives but to no avail, so would like to solicit input from this list. I am successfully using cat(\rBootstrap replication , i, of , boot.num,) flush.console() # To flush stdout on windows systems which works as expected on *NIX systems and using Rterm under windows. However, under Rgui the carriage return \r is ignored, and I certainly don't want to use the newline escape sequence \n. Under Rgui it appears as Bootstrap replication 1 of 399Bootstrap replication 2 of 399Bootstrap... but I want it to function properly if at all possible. My question is simply whether there is a portable way to implement this so that it works regardless of the R platform the user may be working on? Many thanks for any/all suggestions. I've just been looking at the source code for this. I think it will be relatively easy to make \r in Rgui do a destructive CR (i.e. it will return to the start of the line, but clear any existing characters). I'll play around a bit and then do that for R-devel. Oops, this was a bad idea. I did commit the change for a while, but have reverted it now. It seems that the help system displays help pages by writing CR LF at the end of each line; the CR is \r, and my change above caused it to wipe out the line it had just written. The help pages ended up completely blank. I may look into supporting \r as a non-destructive CR, but that's harder, because it means low-level changes to the console display. Right now it only writes to the end of the text buffer; this would mean it would sometimes write to a spot before the end. I don't think it would be impossible to do, but it will take more time than I have right now. 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-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] object size vs. file size
Duncan Gabor, It works! When I no longer save the environment associated with the formulas (and no other environments), the size of my saved objects are all around 350KB, which is actually smaller than there size in R. What a relief! That was driving me nuts! In R, is the environment of an object a pointer? Is it only when the object is saved (and the environment may no longer exist when loaded again) that the objects in the environment are themselves saved, as opposed to a pointer to an environment? Thanks again! Steve -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 28, 2006 3:02 PM To: Steven Lacey Cc: 'Gabor Grothendieck'; r-help@stat.math.ethz.ch Subject: Re: [R] object size vs. file size On 3/28/2006 2:54 PM, Steven Lacey wrote: Duncan, I wrote an R package to process my data. The package was written in such a way that I no longer stored functions themselves in my sa objects, just their names (as strings) instead. I re-ran my analysis and found that, indeed the saved object sizes were smaller when I was not saving attached environments. However, I still find the object size discrepancy. That is, I have two objects tmp and tmp1 that are the same size in R (when calling object.size both are 870116 bytes), but vastly different sizes as save objects (tmp = 1091KB, tmp1=8436KB). While saving the environment is an issue in overall size, I am not sure it accounts for the difference in size. I am beginning to think it has to do with the code used to generate the objects. To do the fitting (which creates tmp and tmp1 objects): 1) d.rt - split a dataframe 2) define a list called arg, which defines all the parameters for the fitting My problem is that I need to call the function that does the fitting (df2sa) once for each dataframe in the list d.rt with the parameters specificed in arg. To do this I add two additional components to arg list: Arg$X - d.rt Arg$FUN - df2sa.models #This function manages the fitting for each dataframe in d.rt. Now I call: Do.call(lapply,arg) I expect it to call df2sa for each dataframe in d.rt passing in the remaining parameters in the arg list. The code works in the sense that I get the returned objects, but when I save them the sizes are strange, as described above. I obtain the small version of the same object when I call: tmp - do.call(df2sa,arg). In this case there is no lapply wrapper. Somehow lapply is adding something more to what is returned, but I am not sure what or how. What is also strange is that the object in question is not the last element in d.rt, so it's not as if lapply is returning everything in that one object. I attached the object files again and the class definitions required to view them. However, note that the object names differ from the ones used above. Tmp = incompat Tmp1 = x0302.incompatible.RT.fits Please help! Sorry, I can't really help. I suspect it's still an issue of environments, but you'll need to find someone who knows the S4 internals better than me to figure out where the environments are hiding. Duncan Murdoch Thanks, Steve -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Sunday, March 26, 2006 10:34 AM To: Gabor Grothendieck Cc: Steven Lacey; r-help@stat.math.ethz.ch Subject: Re: [R] object size vs. file size On 3/25/2006 10:16 PM, Gabor Grothendieck wrote: You can place functions in lists or environments and pass the environment to the function and have it look there first. That way you can have different versions of a function with the same name. 1. Here is an example using lists: A - list(f = sin) B - list(f = cos) f - function(x) x+2 myfun - function(x, L = NULL) with(L, f)(x) myfun(0) # 2 myfun(0, A) # 0 myfun(0, B) # 1 All three of the above make a call to f but the first uses the f in the global environment, the second uses the f in A and the third uses the f in B. 2. Above we illustrated this using lists but it can also be done using environments. In the following we use the proto package to facilitiate this. proto objects are built on top of environments., For example, you could replace the first two lines in the prior example with: library(proto) A - proto(f = sin) B - proto(f = cos) Note that in #1 and #2 myfun did have to be programmed to handle this. Another way to do this which does not require myfun to be preprogrammed is the following: library(proto) A - proto(f = sin) B - proto(f = cos) myfun - function(x) f(x) myfun(0) # 2 with(A$proto(myfun = myfun), myfun)(0) # 0 with(B$proto(myfun = myfun), myfun)(0) # 1 The first with statement defines a child object of A which contains a single method myfun, A$proto(myfun = myfun). Then it calls the myfun in that new object. Since the new object is a child of A, myfun will look for f in the new object and not finding it
Re: [R] Welch test for equality of variance
Peter, I don't know the Welch test for variances, but you might consider using the Fligner-Killeen test (fligner.test) or one of the Levene test variations (package:car). A useful reference is WJ Conover, ME Johnson, MM Johnson. 1981. Technometrics 23:351 with a minor correction in Technometrics 26:302. Peter Ehlers Peter Flom wrote: Hello Using R 2.2.1 on a Windows machine. Has anyone programmed the Welch test for equality of variances? I tried RSiteSearch, but this gave references to t test and oneway.test, which are not quite what I need.I need the Welch test itself, for use in a meta-analysis (to determine if variances are equal). TIA Peter Peter L. Flom, PhD Assistant Director, Statistics and Data Analysis Core Center for Drug Use and HIV Research National Development and Research Institutes 71 W. 23rd St http://cduhr.ndri.org www.peterflom.com New York, NY 10010 (212) 845-4485 (voice) (917) 438-0894 (fax) __ 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 -- Department of Mathematics and Statistics University of Calgary, 2500 University Dr. NW ph: 403-220-3936 Calgary, Alberta T2N 1N4, CANADA fax: 403-282-5150 __ 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] object size vs. file size
On 3/28/2006 5:46 PM, Steven Lacey wrote: Duncan Gabor, It works! When I no longer save the environment associated with the formulas (and no other environments), the size of my saved objects are all around 350KB, which is actually smaller than there size in R. What a relief! That was driving me nuts! In R, is the environment of an object a pointer? Is it only when the object is saved (and the environment may no longer exist when loaded again) that the objects in the environment are themselves saved, as opposed to a pointer to an environment? Not quite pointers, but environments are stored as references. Not all objects have environments. Functions do, and a few other objects where symbols might need to be evaluated (such as formulas). By the way, just for fun this afternoon I started writing a patch to the serialize code that reports on file offsets of things as it reads them. I won't commit this to the main build because - it's not that accurate - I can't be bothered making it perfect - it makes the code ugly but I might post the patch somewhere. Duncan Murdoch Thanks again! Steve -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 28, 2006 3:02 PM To: Steven Lacey Cc: 'Gabor Grothendieck'; r-help@stat.math.ethz.ch Subject: Re: [R] object size vs. file size On 3/28/2006 2:54 PM, Steven Lacey wrote: Duncan, I wrote an R package to process my data. The package was written in such a way that I no longer stored functions themselves in my sa objects, just their names (as strings) instead. I re-ran my analysis and found that, indeed the saved object sizes were smaller when I was not saving attached environments. However, I still find the object size discrepancy. That is, I have two objects tmp and tmp1 that are the same size in R (when calling object.size both are 870116 bytes), but vastly different sizes as save objects (tmp = 1091KB, tmp1=8436KB). While saving the environment is an issue in overall size, I am not sure it accounts for the difference in size. I am beginning to think it has to do with the code used to generate the objects. To do the fitting (which creates tmp and tmp1 objects): 1) d.rt - split a dataframe 2) define a list called arg, which defines all the parameters for the fitting My problem is that I need to call the function that does the fitting (df2sa) once for each dataframe in the list d.rt with the parameters specificed in arg. To do this I add two additional components to arg list: Arg$X - d.rt Arg$FUN - df2sa.models #This function manages the fitting for each dataframe in d.rt. Now I call: Do.call(lapply,arg) I expect it to call df2sa for each dataframe in d.rt passing in the remaining parameters in the arg list. The code works in the sense that I get the returned objects, but when I save them the sizes are strange, as described above. I obtain the small version of the same object when I call: tmp - do.call(df2sa,arg). In this case there is no lapply wrapper. Somehow lapply is adding something more to what is returned, but I am not sure what or how. What is also strange is that the object in question is not the last element in d.rt, so it's not as if lapply is returning everything in that one object. I attached the object files again and the class definitions required to view them. However, note that the object names differ from the ones used above. Tmp = incompat Tmp1 = x0302.incompatible.RT.fits Please help! Sorry, I can't really help. I suspect it's still an issue of environments, but you'll need to find someone who knows the S4 internals better than me to figure out where the environments are hiding. Duncan Murdoch Thanks, Steve -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Sunday, March 26, 2006 10:34 AM To: Gabor Grothendieck Cc: Steven Lacey; r-help@stat.math.ethz.ch Subject: Re: [R] object size vs. file size On 3/25/2006 10:16 PM, Gabor Grothendieck wrote: You can place functions in lists or environments and pass the environment to the function and have it look there first. That way you can have different versions of a function with the same name. 1. Here is an example using lists: A - list(f = sin) B - list(f = cos) f - function(x) x+2 myfun - function(x, L = NULL) with(L, f)(x) myfun(0) # 2 myfun(0, A) # 0 myfun(0, B) # 1 All three of the above make a call to f but the first uses the f in the global environment, the second uses the f in A and the third uses the f in B. 2. Above we illustrated this using lists but it can also be done using environments. In the following we use the proto package to facilitiate this. proto objects are built on top of environments., For example, you could replace the first two lines in the prior example with: library(proto) A - proto(f = sin) B - proto(f = cos) Note that in #1 and #2
Re: [R] Remove [1] ... from output
Thank you Adelchi and Ales! Adelchi Azzalini wrote: On Tue, 28 Mar 2006 13:21:59 +0200, Gregor Gorjanc wrote: GG Hello! GG GG I am writing some numbers and character vectors to an ascii file GG and would like to get rid of [1] ... as shown bellow (a dummy GG example) GG GG R runif(20) GG [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252 GG 0.506480 0.547759 [9] 0.912421 0.584382 0.987208 0.996846 GG 0.666760 0.053637 0.327590 0.370737 GG [17] 0.505706 0.412316 0.887421 0.812151 GG GG I have managed to work up to remove quotes and all [*] except [1] GG as shown bellow. GG GG R print(paste(runif(20), collapse = ), quote = FALSE) GG [1] 0.790620362851769 0.45603066496551 0.563822037540376 GG 0.812907998682931 0.726162418723106 0.37031230609864 GG 0.681147597497329 0.29929908295162 0.209858040558174 GG 0.304300333140418 0.105796672869474 0.743657597573474 GG 0.409294542623684 0.825012607965618 0.282235795632005 GG 0.21159387845546 0.620056127430871 0.337449935730547 GG 0.754527133889496 0.280175548279658 GG GG Any hints how to solve my task? GG what about cat(format(runif(20))) ? you can improve it a bit with cat(format(runif(20)),\n) -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ 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, RMysql, and MySQL 5 Decimal Type Support
Whenever I have a MySQL query that returns a Decimal result to R I get the following warning in R: I get this for a simple query like SELECT 2, 2.5 !! Warning message: RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1) If I understand what you are saying, I think you have garbled SQL syntax. The select statement synatx is: SELECT list_of_columns FROM tables[s] [WHERE search_conditions] My guess is that you don't have columns named 2 or 2.5 Rob Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA - Original Message - From: Jason Trimble [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, March 28, 2006 12:08 PM Subject: [R] R, RMysql, and MySQL 5 Decimal Type Support Hi, I am using: R ver 2.1.1 RMySQL ver. 0.5-7 DBI ver. 0.1-10 MySQL Ver 14.12 Distrib 5.0.18. Please Help! Jason [[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
[R] lmer multilevel
My question relates to problems that I'm having matching lme and lmer examples in PB. using Matix 0.995 In the Oxide example in p167-170 I can't get the level 2 coefficient estimates to match the fm1Oxide model in lme is data(Oxide,package=nlme) lme(Thickness~1,Oxide) which I translate in Lmer syntax to fm3Oxide-lmer(Thickness~ (1|Lot)+(1|Lot:Wafer),data=Oxide) #or alternatively which gives the same result Oxide$LW-with(Oxide,Lot:Wafer)[drop=TRUE] fm4Oxide-lmer(Thickness~ (1|Lot)+(1|LW),data=Oxide) however if you look at say Lot 8, lme gives 81993.767 8/11993.677 8/21995.170 8/31990.693 while lmer gives coef(fm3Oxide) 81993.767 8:1 2000.062 8:2 2001.555 8:3 1997.078 To me this looks like lmer in not including the lot random effect (8= -6.385129, Intercept 2000.153 ). Is this because I'm not specifying the model correctly? Thanks Paul [[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] write.table command
Dear All, I'm trying to save a dataframe using write.table command. It works, but when I retrieved, there's an error message as shown below: write.table(soil.dat,file=C:/soil.rdata) load(C:/soil.rdata) Error: bad restore file magic number (file may be corrupted)-- no data loaded I can figure out the error message. Any assistance to solve the problem is very much appreciated. Regards. Abd. Rahman Kassim, PhD Forest Management Ecology Program Forestry Conservation Division Forest Research Institute Malaysia Kepong 52109 Selangor Malaysia Fax: 603-62729852 Tel: 603-62797179 * * [[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] linear regression of verydispersed data
Hi, I need some help in modeling a linear regression problem. I am trying to fit a relationship between the dependent variable y and the independent variables matrix X. I tried different set of models, and also did some EDA and saw clearly no linear relationship exist between y and X. I also tried with some transformations of the variables, robust regressions, ace and avas (the variance stabilization methods) and a few more. But I don't seem to get a decent model that can validate a subsample. After this, I want to try some machine learning algorithms, where I just input the X and y, the algorithm applies a definite set of transformations and arithmetic operations (something like genetic algorithm). I remember there is a software called GenIQ which does something like and produces a functional form of X and y. It is a MLE. This software takes the variables X and Y and the simple arithmetic operations (+, -, *, / etc) and some transformations (like sin, cos, exp) as input and evaluates a final expression of Y = f(X). Is there any such algorithm or a related one in R? I welcome your comments and any such references to existing algorithms in R. Thank you, Nagu __ 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] write.table command
The help file for load says that it is to be used for objects saved using the save command. Perhaps you should try read.table. Cheers, Simon. Abd Rahman Kassim wrote: Dear All, I'm trying to save a dataframe using write.table command. It works, but when I retrieved, there's an error message as shown below: write.table(soil.dat,file=C:/soil.rdata) load(C:/soil.rdata) Error: bad restore file magic number (file may be corrupted)-- no data loaded I can figure out the error message. Any assistance to solve the problem is very much appreciated. Regards. Abd. Rahman Kassim, PhD Forest Management Ecology Program Forestry Conservation Division Forest Research Institute Malaysia Kepong 52109 Selangor Malaysia Fax: 603-62729852 Tel: 603-62797179 * * [[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 -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C __ 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] [Q] How to make a multi-line title with expression()
Young-Jin, The expression tit1 - Max. Daily Wind Speed \nSydney Airport hist(ws,xlab='Wind Speed',ylab='Freq.,main=tit1) works fine in my case. Try using your title between one set of quotes. Hope it helps, Augusto Augusto Sanabria. MSc, PhD. Mathematical Modeller Risk Research Group Geospatial Earth Monitoring Division Geoscience Australia (www.ga.gov.au) Cnr. Jerrabomberra Av. Hindmarsh Dr. Symonston ACT 2609 Ph. (02) 6249-9155 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sundar Dorai-Raj Sent: Wednesday, 29 March 2006 9:29 AM To: Young-Jin Lee Cc: r-help Subject: Re: [R] [Q] How to make a multi-line title with expression() Young-Jin Lee wrote: Dear R-lister Could anyone know how to make a multi-line title for a plot with expression()? In my plot, the title should be writeen in two lines (because it is two long for one line) and it should use a mathematical expression. I tried to use \n, but \n is ignored in expression() call: hist(diffChangeRequestHintsBeforeAnswering[,4], br = 50, xlab = Skill Change in Standard Deviation, main = expression(paste((a) HS, F[A], \nRequest hint(s)/subtask(s) before first attempt))) Thanks in advance. Young-Jin Lee Try RSiteSearch(multi-line expression). Thanks, --sundar __ 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] graphing and scrolling
in regards to the dynamic resizing, one would think that commands like plot.default {package:graphics} does it, as I am exploring other commands from graphics it seams like tkrplot may not be needed, I am not sure as I just started with graphics in R, maybe a better way to go is call TclTk from R but not sure how, or even save the data to an output file and run TclTk independently. what do you think? Gregory Snow [EMAIL PROTECTED] wrote: thanks that was very helpful. i have been reading and trying to modify the code around to suit, but haven't been able to: first, maximize the chart with the window being maximized, the way it is it stays the same size after maximizing the window. The function tkrplot has optional arguments hscale and vscale that can be used to adjust the initial size of the graph, but currently tkrplot does not do dynamic resizing. To make the plot 3 times as wide and 2 times as tall just change the tkrplot call to: img - tkrplot(tt,f1,hscale=3,vscale=2) second, plotting another sequence which share the same index with the first sequence but with different values, its scale I wish to place on the right side of the chart. Add your code for the second series to the f1 function. Something like: f1 - function(){ lleft - as.numeric(tclvalue(left)) rright - as.numeric(tclvalue(right)) x - seq(lleft,rright,by=1) plot(x,y[x], type='b',ylim=range(y,y2)) points(x,y2[x],type='b', col='green') axis(4) } or f1 - function(){ lleft - as.numeric(tclvalue(left)) rright - as.numeric(tclvalue(right)) x - seq(lleft,rright,by=1) plot(x,y[x], type='b',ylim=range(y)) par(new=TRUE) plot(x,y2[x], type='b', col='green', axes=F) axis(4) } Hope this helps, - [[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] Jump to error location in source()
Dear R users. is there an easy way to make R in ESS put out the line number of an error, or even to jump to, some old posts about this question here, but one day in IT worth a thousand years. I am using ESS and C-c C-l but that is asking to open a file, when given the source it will then ask to C-c ' to find the error but that does not work. http://finzi.psych.upenn.edu/R/Rhelp02a/archive/38628.html http://finzi.psych.upenn.edu/R/Rhelp02a/archive/27796.html thank you - [[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] calling R's optimization routines from C
Hi, I have read R's Writing Extensions manual and am still confused about how to use some of the routines there when I call from C. Specifically, I am writing a little test function which I will optimize using the nmmin function which underlies R's optim() with Nelder-Mead. I guess I wonder what library/header files I should be using. I was using R_ext/Applic.h and linking with libR but I can not get it to work. (Btw, I am using RHEL4/FC4 Linux). The function is very simple: all it does is calculate the sum of squared differences from a parameter, so the minimizer will be the mean. Actually, here is my code: #includestdio.h #includestdlib.h #include R_ext/Applic.h typedef struct { double *X; int n; } MyData; double myfunc(int m, double *par, void *ex) { MyData *mydata = ex; double *X = mydata-X; int n = mydata-n; double mu = par[0]; double sum = 0.0; int i; for (i=0; in; i++) { double t = X[i] - mu; sum += t*t; } return sum; } int main(void) { int i,n=1, trace=1, maxit=100, fail, fncount; double *par, abstol=0.0001, intol=.0001, alpha=1, beta=.5, gamma=2, *xin, *x, Fmin; MyData ex; par=malloc(n*sizeof(double)); xin=malloc(n*sizeof(double)); x=malloc(n*sizeof(double)); par[0]=5; xin[0]=5; ex.n=5; ex.X=malloc(ex.n*sizeof(double)); for(i=0;iex.n;i++) ex.X[i]=i; nmmin(n,xin,x,Fmin,myfunc,fail,abstol,intol,ex,alpha, beta,gamma,trace,fncount,maxit); free(par); free(x); free(xin); free(ex.X); return 0; } I compile using the following: gcc -o testex testex.c -std=c99 -Wall -pedantic -I/usr/lib/R/include -L/usr/lib/R/lib -lm -lR Which actually compiles without error, but I get Segmentation fault when I run it. Clearly, I am doing something wrong. Can someone please provide suggestions? Many thanks and best wishes, Aaarem __ 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] {nuSpectral} irreg sampled ts, phase based periodogram
Dear List-mates, I just read Mathias, et al (2004) about their {nuSpectral} package in R for a weighted leased squares method for unevenly sampled time-series. What kind of experiences have users had with the package? R-Site Search came up blank. I've never asked about a package that was downloaded outside of CRAN. Feel free to redirect me as the case may be. Mathias, Grond, Guardans, Seese, Canela, et al (2004). Algorithms for spectral analysis of irregularly sampled time series. Journal of Statistical Software. 11-2. Rgds, KeithC. __ 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] bug in map('world') ?
From: Joerg van den Hoff [EMAIL PROTECTED] hi, did'nt see anything in the archive: map('world',pro='rectangular',para=0) yields a strange artifact (horizontal bar) extending over the whole map at a certain latitude range (approx 65 deg. north), whereas map('world',pro='rectangular',para=180) (which should be the same) does not show the artifact. the artifact shows up in other projections as well, e.g. map('world',pro='bonne',para=45) which seems to show that the problem might be in the data base of the map (i.e. polygon definition)?? any ideas? The short answer is RTFM, and now that I have again :-), I note that there is a wrap= option. Setting that to TRUE seems to have the desired effect. Ray __ 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] write.table command
Dear Simon, Thanks for the remarks. I had tried read.table and it works. ARK - Original Message - From: Simon Blomberg [EMAIL PROTECTED] To: Abd Rahman Kassim [EMAIL PROTECTED]; R-project help r-help@stat.math.ethz.ch Sent: Tuesday, March 28, 2006 4:49 PM Subject: Re: [R] write.table command The help file for load says that it is to be used for objects saved using the save command. Perhaps you should try read.table. Cheers, Simon. Abd Rahman Kassim wrote: Dear All, I'm trying to save a dataframe using write.table command. It works, but when I retrieved, there's an error message as shown below: write.table(soil.dat,file=C:/soil.rdata) load(C:/soil.rdata) Error: bad restore file magic number (file may be corrupted)-- no data loaded I can figure out the error message. Any assistance to solve the problem is very much appreciated. Regards. Abd. Rahman Kassim, PhD Forest Management Ecology Program Forestry Conservation Division Forest Research Institute Malaysia Kepong 52109 Selangor Malaysia Fax: 603-62729852 Tel: 603-62797179 * * [[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 -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C * Outgoing mail is certified Virus Free. Checked by TrendMicro Interscan Messaging Security. For any enquiries, please contact FRIM IT Department. * __ 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] trellis graph question
On 3/28/06, Greg Tarpinian [EMAIL PROTECTED] wrote: R2.2, WinXP: I am using xyplot( ) to generate time plots of plasma concentration data. The following is an edited version of my code: xyplot(log.conc ~ time| group, data = foo, groups = subject, panel = function(x, y, panel.number, ...) { panel.superpose(x, y, subscripts = TRUE, groups = foo$group, type = 'l', col = black) panel.loess(x,y,span = .66, col = red, lwd = 3) panel.grid(h=-1, v=-1, lwd = 1) } ) For each dose group, I want to plot all subjects within the group and superimpose a loess smoother so that an overall trend can be made apparent. The code above does this, but has the annoying tendency to connect the first-last points for (say) subject 1 with the last-first points of (say) subject 2. This annoyance is something that is tolerable for exploratory graphs but not for publication-quality graphs... Is there a fix to this connect-the-wrong-points problem? I'm confused by your panel function, but from your description, the following should do what you want: xyplot(log.conc ~ time| group, data = foo, groups = subject, panel = function(..., type, col, lwd, span) { panel.grid(h=-1, v=-1, lwd = 1) panel.superpose(..., type = 'l', col = black, lwd = 1) panel.loess(..., span = .66, col = red, lwd = 3) }) Deepayan __ 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] write.table command
Dear Alexander, Thanks for the useful information. ARK - Original Message - From: Alexander Nervedi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 28, 2006 7:19 PM Subject: RE: [R] write.table command Hi! Either use write.table() to output a data matrix and read.table() to retrieve it .. or use save(obj,...) to save R object and then use load to call it back into an R session. check out the help on both ?read.table ?save hope that helps ul-nadi. From: Abd Rahman Kassim [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] write.table command Date: Wed, 29 Mar 2006 08:43:16 -0800 Dear All, I'm trying to save a dataframe using write.table command. It works, but when I retrieved, there's an error message as shown below: write.table(soil.dat,file=C:/soil.rdata) load(C:/soil.rdata) Error: bad restore file magic number (file may be corrupted)-- no data loaded I can figure out the error message. Any assistance to solve the problem is very much appreciated. Regards. Abd. Rahman Kassim, PhD Forest Management Ecology Program Forestry Conservation Division Forest Research Institute Malaysia Kepong 52109 Selangor Malaysia Fax: 603-62729852 Tel: 603-62797179 * * [[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 _ http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ * Outgoing mail is certified Virus Free. Checked by TrendMicro Interscan Messaging Security. For any enquiries, please contact FRIM IT Department. * __ 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] Psychometrics in R
Because of a keynote at useR! in Vienna this summer on psychometrics (and sociometrics, econometrics, educometrics, and so on) in R I have been writing code rather frantically for multidimensional scaling, correspondence analysis, and logit/probit multidimensional IRT models. You can find the code at http://www.cuddyvalley.org/psychoR or at my homepage http://gifi.stat.ucla.edu Eventually this will be packaged in the appropriate way and documented (dream on, Jan) but it may be useful to some already in its present state. === Jan de Leeuw; Distinguished Professor and Chair, UCLA Department of Statistics; Editor: Journal of Multivariate Analysis, Journal of Statistical Software US mail: 8125 Math Sciences Bldg, Box 951554, Los Angeles, CA 90095-1554 phone (310)-825-9550; fax (310)-206-5658; email: [EMAIL PROTECTED] .mac: jdeleeuw ++ aim: deleeuwjan ++ skype: j_deleeuw homepages: http://gifi.stat.ucla.edu ++ http://www.cuddyvalley.org - No matter where you go, there you are. --- Buckaroo Banzai http://gifi.stat.ucla.edu/sounds/nomatter.au __ 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, RMysql, and MySQL 5 Decimal Type Support
Hi, MySQL data type 246 is the new (as of version 5.0?) fixed precision DECIMAL type, which doesn't map to any existing R type. In most cases, I believe, it is imported as an R character vector, and you can just coerce it to numeric, i.e., to floating point precision. Next version of RMySQL will address this issue, and comments regarding what would be a suitable R type for SQL fixed DECIMALs are welcome. -- David Jason Trimble wrote: Hi, Whenever I have a MySQL query that returns a Decimal result to R I get the following warning in R: Warning message: RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1) I get this for a simple query like SELECT 2, 2.5 !! I am using: R ver 2.1.1 RMySQL ver. 0.5-7 DBI ver. 0.1-10 MySQL Ver 14.12 Distrib 5.0.18. Please Help! Jason [[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
[R] bivariate case in Local Polynomials regression
Hi: I am using the package KernSmooth to do the local polynomial regression. However, it seems the function locpoly can only deal with univariate covaraite. I wonder is there any kernel smoothing package in R can deal with bivariate covariates? I also checked the package lcofit in which function lcofit can indeed deal with bivariate case. The code below is an example from the its help document I found on http://www.locfit.info However, first, it is a local regression method. I am not sure how to specify the degree of the regression model. second, i dont know what are scale and alpha. Are they associated with the bandwidth? Thanks very much! data(ethanol) # a bivariate local regression with smaller smoothing parameter fit - locfit(NOx~E+C, data=ethanol, scale=0, alpha=0.5) plot(fit) - [[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] bivariate case in Local Polynomials regression
Hi: I am using the package KernSmooth to do the local polynomial regression. However, it seems the function locpoly can only deal with univariate covaraite. I wonder is there any kernel smoothing package in R can deal with bivariate covariates? I also checked the package lcofit in which function lcofit can indeed deal with bivariate case. The code below is an example from the its help document I found on http://www.locfit.info However, first, it is a local regression method. I am not sure how to specify the degree of the regression model. second, i dont know what are scale and alpha. Are they associated with the bandwidth? Thanks very much! data(ethanol) # a bivariate local regression with smaller smoothing parameter fit - locfit(NOx~E+C, data=ethanol, scale=0, alpha=0.5) plot(fit) - [[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] which function to use to do classification
Dear All, I have a data, suppose it is an N*M matrix data. All I want is to classify it into, let see, 3 classes. Which method(s) do you think is(are) appropriate for this purpose? Any reference will be welcome! Thanks! Best, Baoqiang Cao __ 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] which function to use to do classification
if you want to classify rows or columns, read: ?hclust ?kmeans library(cluster) ?pam Baoqiang Cao a écrit : Dear All, I have a data, suppose it is an N*M matrix data. All I want is to classify it into, let see, 3 classes. Which method(s) do you think is(are) appropriate for this purpose? Any reference will be welcome! Thanks! Best, Baoqiang Cao __ 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