Re: [R] Start Model for POLYCLASS
Dear Prof. Kooperberg, Thanks a lot for your clarification! That is very helpful. I will check out the polynomial spline functions in S-Plus that you mentioned. Best regards, -XG Su Xiaogang Su, Assistant Professor Department of Statistics and Actuarial Science University of Central Florida Orlando, FL 32816 (407) 823-2940 [O] [EMAIL PROTECTED] http://pegasus.cc.ucf.edu/~xsu/ [EMAIL PROTECTED] 07/10/06 4:01 PM That's correct. The option is not there. You can force it in a starting model - but it can still be deleted, At some stage Insightful implemented a commercial set of polynomial spline functions in S-Plus that does have that option. They got it as far as a beta-library [quoting from my own homepage http://bear.fhcrc.org/~clk]: Doug Clarkson at Insightful Corp. has implemented commercial versions of hare, heft, logspline and a variety of related methods, with lots of additional features and options. See http://www.insightful.com/downloads/libraries/default.asp. Look for S+BEST. There are remaining bugs in this code Doug Clarkson is no longer at Insightful, and the code seems to be pretty much abbandoned. Charles Quoting Xiaogang Su [EMAIL PROTECTED]: Dear Dr. Graves, Thanks for your information and kindness! I really appreciate it. According to my findings so far, POLYCLASS doesnot seem to allow for variables being forced into the model. Even the commercialized MARS doesnot have this function either. However, one ad hoc approach that they suggested is to fit linear (or logistic) model and form rediduals first and then run MARS with the residuals. Best regards, -XG Su Xiaogang Su, Assistant Professor Department of Statistics and Actuarial Science University of Central Florida Orlando, FL 32816 (407) 823-2940 [O] [EMAIL PROTECTED] http://pegasus.cc.ucf.edu/~xsu/ Spencer Graves [EMAIL PROTECTED] 7/7/2006 5:49:05 AM I have not seen a reply, so I will offer a few suggestions, even though I've never used the 'polspline' package. I scanned several of the help pages and looked in ~\library\polspline' where R is installed on my hard drive and found no further documentation, and I found nothing new from RSiteSearch(polyclass). Googling for 'polyclass' led me to http://bear.fhcrc.org/~clk/soft.html;, the home page for Charles Kooperberg, the author and maintainer. If it were my problem, I might try writing him directly at the email address given in help(package=polyclass); I'm including him as a cc on this reply. I spent time looking at this, because 'polyclass', 'polymars' and 'polspline' seem potentially related related to one of my secondary interests. Unfortunately, I couldn't find sufficient documentation to allow me to proceed with the time I felt I could afford to invest in this right now. If it were my problem, before I wrote another email about this, I'd first list the function 'polyclass', make a local copy, then work through an example line by line using 'debug(polyclass)'. This 'debug' facility is remarkably powerful and easy to use. I've solved many problems like this using 'debug' in this way. If that failed to provide the necessary enlightenment, I'd submit another post including a self-contained example based on a modification of the 'iris' example featured in the 'polyclass' help page. Your example is NOT self contained, so I would NOT use that. Using the 'iris' example would make it much easier to explain clearly what you want. It also makes it much easier for someone like me to experiment with alternatives and describe what I did in terms of a tested example. Hope this helps. p.s. I suggest you also review the posting guide! www.R-project.org/posting-guide.html. Xiaogang Su wrote: Dear all, I have a question on how to set up the starting model in POLYCLASS and make sure the terms in the starting model retained in the final POLYCLASS model. In the function POLYMARS, this can be done using the STARTMODEL option. See below for example, I started with model y= b0 + b1*X1 + b2*X2 + b3*X4 + b4*X5 + b5*X2*X5 + e m00 - matrix(c( 1, NA, 0, NA, 1, 2, NA, 0, NA, 1, 4, NA, 0, NA, 1, 5, NA, 0, NA, 1, 2, NA, 5, NA, 1),nrow = 5, ncol=5, byrow=TRUE); m2 - polymars(response=PID2$y, predictors=PID2[,1:7], startmodel=m00) summary(m2) But I could not figure out how this works for POLYCLASS. There is an option FIT in POLYCLASS, which needs to be a POLYCLASS object though. Any suggestion or information is greatly appreciated. Sincerely, Xiaogang Su Xiaogang Su, Assistant Professor Department of Statistics and Actuarial Science University of Central
[R] Tobit variance covariance matrix
Hi, How can I recover the variance-covariance matrix of the tobit model from the variance-covariance of the survreg? I first used to the survreg function and then I selected the variance matrix. However, the last parameter is log(scale) and not the variance of the standard deviation of the censored distribution as in the Tobit model. tobit- survreg(Surv(y, y 0, type ='left')~ 0+ z + vh, dist = 'gaussian'); Om - tobit$var; Thanks Leandro __ 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] move axis label text
On Mon, 10 Jul 2006, ivo welch wrote: dear R wizards: sorry, I am stumped. what is the parameter to just move the location of the x-label and y-lable (not the labels on the ticks of the x-axis and y-axis)? probably obvious, but not to me right now... regards, /iaw They are all done by par(mgp): ?title does say so. 'mgp' The margin line (in 'mex' units) for the axis title, axis labels and axis line. The default is 'c(3, 1, 0)'. -- 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] problem with install gstat package
It is -l (minus ell) not -1 (minus one) Note that without actual cut-and-paste of the output, we cannot be sure if this is the problem: this is why the posting guide asks for such details. On Mon, 10 Jul 2006, Jing Gao wrote: Hi there, I tried to install gstat package to R in Linux. I follow the instruction to use command R CMD INSTALL -1 lib pkgs. But R shows syntax error in R CMD. Can someone help me with the installation of gstat package? Thank you! Jing 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
[R] Other models of GARCH
- Find out what India is talking about on Yahoo! Answers India. ---BeginMessage--- Subject: Other models of GARCH To: R HELP r-help@stat.math.ethz.ch MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=0-1656081585-1147428333=:42419 Content-Transfer-Encoding: 8bit Content-Length: 583 --0-1656081585-1147428333=:42419 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi All, Can you please tell me whether R can handle other type GARCH models like, FIGARCH, E-GARCH, JGR-GARCH etc? Any particular help for these kind of models? Thanks, Sumanta Basak. - What makes Sachin India's highest paid sports celebrity?, Share your knowledge on Yahoo! India Answers --0-1656081585-1147428333=:42419 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi All,brCan you please tell me whether R can handle other type GARCH models like, FIGARCH, E-GARCH, JGR-GARCH etc? Any particular help for these kind of models?brbrThanks,brSumanta Basak.br p hr size=1/hr What makes Sachin India's highest paid sports celebrity?, Share your knowledge on a href=http://us.rd.yahoo.com/mail/in/mailanswers/*http://in.answers.yahoo.com/question/;_ylt=AtXFSxhGhn11UHQxOqvwPAW5HQx.?qid=1006051032399;Yahoo! India Answers/abr --0-1656081585-1147428333=:42419-- ---End Message--- __ 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] Plot Date
Hi R-Users, First of all i apologize if this is too simple for you. I want to plot an index of which i have daily data for 10 years. I want to plot specific dates in X axis, like 20/05/91 20/12/92 20/07/94 etc. and the index value in Y axis. Please suggest me. Thanks, Sumanta. - Find out what India is talking about on Yahoo! Answers India. [[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] DIfferent lengths
Dear List members, I am having a problem importing SPSS files. For some reason I do not understand, the variables in the data set come into R with different lengths, which seems to make regression analysis impossible. The strangest thing is this: it SOMETIMES work. I ran the same commands (always pasting the same thing from RWinEdt) yesterday, and, although it took a long time for R to do it (and thought it sometimes crashed in the process), it worked. Still, today, the same commands (pasted from the same RWinEdt file, using the very same SPSS files) produced this error message about different lengths. Does anyone know what the problem could be? Thanks in advance, Celso Barros [[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] Assistance with dll's to use with dyn.load
After having browsed the documentation for a while without discovering what I am looking for, maybe one of you would know ... What I want to do: I have two fortran files MC.f and ESCA.f. In MC.f there is a call to a routine called lpost. This routine (lpost) is defined (among other things) in ESCA.f. Under linux, I can do the following: R CMD SHLIB MC.f and R CMD SHLIB ESCA.f followed by dyn.load(ESCA.so,local=FALSE) dyn.load(MC.so) (see point LINUX for some more) Under windows, trying to Rcmd SHLIB MC.f will either: also compile ESCA.f and then run dlltools with ESCA.o yielding one MC.dll (if ESCA.f is in the same directory as MC.f) or fail since the symbol lpost is missing. In the first case, dyn.load(MC.dll) will then work. What I would like to have under linux: MC and ESCA turned into separate shared libraries (.so or .dll) be able to dyn.load(ESCA.so, local=FALSE); dyn.load(MC.so) ... work work work ... and then dyn.unload(ESCA.so); dyn.load(SomethingElse.so) which also contains the symbol lpost (so, I would like to unload the symbol lpost and replace it by something else) in the (good?) old times using S on unix running on a DECstation stuff like this was possible, but I never could get it working with R and linux. In windows, I would like the same operation: dyn.load(ESCA.dll); dyn.load(MC.dll) work work work and then dyn.unload(ESCA.dll); dyn.load(SomethingElse.dll) which also contains the symbol lpost is this possible? I see that the parameters local and now are ignored in dyn.load for windows but I don't grasp the full meaning. Summary questions: 1. what are the proper parameters for (Windows) Rcmd.exe SHLIB MC.f such that it does not complain about a non existing name lpost? 2. how can I unload the container of lpost such that I can replace it while R continues running (under Windows and Linux)? Sorry for lengthy explanation. Christian Ritter Senior Statistical Consultant Analytical and Statistical Services Shell Coordination Centre S.A. Monnet Centre International Laboratory, Avenue Jean Monnet 1, B-1348 Louvain-La-Neuve, Belgium Tel: +32 10 477 349 Fax: +32 10 477 219 Email: [EMAIL PROTECTED] Internet: http://www.analyticalsolutions4u.eu [[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] Second Partial Derivatives
Hello, Does R have any build-in function which allow me to count second partial derivatives numerically? RobertM [[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] Table of P values for Fisher's exact test
Hi, I have a table of observed counts for various genetic markers. Instead of doing Fisher's exact test for each marker one at a time and recording the P value manually, is there a script to go through the whole list and generate the P value column automatically? An example of my data: Counts_CHB and Counts_AA are the observed counts for one allele. 2N_CHB and 2N_AA are the total number of alleles. geneLocal_Pos 2N_CHB 2N_AA Counts_CHB Counts_AA Exact_P B2M 247590 46 0 5 B2M 353290 44 0 1 FCN2220388 46 0 1 FCN2353690 46 0 9 FCN2402784 46 0 9 FCN2403690 46 0 9 FCN2431890 46 0 9 FCN2439290 46 0 9 FCN2957590 46 0 1 __ 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] weights in glmrob
Dear List members, MY APOLOGIES IF YOU ALREADY RECEIVED THIS. A COLLEAGUE TOLD ME HE COULD NOT OPEN MY PREVIOUS MESSAGE. I am runnning a logistic regression that includes sample weights (expressed by a variable called WEIGHT) using glmob (from robustbase). My model looks like this: B12-glmrob(SERE~COMP+COM,family=binomial,weights=WEIGHT) When I include the weights, my standard error columns, as well as the p-values, show only NAs. If I exclude weights=WEIGHTS, everything works. I would like to use the weights. Does anyone know what could be the problem? Thanks in advance, Celso [[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] Table of P values for Fisher's exact test
apply(yourdata[, c(X2N_CHB,X2N_AA,Counts_CHB,Counts_AA)], 1, function(x) fisher.test(cbind(x[3:4], x[1:2]-x[3:4]))$p.value) --- Jacques VESLOT CNRS UMR 8090 I.B.L (2ème étage) 1 rue du Professeur Calmette B.P. 245 59019 Lille Cedex Tel : 33 (0)3.20.87.10.44 Fax : 33 (0)3.20.87.10.31 http://www-good.ibl.fr --- jenny tan a écrit : Hi, I have a table of observed counts for various genetic markers. Instead of doing Fisher's exact test for each marker one at a time and recording the P value manually, is there a script to go through the whole list and generate the P value column automatically? An example of my data: Counts_CHB and Counts_AA are the observed counts for one allele. 2N_CHB and 2N_AA are the total number of alleles. gene Local_Pos 2N_CHB 2N_AA Counts_CHB Counts_AA Exact_P B2M 247590 46 0 5 B2M 353290 44 0 1 FCN2 220388 46 0 1 FCN2 353690 46 0 9 FCN2 402784 46 0 9 FCN2 403690 46 0 9 FCN2 431890 46 0 9 FCN2 439290 46 0 9 FCN2 957590 46 0 1 __ 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] Coxph function
Dear Sir/Madam, My name is Sharon Mazurel and I'm busy with my final thesis about estimating the probability of the success or withdrawal of a merger or acquisition. For my model I also use duration analysis and found after doing some research that the coxph function in R is very useful. My question is: In the Surv object you have two arguments, time and event. I have two events, namely withdrawn and success. Does coxph function calculate the coefficients correctly when you put no event argument into the Surv object? Thus: Coxph(Surv(duration)~covariates,data=data) duration=duration of the deal Best regards, Sharon Mazurel - ATTENTION: The information in this electronic mail message is private and confidential, and only intended for the addressee. Should you receive this message by mistake, you are hereby notified that any disclosure, reproduction, distribution or use of this message is strictly prohibited. Please inform the sender by reply transmission and delete the message without copying or opening it. Messages and attachments are scanned for all viruses known. If this message contains password-protected attachments, the files have NOT been scanned for viruses by the ING mail domain. Always scan attachments before opening them. - [[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] Coxph
Dear all, My question is: In the Surv object you have two arguments, time and event. I have two events, namely withdrawn and success. I use no event or status argument in Surv because all my objects die in my data set. Does coxph function calculate the coefficients correctly when you put no event argument into the Surv object? Thus: Coxph(Surv(duration)~covariates,data=data) duration=duration of the deal Duration: is the time till one subject fails or succeed in my research. Can somebody help me? Best regards, Sharon Mazurel - ATTENTION: The information in this electronic mail message is private and confidential, and only intended for the addressee. Should you receive this message by mistake, you are hereby notified that any disclosure, reproduction, distribution or use of this message is strictly prohibited. Please inform the sender by reply transmission and delete the message without copying or opening it. Messages and attachments are scanned for all viruses known. If this message contains password-protected attachments, the files have NOT been scanned for viruses by the ING mail domain. Always scan attachments before opening them. - [[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] Second Partial Derivatives
Hi, [mailto:[EMAIL PROTECTED] On Behalf Of Robert Mcfadden Does R have any build-in function which allow me to count second partial derivatives numerically? library(nlme) ?fdHess I hope this is the direction you wanted to take. Best, Roland -- This mail has been sent through the MPI for Demographic Rese...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Coxph
From the help page of Surv: Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have an event. That means, you can use coxph that way, _but_ it depends on your model. Do you really want to model the time on study regardless of the kind of event? Greetings, Heinz Tüchler At 12:22 11.07.2006 +0200, [EMAIL PROTECTED] wrote: Dear all, My question is: In the Surv object you have two arguments, time and event. I have two events, namely withdrawn and success. I use no event or status argument in Surv because all my objects die in my data set. Does coxph function calculate the coefficients correctly when you put no event argument into the Surv object? Thus: Coxph(Surv(duration)~covariates,data=data) duration=duration of the deal Duration: is the time till one subject fails or succeed in my research. Can somebody help me? Best regards, Sharon Mazurel - ATTENTION: The information in this electronic mail message is private and confidential, and only intended for the addressee. Should you receive this message by mistake, you are hereby notified that any disclosure, reproduction, distribution or use of this message is strictly prohibited. Please inform the sender by reply transmission and delete the message without copying or opening it. Messages and attachments are scanned for all viruses known. If this message contains password-protected attachments, the files have NOT been scanned for viruses by the ING mail domain. Always scan attachments before opening them. - [[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] Plot Date
Try this. We first generate some test data, then we plot the data without the x axis. We generate a subset of the times consisting of a sequence of every 7 months and create an axis with that. Then we add smaller ticks every month. library(zoo) # test data x - seq(0, 10*365) z - zoo(x, as.Date(1990-01-01) + x) plot(z, xaxt = n) tt - seq(as.Date(1990-05-20), time(z)[length(z)], by = 7 months) axis(1, tt, format(tt, %d/%m/%y), cex.axis = 0.7, tcl = -0.6) tt - seq(as.Date(1990-01-20), time(z)[length(z)], by = months) axis(1, tt, FALSE, tcl = -0.3) On 7/11/06, Sumanta Basak [EMAIL PROTECTED] wrote: Hi R-Users, First of all i apologize if this is too simple for you. I want to plot an index of which i have daily data for 10 years. I want to plot specific dates in X axis, like 20/05/91 20/12/92 20/07/94 etc. and the index value in Y axis. Please suggest me. Thanks, Sumanta. - Find out what India is talking about on Yahoo! Answers India. [[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] Proportional Hazard Function and Competing risks
How can I model coxph() in combination with competing risks i.e. I have two events and for event the object will leave the data set. So : Coxph(Surv(time,event)~) the event is for all my objects 1. How can I model this? Sharon - ATTENTION: The information in this electronic mail message is private and confidential, and only intended for the addressee. Should you receive this message by mistake, you are hereby notified that any disclosure, reproduction, distribution or use of this message is strictly prohibited. Please inform the sender by reply transmission and delete the message without copying or opening it. Messages and attachments are scanned for all viruses known. If this message contains password-protected attachments, the files have NOT been scanned for viruses by the ING mail domain. Always scan attachments before opening them. - [[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] new object
Hi ! Please, how can I extract n.event and n.risk as a new object from example below ? Thanks in advance. Mauricio require(survival) fit - survfit(Surv(time, status) ~ x, data=aml) summary(fit) Call: survfit(formula = Surv(time, status) ~ x, data = aml) x=Maintained time n.risk n.event survival std.err lower 95% CI upper 95% CI 9 11 10.909 0.0867 0.75411.000 13 10 10.818 0.1163 0.61921.000 18 8 10.716 0.1397 0.48841.000 23 7 10.614 0.1526 0.37690.999 31 5 10.491 0.1642 0.25490.946 34 4 10.368 0.1627 0.15490.875 48 2 10.184 0.1535 0.03590.944 x=Nonmaintained time n.risk n.event survival std.err lower 95% CI upper 95% CI 5 12 2 0.8333 0.1076 0.64701.000 8 10 2 0.6667 0.1361 0.44680.995 12 8 1 0.5833 0.1423 0.36160.941 23 6 1 0.4861 0.1481 0.26750.883 27 5 1 0.3889 0.1470 0.18540.816 30 4 1 0.2917 0.1387 0.11480.741 33 3 1 0.1944 0.1219 0.05690.664 43 2 1 0.0972 0.0919 0.01530.620 45 1 1 0. NA NA NA [[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] new object
sum.out-summary(fit) names(sum.out) [1] surv time n.risk n.event conf.int std.err [7] lowerupperstrata call sum.out$n.risk [1] 11 10 8 7 5 4 2 12 10 8 6 5 4 3 2 1 sum.out$n.event [1] 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 cbind(sum.out$n.risk,sum.out$n.event,sum.out$strata) [,1] [,2] [,3] [1,] 1111 [2,] 1011 [3,]811 [4,]711 [5,]511 [6,]411 [7,]211 [8,] 1222 [9,] 1022 [10,]812 [11,]612 [12,]512 [13,]412 [14,]312 [15,]212 [16,]112 2006/7/11, Mauricio Cardeal [EMAIL PROTECTED]: Hi ! Please, how can I extract n.event and n.risk as a new object from example below ? Thanks in advance. Mauricio require(survival) fit - survfit(Surv(time, status) ~ x, data=aml) summary(fit) Call: survfit(formula = Surv(time, status) ~ x, data = aml) x=Maintained time n.risk n.event survival std.err lower 95% CI upper 95% CI 9 11 10.909 0.0867 0.75411.000 13 10 10.818 0.1163 0.61921.000 18 8 10.716 0.1397 0.48841.000 23 7 10.614 0.1526 0.37690.999 31 5 10.491 0.1642 0.25490.946 34 4 10.368 0.1627 0.15490.875 48 2 10.184 0.1535 0.03590.944 x=Nonmaintained time n.risk n.event survival std.err lower 95% CI upper 95% CI 5 12 2 0.8333 0.1076 0.64701.000 8 10 2 0.6667 0.1361 0.44680.995 12 8 1 0.5833 0.1423 0.36160.941 23 6 1 0.4861 0.1481 0.26750.883 27 5 1 0.3889 0.1470 0.18540.816 30 4 1 0.2917 0.1387 0.11480.741 33 3 1 0.1944 0.1219 0.05690.664 43 2 1 0.0972 0.0919 0.01530.620 45 1 1 0. NA NA NA [[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 -- 黄荣贵 Department of Sociology Fudan University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Misunderstanding with lines (or elsewhere)
Misunderstanding with lines(...) : http://7d4.com/r/ I would like the y coordinate of the horizontal line to be 1/4, and also the line to begin at x=0 and end at y=1. I'm obviously missing something ... so if anybody could help. Many thanks. test = function() { bmp('test.bmp', width=100, height=100) m = matrix(0, 2, 2) par(new=T, fig = c(0,1,0,1), mai=c(0,0,0,0), mar=c(0,0,0,0), bty='n') image(m) lines(c(0,1), c(1/4,1/4)) # horizontal line a = dev.off() } The result : http://7d4.com/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] Misunderstanding with lines (or elsewhere)
Think about the coordinate system you are using: if you don't set the margins to zero you will see what it is. I suggest you supply x and y to image() to set the coordinate system to what you want it to be. On Tue, 11 Jul 2006, [EMAIL PROTECTED] wrote: Misunderstanding with lines(...) : http://7d4.com/r/ I would like the y coordinate of the horizontal line to be 1/4, and also the line to begin at x=0 and end at y=1. And that is what you get. I'm obviously missing something ... so if anybody could help. Many thanks. test = function() { bmp('test.bmp', width=100, height=100) m = matrix(0, 2, 2) par(new=T, fig = c(0,1,0,1), mai=c(0,0,0,0), mar=c(0,0,0,0), bty='n') image(m) lines(c(0,1), c(1/4,1/4)) # horizontal line a = dev.off() } The result : http://7d4.com/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 -- 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] new object
names(summary(fit)) [1] surv time n.risk n.event conf.int std.err [7] lowerupperstrata call summary(fit)$n.risk [1] 11 10 8 7 5 4 2 12 10 8 6 5 4 3 2 1 --- Jacques VESLOT CNRS UMR 8090 I.B.L (2ème étage) 1 rue du Professeur Calmette B.P. 245 59019 Lille Cedex Tel : 33 (0)3.20.87.10.44 Fax : 33 (0)3.20.87.10.31 http://www-good.ibl.fr --- Mauricio Cardeal a écrit : Hi ! Please, how can I extract n.event and n.risk as a new object from example below ? Thanks in advance. Mauricio require(survival) fit - survfit(Surv(time, status) ~ x, data=aml) summary(fit) Call: survfit(formula = Surv(time, status) ~ x, data = aml) x=Maintained time n.risk n.event survival std.err lower 95% CI upper 95% CI 9 11 10.909 0.0867 0.75411.000 13 10 10.818 0.1163 0.61921.000 18 8 10.716 0.1397 0.48841.000 23 7 10.614 0.1526 0.37690.999 31 5 10.491 0.1642 0.25490.946 34 4 10.368 0.1627 0.15490.875 48 2 10.184 0.1535 0.03590.944 x=Nonmaintained time n.risk n.event survival std.err lower 95% CI upper 95% CI 5 12 2 0.8333 0.1076 0.64701.000 8 10 2 0.6667 0.1361 0.44680.995 12 8 1 0.5833 0.1423 0.36160.941 23 6 1 0.4861 0.1481 0.26750.883 27 5 1 0.3889 0.1470 0.18540.816 30 4 1 0.2917 0.1387 0.11480.741 33 3 1 0.1944 0.1219 0.05690.664 43 2 1 0.0972 0.0919 0.01530.620 45 1 1 0. NA NA NA [[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] Other models of GARCH
On Tue, Jul 11, 2006 at 07:41:58AM +0100, Sumanta Basak wrote: Can you please tell me whether R can handle other type GARCH models like, FIGARCH, E-GARCH, JGR-GARCH etc? Any particular help for these kind of models? Yes R (no need to quote it) can: if you provide a (log-)likelihood function, R can use its optimisers to find those parameter that maximise this likelihood. In case you really wanted to ask if these are pre-programmed for you, then the answer is no. Hth, Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ 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] --no-save and --save toggle from inside R? + BATCH stderr
thank you. exactly what I needed. can I add it as a suggestion for the next R version to add an option to quit that prints only one line to stderr (or stdout, but the real one, not the batch output one) that gives a 1-line job summary---no error (or nothing), 5 warnings, 5 warnings, fatal error: blah. except in rare circumstances, this is likely to be the user-preferred behavior. (taking a hand where I have gotten a finger---can I redefine a quit function that can invoke the original quit() with an option?) regards, /iaw __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] the problem of install Bugs package in R under linux environment
Dear All: Do you know how to install Bugs package in R under linux environment ? I try it ,but it failed to work,it seems that Bugs package just available in windows. by the way ,when will the linux version of Bugs package come out ? Thank you in advance. best regards zhijun __ 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] non positive-definite G matrix in mixed models: bootstrap?
Dear list, In a mixed model I selected I find a non positive definite random effects variance-covariance matrix G, where some parameters are estimated close to zero, and related confidence intervals are incredibly large. Since simplification of the random portion is not an option, for both interest in the parameters and significant increase in the model fit, I would like to collect unbiased random effects estimates. I used bootstrap to this purpose, creating a linear model for each cluster and bootstraping the variance of the coefficients. Is this procedure reasonable? Would it be reasonable in this case to keep the marginal portion of the mixed model? Note that in presence of positive-definite G matrix this bootstrap approach and the mixed effect model give highly similar estimates and that in the non positive-definite model the bootstrap and mixed model marginal-model estimates are highly similar as well. Thank you Bruno __ 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] Misunderstanding with lines (or elsewhere)
Prof Brian Ripley a écrit : Think about the coordinate system you are using: if you don't set the margins to zero you will see what it is. I suggest you supply x and y to image() to set the coordinate system to what you want it to be. Thank you for your answer. If I have well understood, the right way to proceed must be : test = function() { m = matrix(0, 2, 2) par(new=T, fig = c(0,1,0,1), mai=c(0,0,0,0), mar=c(0,0,0,0), bty='n') x0 = c(0.25 , 0.75) y0 = x0 image(x=x0, y=y0, z=m) lines(c(0,1), c(1/4,1/4)) # horizontal line } which seems indeed to work. Thanks. __ 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] Starting Rserve in Java using Runtime Failed
I have tried using the following piece of Java code to start Rserve on my Linux PC without success. try { String command = R CMD Rserve ; Process p = Runtime.getRuntime().exec(command); returnCode = p.waitFor(); if (returnCode != 0) { errorMessage = Unexpected return code = + returnCode; } } catch (Exception e) { errorMessage = Exception in running : + e; } I did not get any non-zero return code or error message. It works when I run 'R CMD Rserve' at the command line. My version of R is 2.2.1 and I am using Rserve v0.4-3. Thanks in advance for any assistance! Shing Home page : http://uk.geocities.com/matmsh/index.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] Two Phase Sampling
Dear WizaRds, I tried to construct a two-phase sampling design in Survey just the way I hoped understood in Vienna - I was wrong. I think I am too stupid to create the correct subset for phase 2. Phase1: Sample 1000 parts with 80 defective. Phase2: Sample 100 parts out of these 1000 with 15 defective. 0:ok, 1:defunct. The table below gives the conditional sampling values. Please help me: library(survey) ss1 - data.frame(id=1:1000, ph1.x=rep(c(1,0),c(10,990)), subset=rep(c(1,0),c(100,900)), ph2.y=rep(c(1,0,NA),c(15,85,900)), n1=rep(1000,1000), n2=rep(100,1000) ) table(ss1$ph1.y, ss1$ph2.x) Phase1.x Phase2.y 0 1 0 85 0 1 5 10 p2 - twophase(id=list(~id,~id), strata=list(NULL,NULL), data=ss1, subset=~subset, fpc=list(~n1,~n2)) svymean (~ph2.y, design=p2s) mean SE ph2.y 0.15 0 However, taking into consideration the 2nd sample, the estimator should be: ph1.x.bar (phase1)=80/1000=0.08 and ph2.y.bar (phase2)=15/100=0.15 defect boards, that means y.est=1.5*0.08=0.12 defect boards, since the RATIO ESTIMATOR equals 15/10=1.5 defect parts for the ratio of defect ph2/defect ph1. What again did I do wrong? I am positive that the estimator is 12 defective parts per 100 average, so how do I correctly construct the twophase design? ps: I hope this is not sthg. undergraduates master eloquently... Thank you so much for your help. I invite you to all the BBQ and beer there is in Europe! Yours always mark __ 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
Please, is there any R-list about survival package ? Thanks Mauricio __ 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] --no-save and --save toggle from inside R? + BATCH stderr
the following diff to the shell script invoking R prints an error message if R terminates with an error code: 112c112,119 exec sh ${R_HOME}/bin/Rcmd [EMAIL PROTECTED] ;; --- sh ${R_HOME}/bin/Rcmd [EMAIL PROTECTED] rc=$? if [ $rc -ne 0 ]; then shift ; echo [EMAIL PROTECTED]: Error Return Code: $rc fi exit $? ;; regards, /iaw __ 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] --no-save and --save toggle from inside R? + BATCH stderr
ivo welch wrote: the following diff to the shell script invoking R prints an error message if R terminates with an error code: 112c112,119 exec sh ${R_HOME}/bin/Rcmd [EMAIL PROTECTED] ;; --- sh ${R_HOME}/bin/Rcmd [EMAIL PROTECTED] rc=$? if [ $rc -ne 0 ]; then shift ; echo [EMAIL PROTECTED]: Error Return Code: $rc fi exit $? ;; This looks to me like a good suggestion, but I generally don't make modifications to platform-specific things on platforms I don't use, so I'd suggest posting this to R-devel or on the bug list as a wishlist item. Otherwise it might get lost. 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] non positive-definite G matrix in mixed models: bootstrap?
There is a paper by Rogosa and Saner which shows some equivalences in what you are doing under certain conditions. They show similarities between bootstrapping with linear models and how the estimates might be similar to those obtained from a mixed model. Rogosa, D. R., and Saner, H. M. (1995). Longitudinal data analysis examples with random coefficient models. Journal of Educational and Behavioral Statistics, 20, 149-170. Harold -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bruno L. Giordano Sent: Tuesday, July 11, 2006 9:31 AM To: r-help@stat.math.ethz.ch Subject: [R] non positive-definite G matrix in mixed models: bootstrap? Dear list, In a mixed model I selected I find a non positive definite random effects variance-covariance matrix G, where some parameters are estimated close to zero, and related confidence intervals are incredibly large. Since simplification of the random portion is not an option, for both interest in the parameters and significant increase in the model fit, I would like to collect unbiased random effects estimates. I used bootstrap to this purpose, creating a linear model for each cluster and bootstraping the variance of the coefficients. Is this procedure reasonable? Would it be reasonable in this case to keep the marginal portion of the mixed model? Note that in presence of positive-definite G matrix this bootstrap approach and the mixed effect model give highly similar estimates and that in the non positive-definite model the bootstrap and mixed model marginal-model estimates are highly similar as well. Thank you Bruno __ 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] Proportional Hazard Function and Competing risks
Maybe you find that thread helpful: http://tolstoy.newcastle.edu.au/R/help/00b/1426.html Heinz At 12:59 11.07.2006 +0200, [EMAIL PROTECTED] wrote: How can I model coxph() in combination with competing risks i.e. I have two events and for event the object will leave the data set. So : Coxph(Surv(time,event)~) the event is for all my objects 1. How can I model this? Sharon - ATTENTION: The information in this electronic mail message is private and confidential, and only intended for the addressee. Should you receive this message by mistake, you are hereby notified that any disclosure, reproduction, distribution or use of this message is strictly prohibited. Please inform the sender by reply transmission and delete the message without copying or opening it. Messages and attachments are scanned for all viruses known. If this message contains password-protected attachments, the files have NOT been scanned for viruses by the ING mail domain. Always scan attachments before opening them. - [[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] Second Partial Derivatives
If you'd like to have accurate second derivatives, then check out the numDeriv package, and in particular, the function hessian. The derivatives are based on Richardson extrapolation, and can be evaluated to a very high degree of accuracy. Ravi. -- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -- -Original Message- From: [EMAIL PROTECTED] [mailto:r-help- [EMAIL PROTECTED] On Behalf Of Rau, Roland Sent: Tuesday, July 11, 2006 6:44 AM To: Robert Mcfadden; r-help@stat.math.ethz.ch Subject: Re: [R] Second Partial Derivatives Hi, [mailto:[EMAIL PROTECTED] On Behalf Of Robert Mcfadden Does R have any build-in function which allow me to count second partial derivatives numerically? library(nlme) ?fdHess I hope this is the direction you wanted to take. Best, Roland -- This mail has been sent through the MPI for Demographic Rese...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] help on Rserve
Dear All, I'm calling R functions from Java by using Rserve, There is an exemple about dislay graphics in Java, this exemple is very difficult for me, I don't understand it... Could someone give me a simple example What I want is putting the graphe in a file to display it after that in a browser.. Thank you in advance XENA - [[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] Misunderstanding with lines (or elsewhere)
On Tue, 2006-07-11 at 15:39 +0200, [EMAIL PROTECTED] wrote: Prof Brian Ripley a écrit : Think about the coordinate system you are using: if you don't set the margins to zero you will see what it is. I suggest you supply x and y to image() to set the coordinate system to what you want it to be. Thank you for your answer. If I have well understood, the right way to proceed must be : test = function() { m = matrix(0, 2, 2) par(new=T, fig = c(0,1,0,1), mai=c(0,0,0,0), mar=c(0,0,0,0), bty='n') x0 = c(0.25 , 0.75) y0 = x0 image(x=x0, y=y0, z=m) lines(c(0,1), c(1/4,1/4)) # horizontal line } which seems indeed to work. Thanks. You could swap the line: lines(c(0,1), c(1/4, 1/4)) with: abline(h = 0.25) Does the same thing but is more readable IMHO. Also, I get a warning with your code if no plot is open: Warning message: calling par(new=) with no plot To stop this, drop the new = T (sic) in the call to par. Also, don't use T when you mean TRUE. So, in summary this seems to do the same thing as your function: test = function() { m = matrix(0, 2, 2) par(fig = c(0,1,0,1), mai=c(0,0,0,0), mar=c(0,0,0,0), bty='n') x0 = c(0.25 , 0.75) y0 = x0 image(x=x0, y=y0, z=m) abline(h = 0.25) } HTH, G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/ London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] --no-save and --save toggle from inside R? + BATCH stderr
This sort of thing is contrary to the Unix spirit. It gives the user no choice but to be told that there is a non-zero error code, whereas it is really easy for the user to wrap the command in his/her own script that reports the error code in whatever form is desired. The Unix idea is to think about combining things from your toolkit, not complicate the tools with endless options (and this would have to be made optional as I for one don't want it). Assuming you are concerned with user errors and not those deep in R, you can use R's own error-handling system to set the error status anyway, and report as wanted. On Tue, 11 Jul 2006, Duncan Murdoch wrote: ivo welch wrote: the following diff to the shell script invoking R prints an error message if R terminates with an error code: 112c112,119 exec sh ${R_HOME}/bin/Rcmd [EMAIL PROTECTED] ;; --- sh ${R_HOME}/bin/Rcmd [EMAIL PROTECTED] rc=$? if [ $rc -ne 0 ]; then shift ; echo [EMAIL PROTECTED]: Error Return Code: $rc fi exit $? ;; This looks to me like a good suggestion, but I generally don't make modifications to platform-specific things on platforms I don't use, so I'd suggest posting this to R-devel or on the bug list as a wishlist item. Otherwise it might get lost. 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
[R] Multiple tests on 2 way-ANOVA
Dear r-helpers, I have a question about multiple testing. Here an example that puzzles me: All matrixes and contrast vectors are presented in treatment contrasts. 1. example: library(multcomp) n-60; sigma-20 # n = sample size per group # sigma standard deviation of the residuals cov1 - matrix(c(3/4,-1/2,-1/2,-1/2,1,0,-1/2,0,1), nrow = 3, ncol=3, byrow=TRUE, dimnames = list(c(A, B, C), c(C.1, C.2, C.3))) # cov1 = variance covariance matrix of the beta coefficients of a # 2x2 factorial design (see Piantadosi 2005, p. 509) cm1 - matrix(c(0, 1, 0, 0, 0, 1), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c(A, B), c(C.1, C.2, C.3))) # cm1 = contrast matrix for main effects v1 - csimint(estpar=c(100, 6, 5), df=4*n-3, covm=cov1*sigma^2/n, cmatrix=cm1, conf.level=0.95) summary(v1) The adjusted p-values are almost the Bonferroni p-values. If I understood right: You need not to adjust for multiple testing on main effects in a 2x2 factorial design assuming the absence of interaction. I do not think that there is a bug, I want to understand, why multcomp does adjust for multiple tests having all information about the design of the trial (variance covariance matrix)? Or do I have to introduce somehow more information? 2. example: And I have second question: How do I proper correct for multiple testing if I want to estimate in the presence of interaction the two average main effects. Can some one point me to some literature where I can learn these things? Here the example, 2x2 factorial with interaction, estimation of average main effects: cov2 - matrix( c(1,-1,-1, 1, -1, 2, 1,-2, -1, 1, 2,-2, 1,-2,-2, 4) , nrow=4, ncol=4, byrow=TRUE) cm2 - matrix(c(0, 1, 0, 1/2, 0, 0, 1, 1/2), nrow = 2, ncol=4, byrow=TRUE, dimnames = list(c(A, B), c(C.1, C.2, C.3, C.4))) v2 - csimint(estpar=c(100, 6, 5, 2), df=4*n-4, covm=cov2*sigma^2/n, cmatrix=cm2, conf.level=0.95) summary(v2) I do not believe that this is the most efficient way for doing this, since I made already bad experience with the first example. My R.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] Proportional Hazard Function and Competing risks
On Tue, 11 Jul 2006, [EMAIL PROTECTED] wrote: How can I model coxph() in combination with competing risks i.e. I have two events and for event the object will leave the data set. So : Coxph(Surv(time,event)~) the event is for all my objects 1. How can I model this? There is nothing built in. Some proposals for competing risks analysis involve Cox models and generalized linear models and so can be implemented in R. It depends on what you want to do -- there isn't a standard solution because a lot of what people want to do with competing risks is provably impossible. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Error With TIFF of Plots
All, I am using R on Mac OS X Tiger. I have assembled some graphs through quartz and cut and pasted them into MSWord files on my Mac. I then emailed the Word document containing the graphs to a Windows computer. Upon opening the document, I received an error message telling me that the graphics could not be compressed. Is there a way that I can have r create the images in JPEG or another format so that I can cut and paste them into Word and view them on both Mac and Windows platforms. THank you. jdr [[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] storing the estimates from lmer
Dear all, I'm trying to store/extract the mean standard error of the fixed effects parameter and the variance of the random effects parameter from lmer procedure from mlmre4 package developed by bates n pinheiro. while storing fixed effects parameter is straight forward, the same is not true for storing the variance parameter of the random effects. kindly help me ~prabhu [[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] Proportional Hazard Function and Competing risks
Hi, If you are interested in building regression models for the sub-distribution functions (or cumulative incidence function), then you may want to look at the cmprsk package by Gray. It is based on the article: Fine and Gray (JASA 1999). There is also the approach based on multi-state models (see the work of the Danish group led by Andersen) for modeling state probabilities. If you are interested only in the cause-specific hazard models, then you don't need anything other than the standard Cox relative risk model or something like that, where events from other causes are simply treated as censoring. If, however, you are interested in the net hazard or net probabilities, then you enter the dangerous and highly controversial realm of the classical competing risk problem. You have to overcome a lot of conceptual, philosophical, and statistical (e.g. identifiability) issues, before attempting to model it using latent failure time models. For a cogent critique of this approach, see Prentice et al. (Biometrics 1978). Crowder's (2001) book presents a somewhat more pragmatic view of the classical competing risks problem. Hope this helps, Ravi. -- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -- -Original Message- From: [EMAIL PROTECTED] [mailto:r-help- [EMAIL PROTECTED] On Behalf Of Thomas Lumley Sent: Tuesday, July 11, 2006 10:56 AM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Proportional Hazard Function and Competing risks On Tue, 11 Jul 2006, [EMAIL PROTECTED] wrote: How can I model coxph() in combination with competing risks i.e. I have two events and for event the object will leave the data set. So : Coxph(Surv(time,event)~) the event is for all my objects 1. How can I model this? There is nothing built in. Some proposals for competing risks analysis involve Cox models and generalized linear models and so can be implemented in R. It depends on what you want to do -- there isn't a standard solution because a lot of what people want to do with competing risks is provably impossible. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ 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] storing the estimates from lmer
You need the VarCorr function. I think you mean that lmer is in the Matrix package. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of prabhu bhaga Sent: Tuesday, July 11, 2006 11:19 AM To: r-help@stat.math.ethz.ch Subject: [R] storing the estimates from lmer Dear all, I'm trying to store/extract the mean standard error of the fixed effects parameter and the variance of the random effects parameter from lmer procedure from mlmre4 package developed by bates n pinheiro. while storing fixed effects parameter is straight forward, the same is not true for storing the variance parameter of the random effects. kindly help me ~prabhu [[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] Question on partial effect
Dear all, I don't know what's my question is called. I have a performance variable A, such as sales. And I have another variable B, let's say establish time of firm. I want to create the third variable that is sales without the effect of establish time. Maybe it can be called partial effect problem. I'm not sure. Does anyone have any suggestion? Thank you in advance! All the best, Wei-Wei __ 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] tcltk: help pop-up
Hi all; Please, does anyone have a piece of R-tcltk code that includes a help pop-up for any item and could send it as an example? thanks and best regards, Javier -- Javier García-Pintado Institute of Earth Sciences Jaume Almera (CSIC) Lluis Sole Sabaris s/n, 08028 Barcelona Phone: +34 934095410 Fax: +34 934110012 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] DIfferent lengths
__ 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] problem of fixed-formated output using sprintf
Dear R users: I'm trying to generate a output file with fixed format using function sprintf in R. However, the execution time in R is very long even the toy data (smaller size df) seems to work fine. The syntax that I used is as follows: df.fmt - sprintf(%2s%2s%2.4f, df$v1, df$v2, df$v3) write.table(df.fmt, output.name,...) The actual dataset is a df with the dimention of 67944 by 34. I'm wondering whether there is an elegant way of doing it. I would like output in a txt file. Many thanks. Yihsu Chen The Johns Hopkins University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Date Format
Hi everybody, I need your precious help for, I think, a simple request, but I do not manage to solve this. When I use a table function with dates in the rows, the rows are coerced to number after the table function. So I need to transform the row names into date format. But I do not manage. Therefore, for an example, I manage to write this : datetest-06/01/2001 datetest-as.Date(datetest,%d/%m/%Y) datetest-as.numeric(datetest) to get 11328. But I do not obtain the inverse tranformation : datetest-as.Date(datetest,%d/%m/%Y) How do we get this please ? Thanks a lot for your solution. Pierre. [[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] Question on partial effect
Thank you, Gavin. I think that might be what I need. But I'm a little bit wandering what's the scale of resid(mod). Is it scale(dist)/scale(speed), for example kilometer / (kilometer per hour)? or something else? Thank you very much! Wei-Wei 2006/7/12, Gavin Simpson [EMAIL PROTECTED]: On Tue, 2006-07-11 at 23:51 +0800, Guo Wei-Wei wrote: Dear all, I don't know what's my question is called. I have a performance variable A, such as sales. And I have another variable B, let's say establish time of firm. I want to create the third variable that is sales without the effect of establish time. Maybe it can be called partial effect problem. I'm not sure. Does anyone have any suggestion? Thank you in advance! All the best, Wei-Wei Do you mean? ## dummy data A - rnorm(100) B - rnorm(100) C - resid(lm(A ~ B)) C now contains the residual variation in A after fitting B. e.g. with some real data ?cars data(cars) # not sure this is needed now, I forget mod - lm(dist ~ speed, data = cars) summary(mod) partial - resid(mod) ## check mod2 - lm(dist ~ partial, data = cars) summary(mod2) ## from the two R^2 form mod1 and mod2 - partial contains dist minus ## the effects of speed 0.6511 + 0.3489 [1] 1 HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/ London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] Date Format
Try this: library(zoo) as.Date(11328) See the Help Desk article in R News 4/1 for more on dates. On 7/11/06, pierre clauss [EMAIL PROTECTED] wrote: Hi everybody, I need your precious help for, I think, a simple request, but I do not manage to solve this. When I use a table function with dates in the rows, the rows are coerced to number after the table function. So I need to transform the row names into date format. But I do not manage. Therefore, for an example, I manage to write this : datetest-06/01/2001 datetest-as.Date(datetest,%d/%m/%Y) datetest-as.numeric(datetest) to get 11328. But I do not obtain the inverse tranformation : datetest-as.Date(datetest,%d/%m/%Y) How do we get this please ? Thanks a lot for your solution. Pierre. [[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] storing the estimates from lmer
On 7/11/06, Doran, Harold [EMAIL PROTECTED] wrote: You need the VarCorr function. I think you mean that lmer is in the Matrix package. Currently lmer is in the Matrix package. The plan is to move it back to the lme4 package when interpackage linking has been added to R - perhaps as early as the release of R-2.4.0. Because the lme4 package automatically loads the Matrix package it is safest to act as if lmer actually resided in the lme4 package and use library(lme4) fm1 - lmer(... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of prabhu bhaga Sent: Tuesday, July 11, 2006 11:19 AM To: r-help@stat.math.ethz.ch Subject: [R] storing the estimates from lmer Dear all, I'm trying to store/extract the mean standard error of the fixed effects parameter and the variance of the random effects parameter from lmer procedure from mlmre4 package developed by bates n pinheiro. while storing fixed effects parameter is straight forward, the same is not true for storing the variance parameter of the random effects. kindly help me ~prabhu [[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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem of fixed-formated output using sprintf
Are you sure it is the sprintf vs. write.table? I constructed a dataframe of your size and it took less than 1 second to do the sprintf: system.time(df.fmt - sprintf(%2s%2s%4.2f, df$V1, df$V2, df$V3)) [1] 0.70 0.00 0.73 NA NA str(df) `data.frame': 67944 obs. of 34 variables: $ V1 : chr 0.2655 0.3721 0.5729 0.9082 ... $ V2 : chr 0.2655 0.3721 0.5729 0.9082 ... $ V3 : num 0.0642 0.5316 0.5466 0.2798 0.4931 ... $ V4 : num 0.8430 0.8279 0.1552 0.5153 0.0725 ... $ V5 : num 0.922 0.780 0.811 0.847 0.223 ... If you want to write this string out to a file, then use 'cat'. If you add '\n' to the sprintf, you will get something like this: cat(df.fmt[1:5]) 0.26550.26550.06 0.37210.37210.53 0.57290.57290.55 0.90820.90820.28 0.20170.20170.49 On 7/11/06, YIHSU CHEN [EMAIL PROTECTED] wrote: Dear R users: I'm trying to generate a output file with fixed format using function sprintf in R. However, the execution time in R is very long even the toy data (smaller size df) seems to work fine. The syntax that I used is as follows: df.fmt - sprintf(%2s%2s%2.4f, df$v1, df$v2, df$v3) write.table(df.fmt, output.name,...) The actual dataset is a df with the dimention of 67944 by 34. I'm wondering whether there is an elegant way of doing it. I would like output in a txt file. Many thanks. Yihsu Chen The Johns Hopkins University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jim Holtman Cincinnati, OH +1 513 646 9390 (Cell) +1 513 247 0281 (Home) What is the problem you are trying to solve? [[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] Date Format
Try structure(11328, class = Date) or just class(datetest) - Date -roger pierre clauss wrote: Hi everybody, I need your precious help for, I think, a simple request, but I do not manage to solve this. When I use a table function with dates in the rows, the rows are coerced to number after the table function. So I need to transform the row names into date format. But I do not manage. Therefore, for an example, I manage to write this : datetest-06/01/2001 datetest-as.Date(datetest,%d/%m/%Y) datetest-as.numeric(datetest) to get 11328. But I do not obtain the inverse tranformation : datetest-as.Date(datetest,%d/%m/%Y) How do we get this please ? Thanks a lot for your solution. Pierre. [[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 D. Peng | http://www.biostat.jhsph.edu/~rpeng/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Question on partial effect
On Wed, 2006-07-12 at 00:51 +0800, Guo Wei-Wei wrote: Thank you, Gavin. I think that might be what I need. But I'm a little bit wandering what's the scale of resid(mod). Is it scale(dist)/scale(speed), for example kilometer / (kilometer per hour)? or something else? Thank you very much! Wei-Wei The scale of dist - they are just the differences between observed dist and fitted dist (based on speed). mod - lm(dist ~ speed, data = cars) resid(mod) 1 2 3 4 5 3.849460 11.849460 -5.947766 12.052234 2.119825 6 7 8 9 10 -7.812584 -3.744993 4.255007 12.255007 -8.677401 # visualise the residuals plot(resid(mod) ~ dist, data = cars) abline(h = 0, col = grey) ## length of blue line represents the residual lines(cars$dist, resid(mod), type = h, col = blue) So you see that for the 1st residual it is 3.849 ft (the distances are measured in feet, see ?cars) Does this help? G 2006/7/12, Gavin Simpson [EMAIL PROTECTED]: On Tue, 2006-07-11 at 23:51 +0800, Guo Wei-Wei wrote: Dear all, I don't know what's my question is called. I have a performance variable A, such as sales. And I have another variable B, let's say establish time of firm. I want to create the third variable that is sales without the effect of establish time. Maybe it can be called partial effect problem. I'm not sure. Does anyone have any suggestion? Thank you in advance! All the best, Wei-Wei Do you mean? ## dummy data A - rnorm(100) B - rnorm(100) C - resid(lm(A ~ B)) C now contains the residual variation in A after fitting B. e.g. with some real data ?cars data(cars) # not sure this is needed now, I forget mod - lm(dist ~ speed, data = cars) summary(mod) partial - resid(mod) ## check mod2 - lm(dist ~ partial, data = cars) summary(mod2) ## from the two R^2 form mod1 and mod2 - partial contains dist minus ## the effects of speed 0.6511 + 0.3489 [1] 1 HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/ London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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 -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/ London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] Query about getting averages across a certain parameter in a table
Hi I have a table that goes data cluster_ac clockrate age class 7337 0.9 0.001 alpha_proteins 7888 0.1 0.78 beta proteins etc The class column can have 7-8 different unique values While the clockrate and age columns are floats varying from 0 to 1. I wish to get the average clockrate across each of the classes for this data. I would appreciate your help regarding the aboe. Thanks Lalitha __ 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] detach
We try the following: search() as.Date(1) zoo:::as.Date.numeric under three circumstances: 1. on a fresh session 2. after issuing library(zoo) noting that as.Date.numeric is provided by zoo 3. after detaching zoo as.Date(1) fails on #1 but succeeds in #2 and #3. Should it not fail in #3 since zoo was detached? Is this how its supposed to work? (Note that entering zoo:::as.Date.numeric at the console succeeds in displaying the function in all three cases.) Here is the console session: R.version.string # XP [1] Version 2.3.1 Patched (2006-06-04 r38279) search() [1] .GlobalEnvpackage:methods package:stats [4] package:graphics package:grDevices package:utils [7] package:datasets Autoloads package:base as.Date(1) Error in as.Date.default(1) : do not know how to convert '1' to class Date zoo:::as.Date.numeric function (x, ...) structure(floor(x + 0.001), class = Date) environment: namespace:zoo library(zoo) search() [1] .GlobalEnvpackage:zoo package:methods [4] package:stats package:graphics package:grDevices [7] package:utils package:datasets Autoloads [10] package:base as.Date(1) [1] 1970-01-02 zoo:::as.Date.numeric function (x, ...) structure(floor(x + 0.001), class = Date) environment: namespace:zoo detach() search() [1] .GlobalEnvpackage:methods package:stats [4] package:graphics package:grDevices package:utils [7] package:datasets Autoloads package:base as.Date(1) [1] 1970-01-02 zoo:::as.Date.numeric function (x, ...) structure(floor(x + 0.001), class = Date) environment: namespace:zoo __ 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 newbie: logical subsets
Hello! I'm a newcomer to R hoping to replace some convoluted database code with an R script. Unfortunately, I haven't been able to figure out how to implement the following logic. Essentially, we have a database of transactions that are coded with a geographic locale and a type. These are being loaded into a data.frame with named variables city, type, and price. E.g., trans$city and all that. We want to calculate mean prices by city and type, AFTER excluding outliers. That is, we want to calculate the mean price in 3 steps: 1. calculate a mean and standard deviation by city and type over all transactions 2. create a subset of the original data frame, excluding transactions that differ from the relevant mean by more than 2 standard deviations 3. calculate a final mean by city and type based on this subset. I'm stuck on step 2. I would like to do something like the following: fs - list(factor(trans$city), factor(trans$type)) means - tapply(trans$price, fs, mean) stdevs - tapply(trans$price, fs, sd) filter - abs(trans$price - means[trans$city, trans$type]) 2*stdevs[trans$city, trans$type] sub - subset(trans, filter) The above code doesn't work. What's the correct way to do this? Thanks, Josh __ 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 newbie: logical subsets
Try this, using the built in anscombe data set: anscombe[!rowSums(abs(scale(anscombe)) 2),] On 7/11/06, Joshua Tokle [EMAIL PROTECTED] wrote: Hello! I'm a newcomer to R hoping to replace some convoluted database code with an R script. Unfortunately, I haven't been able to figure out how to implement the following logic. Essentially, we have a database of transactions that are coded with a geographic locale and a type. These are being loaded into a data.frame with named variables city, type, and price. E.g., trans$city and all that. We want to calculate mean prices by city and type, AFTER excluding outliers. That is, we want to calculate the mean price in 3 steps: 1. calculate a mean and standard deviation by city and type over all transactions 2. create a subset of the original data frame, excluding transactions that differ from the relevant mean by more than 2 standard deviations 3. calculate a final mean by city and type based on this subset. I'm stuck on step 2. I would like to do something like the following: fs - list(factor(trans$city), factor(trans$type)) means - tapply(trans$price, fs, mean) stdevs - tapply(trans$price, fs, sd) filter - abs(trans$price - means[trans$city, trans$type]) 2*stdevs[trans$city, trans$type] sub - subset(trans, filter) The above code doesn't work. What's the correct way to do this? Thanks, Josh __ 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] script problem to obtain pairs of overlap values
Dear, I wrote a code to estimate the overlap between two kernel distributions. The script must estimates the overlap among each columns of data frame. With S sampled species (columns) in my data frame, I want obtain S(S-1)/2 pairs of overlap values between species. However, the code is not well write at all (only an overlap value is produced) and I can't find the solution. To illustrate the calculations, I use the data frame tdon and the value of the bandwidth h, which was estimated in other part of script. tdon - data.frame (sp.1=c (5 ,9 ,NA ,5, 11) , sp.2=c (4, 2, 4, NA, 11, ),sp.3=c(5, 4, 2, 6, 13), sp.4=c(3 , 11, NA, 5, 3), sp.5=c(2 ,5 ,2, 9, 9)) h [1] 1.047 2.973 0.887 1.520 2.955 Here is the code: for (i in 1:(nbcol-1)) # nbcol-ncol(tdon) {tdon1-tdon[,i] tdon11- subset(tdon1,tdon1!=NA) fctk1-function(x) {density (tdon11, bw=h[i], kernel=gaussian)$y} for (j in (i+1):nbcol) {tdon2-tdon[,j] tdon21- subset(tdon2,tdon2!=NA) fctk2-function(x) {density (tdon21, bw=h[j], kernel=gaussian)$y} diffctk-function(x) {abs(fctk1(x)-fctk2(x))} intctk- approxfun (diffctk(x), rule=2) int- integrate(diffctk,-Inf,Inf)$value overlap- 1 - 0.5* int } } The use of approxfun to integrate the difference in the estimated density values (my diffctk function) was suggested by Thomas Lumley, but I'm not sure that I have found the solution or if this solution is correct for my problem. I need that the overlap produce a vector with the length equal to 10, with all pairs of overlap values. Any help or advice on improvement for this code will be appreciated. With kind regards, Rogério __ 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] (no subject)
Dear R-users prob - c(0.5,0.4,0.3,0.1,0.0) cal - prob * log(prob,base=2) cal [1] -0.500 -0.5287712 -0.5210897 -0.3321928NaN Is there any way to change NaN to zero ? Thank you Taka __ 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] (no subject)
Well, it's a little inelegant, but since the amount of information is the same in events that are certain to occur and certain not to occur, you could add the line prob[prob==0] - 1 after you set up the prob vector, which would take care of the problem. Ben Fairbank -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Taka Matzmoto Sent: Tuesday, July 11, 2006 2:26 PM To: r-help@stat.math.ethz.ch Subject: [R] (no subject) Dear R-users prob - c(0.5,0.4,0.3,0.1,0.0) cal - prob * log(prob,base=2) cal [1] -0.500 -0.5287712 -0.5210897 -0.3321928NaN Is there any way to change NaN to zero ? Thank you Taka __ 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] August R/Splus course @ 5 locations *** R/Splus Fundamentals and Programming Techniques
__ 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] 0* log(0) should be zero but NaN
Dear R-users prob - c(0.5,0.4,0.3,0.1,0.0) cal - prob * log(prob,base=2) cal [1] -0.500 -0.5287712 -0.5210897 -0.3321928NaN Is there any way to change NaN to zero ? I did come up with this by applying Ripley's relpy to my previous question cal -prob*log(pmax(prob,0.0001),base=2) Any suggestion ? Thank you Taka __ 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] generating clustered data
Hello R folks, Does anybody have code to share for generating (via simulation) clustered data? The type of data I am looking to simulate would allow fitting of a multilevel model with random intercepts. I looked at the mvtnorm package but am not quite sure how to create clusters. (Can this be done by simply changing the seed?) If somebody could point me where to look for the relevant code or perhaps send some sample code, that would be great. Thanks, Brian __ 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] use of NULL environment is deprecated?
] version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) I see in the NEWS file the line: o Use of NULL as an environment is deprecated and gives a warning. Which duly happens. I get warnings like this: Warning message: use of NULL environment is deprecated My problem is that I don't know what is being referred to. A little birdie tells me that in later versions of R, those warnings will become errors so I need to work out where they're coming from before I can use later versions. My question is: How does one work out which is being referred to by such a message? The traceback() function is useful when failure occurs. Is there an analagous way of looking into warnings? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] use of NULL environment is deprecated?
On 7/11/2006 6:27 PM, Patrick Connolly wrote: ] version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) I see in the NEWS file the line: o Use of NULL as an environment is deprecated and gives a warning. Which duly happens. I get warnings like this: Warning message: use of NULL environment is deprecated My problem is that I don't know what is being referred to. A little birdie tells me that in later versions of R, those warnings will become errors so I need to work out where they're coming from before I can use later versions. My question is: How does one work out which is being referred to by such a message? The traceback() function is useful when failure occurs. Is there an analagous way of looking into warnings? options(warn=2) will convert warnings into errors, so traceback will work. A common situation where I've seen that error is with binary saves from earlier versions of R being loaded into current versions. For example, if you installed a package before, but didn't re-install it with 2.3.1, or if you are reloading a workspace saved in an earlier version. 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] use of NULL environment is deprecated?
Patrick Connolly wrote: ] version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) I see in the NEWS file the line: o Use of NULL as an environment is deprecated and gives a warning. Which duly happens. I get warnings like this: Warning message: use of NULL environment is deprecated My problem is that I don't know what is being referred to. A little birdie tells me that in later versions of R, those warnings will become errors so I need to work out where they're coming from before I can use later versions. My question is: How does one work out which is being referred to by such a message? The traceback() function is useful when failure occurs. Is there an analagous way of looking into warnings? TIA Hi, Patrick, This will happen when you load a package that was created for an earlier version of R. If this is your own package, recreate the package using R-2.3.1. If it's a package on CRAN, then update.packages() should also do the trick. HTH, --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
Re: [R] 0* log(0) should be zero but NaN
prob - c(0.5,0.4,0.3,0.1,0.0) cal - prob * log(prob,base=2) cal [1] -0.500 -0.5287712 -0.5210897 -0.3321928NaN cal[is.nan(cal)] - 0 cal [1] -0.500 -0.5287712 -0.5210897 -0.3321928 0.000 On 7/11/06, Taka Matzmoto [EMAIL PROTECTED] wrote: Dear R-users prob - c(0.5,0.4,0.3,0.1,0.0) cal - prob * log(prob,base=2) cal [1] -0.500 -0.5287712 -0.5210897 -0.3321928NaN Is there any way to change NaN to zero ? I did come up with this by applying Ripley's relpy to my previous question cal -prob*log(pmax(prob,0.0001),base=2) Any suggestion ? Thank you Taka __ 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 -- Jim Holtman Cincinnati, OH +1 513 646 9390 (Cell) +1 513 247 0281 (Home) What is the problem you are trying to solve? [[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] use of NULL environment is deprecated?
On Tue, 11-Jul-2006 at 06:41PM -0400, Duncan Murdoch wrote: [] | | options(warn=2) will convert warnings into errors, so traceback will work. | | A common situation where I've seen that error is with binary saves from | earlier versions of R being loaded into current versions. For example, | if you installed a package before, but didn't re-install it with 2.3.1, | or if you are reloading a workspace saved in an earlier version. Thank you for the explanation. In this case, it's the latter reason: the workspace comes from a different computer as well as a different version of R. Will saving the objects anew overcome the problem? (Thanks Sundar also.) -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Query about getting averages across a certain parameter in a table
x - + cluster_ac clockrate age class + 7337 0.19 0.001 alpha_proteins + 7888 0.21 0.78 beta_proteins + 7337 0.39 0.001 alpha_proteins + 7888 0.41 0.78 beta_proteins + 7337 0.59 0.001 alpha_proteins + 7888 0.61 0.78 beta_proteins + 7337 0.97 0.001 alpha_proteins + 7888 0.81 0.78 beta_proteins + 7337 0.99 0.001 alpha_proteins + 7888 0.1 0.78 beta_proteins + df - read.table(textConnection(x), header=TRUE) tapply(df$clockrate, df$class, mean) alpha_proteins beta_proteins 0.626 0.428 On 7/11/06, lalitha viswanath [EMAIL PROTECTED] wrote: Hi I have a table that goes data cluster_ac clockrate age class 7337 0.9 0.001 alpha_proteins 7888 0.1 0.78 beta proteins etc The class column can have 7-8 different unique values While the clockrate and age columns are floats varying from 0 to 1. I wish to get the average clockrate across each of the classes for this data. I would appreciate your help regarding the aboe. Thanks Lalitha __ 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 -- Jim Holtman Cincinnati, OH +1 513 646 9390 (Cell) +1 513 247 0281 (Home) What is the problem you are trying to solve? [[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] generating clustered data
Brian, What about creating the covariance matrix with the help of the kronecker product? For instance, suppose your intercepts are ~ N(0,var1) and your residual errors are ~ N(0,var2). Suppose further that you want 10 clusters of 5 observations each. I believe you can create the overall covariance matrix with kronecker(diag(10),matrix(var1,5,5)) + var2*diag(50). This can then be fed as the variance to the mvtnorm function. Hope this helps. Regards, -Cody -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Perron Sent: Tuesday, July 11, 2006 15:59 PM To: r-help@stat.math.ethz.ch Subject: [R] generating clustered data Hello R folks, Does anybody have code to share for generating (via simulation) clustered data? The type of data I am looking to simulate would allow fitting of a multilevel model with random intercepts. I looked at the mvtnorm package but am not quite sure how to create clusters. (Can this be done by simply changing the seed?) If somebody could point me where to look for the relevant code or perhaps send some sample code, that would be great. Thanks, Brian __ 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 This e-mail, facsimile, or letter and any files or attachmen...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] 0* log(0) should be zero but NaN [Broadcast]
Try: R (cal - prob * log(ifelse(prob == 0, 1, prob), base=2)) [1] -0.500 -0.5287712 -0.5210897 -0.3321928 0.000 Andy From: Taka Matzmoto Dear R-users prob - c(0.5,0.4,0.3,0.1,0.0) cal - prob * log(prob,base=2) cal [1] -0.500 -0.5287712 -0.5210897 -0.3321928NaN Is there any way to change NaN to zero ? I did come up with this by applying Ripley's relpy to my previous question cal -prob*log(pmax(prob,0.0001),base=2) Any suggestion ? Thank you Taka __ 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] use of NULL environment is deprecated?
On 7/11/2006 6:59 PM, Patrick Connolly wrote: On Tue, 11-Jul-2006 at 06:41PM -0400, Duncan Murdoch wrote: [] | | options(warn=2) will convert warnings into errors, so traceback will work. | | A common situation where I've seen that error is with binary saves from | earlier versions of R being loaded into current versions. For example, | if you installed a package before, but didn't re-install it with 2.3.1, | or if you are reloading a workspace saved in an earlier version. Thank you for the explanation. In this case, it's the latter reason: the workspace comes from a different computer as well as a different version of R. Will saving the objects anew overcome the problem? Yes, it should, though there's a slight risk that someone might have meant NULL to mean an empty environment instead of the base environment. This would be a bug with or without the change. 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] Question on partial effect
Than you, Gavin. You helped me out a lot of problems. Thank you very much! Wei-Wei 2006/7/12, Gavin Simpson [EMAIL PROTECTED]: On Wed, 2006-07-12 at 00:51 +0800, Guo Wei-Wei wrote: Thank you, Gavin. I think that might be what I need. But I'm a little bit wandering what's the scale of resid(mod). Is it scale(dist)/scale(speed), for example kilometer / (kilometer per hour)? or something else? Thank you very much! Wei-Wei The scale of dist - they are just the differences between observed dist and fitted dist (based on speed). mod - lm(dist ~ speed, data = cars) resid(mod) 1 2 3 4 5 3.849460 11.849460 -5.947766 12.052234 2.119825 6 7 8 9 10 -7.812584 -3.744993 4.255007 12.255007 -8.677401 # visualise the residuals plot(resid(mod) ~ dist, data = cars) abline(h = 0, col = grey) ## length of blue line represents the residual lines(cars$dist, resid(mod), type = h, col = blue) So you see that for the 1st residual it is 3.849 ft (the distances are measured in feet, see ?cars) Does this help? G 2006/7/12, Gavin Simpson [EMAIL PROTECTED]: On Tue, 2006-07-11 at 23:51 +0800, Guo Wei-Wei wrote: Dear all, I don't know what's my question is called. I have a performance variable A, such as sales. And I have another variable B, let's say establish time of firm. I want to create the third variable that is sales without the effect of establish time. Maybe it can be called partial effect problem. I'm not sure. Does anyone have any suggestion? Thank you in advance! All the best, Wei-Wei Do you mean? ## dummy data A - rnorm(100) B - rnorm(100) C - resid(lm(A ~ B)) C now contains the residual variation in A after fitting B. e.g. with some real data ?cars data(cars) # not sure this is needed now, I forget mod - lm(dist ~ speed, data = cars) summary(mod) partial - resid(mod) ## check mod2 - lm(dist ~ partial, data = cars) summary(mod2) ## from the two R^2 form mod1 and mod2 - partial contains dist minus ## the effects of speed 0.6511 + 0.3489 [1] 1 HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/ London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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 -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/ London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] 0* log(0) should be zero but NaN
Try this: p - 0:10/10 p * log2(p + !p) On 7/11/06, Taka Matzmoto [EMAIL PROTECTED] wrote: Dear R-users prob - c(0.5,0.4,0.3,0.1,0.0) cal - prob * log(prob,base=2) cal [1] -0.500 -0.5287712 -0.5210897 -0.3321928NaN Is there any way to change NaN to zero ? I did come up with this by applying Ripley's relpy to my previous question cal -prob*log(pmax(prob,0.0001),base=2) Any suggestion ? Thank you Taka __ 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] PDF version of Chinese translations of the manual An Introduction to R
Dear All, I distributed the HTML style one year ago ( http://www.biosino.org/pages/newhtm/r/schtml and http://www.biosino.org/pages/newhtm/r/tchtml). Now I polished it, and rewrote it with Latex. You can download it from the URL: http://www.biosino.org/R/R-doc/ ( http://www.biosino.org/R/R-doc/files/R-intro_cn.pdf). Wish it will be useful for Chinese R users. Any suggestion, comment and correction are welcome! -- ADDRESS: Bioinformatics Center, Shanghai Institutes for Biological Sciences, Chinese Academy of Sciences 320 Yueyang Road, Shanghai 200031, P.R.China TELEPHONE: 86-21-54920086 [[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 in vectorization
Hi, I have two data frames. One is like dtf = data.frame(y=c(rep(2002,4), rep(2003,5)), + m=c(9:12, 1:5), + def=c(.74,.75,.76,.78,.80,.82,.85,.85,.87)) and the other dtf2 = data.frame(y=rep( c(2002,2003),20), m=c(trunc(runif(20,1,5)),trunc(runif(20,9,12))), inc=rnorm(40,mean=300,sd=150) ) What I want is to divide dtf2$inc by dtf1$def by the levels of y and m (inc is income and def is the deflator). Any help in vectorizing this is welcome. Thank you, Dimitri [[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 in vectorization
Try this: with(merge(dtf, dtf2), data.frame(y, m, inc = inc/def)) On 7/11/06, Dimitri Szerman [EMAIL PROTECTED] wrote: Hi, I have two data frames. One is like dtf = data.frame(y=c(rep(2002,4), rep(2003,5)), + m=c(9:12, 1:5), + def=c(.74,.75,.76,.78,.80,.82,.85,.85,.87)) and the other dtf2 = data.frame(y=rep( c(2002,2003),20), m=c(trunc(runif(20,1,5)),trunc(runif(20,9,12))), inc=rnorm(40,mean=300,sd=150) ) What I want is to divide dtf2$inc by dtf1$def by the levels of y and m (inc is income and def is the deflator). Any help in vectorizing this is welcome. Thank you, Dimitri __ 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] PDF version of Chinese translations of the manual An Introduction to R
Dear All, I distributed the HTML style one year ago ( http://www.biosino.org/pages/newhtm/r/schtml and http://www.biosino.org/pages/newhtm/r/tchtml ). Now I polished it, and rewrote it with Latex. You can download it from the URL: http://www.biosino.org/R/R-doc/ ( http://www.biosino.org/R/R-doc/files/R-intro_cn.pdf). Wish it will be useful for Chinese R users. Any suggestion, comment and correction are welcome! -- ADDRESS: Bioinformatics Center, Shanghai Institutes for Biological Sciences, Chinese Academy of Sciences 320 Yueyang Road, Shanghai 200031, P.R.China TELEPHONE: 86-21-54920086 [[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] Date Format
If I understand your question correctly, then my suggestion is to try table( format(datetest), other.variable) instead of table(datetest, other.variable) -Don At 4:23 PM + 7/11/06, pierre clauss wrote: Hi everybody, I need your precious help for, I think, a simple request, but I do not manage to solve this. When I use a table function with dates in the rows, the rows are coerced to number after the table function. So I need to transform the row names into date format. But I do not manage. Therefore, for an example, I manage to write this : datetest-06/01/2001 datetest-as.Date(datetest,%d/%m/%Y) datetest-as.numeric(datetest) to get 11328. But I do not obtain the inverse tranformation : datetest-as.Date(datetest,%d/%m/%Y) How do we get this please ? Thanks a lot for your solution. Pierre. [[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 -- - Don MacQueen Lawrence Livermore National Laboratory Livermore, CA, USA __ 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] Rgnome in Ubuntu
Hi I am trying to set up Rgnome in Ubuntu (Dapper) and when I use the instructions: /path/to/gnomeGUI/configure R_HOME=/path/to/R/installation make make install I get an error message when I try to 'make' as follows: /usr/local/lib64/R/etc/Makeconf:5: /make/vars.mk: No such file or directory make: *** No rule to make target `/make/vars.mk'. Stop. Can anyone help me? Steve __ 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