Re: [R] Copula fitting
Puskás László wrote: Hi, Is anybody using Copula package for fitting copulas to own datas? I always got this message: Error in qnorm(p, mean, sd, lower.tail, log.p) : Non-numeric argument to mathematical function Please specify version of package and R as well as the code that produces the error message. Please read the posting guide which asks you to do so. If this is not an user error but a bug, please report to the package maintainer. Uwe Ligges thanks, Psl ___ Ossza meg barátaival fényképen megörökített élményeit. http:\\fototar.t-online.hu __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] disaggregating table
Hi all, This should be easy, but I can't seem to figure it out. I have a table like this named newtable a1 a2 a3 a4 Cnts Score 1 100 4 3.28 1 011 2 2.63 I want the following: a1 a2 a3 a4 Cnts Score 1 100 4 3.28 1 100 4 3.28 1 100 4 3.28 1 100 4 3.28 1 011 2 2.63 1 011 2 2.63 Actually, the Cnts column could be removed, but it doesn't matter if it stays. Anyone know how to disaggregate with Cnts as the index? Thanks, Jeff [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] disaggregating table
On Sun, 22 Oct 2006, Jeff Miller wrote: Hi all, This should be easy, but I can't seem to figure it out. ind - rep(1:nrow(newtable), times=newtable$Cnts) newtable[ind, -5] gives a1 a2 a3 a4 Score 11 1 0 0 3.28 1.1 1 1 0 0 3.28 1.2 1 1 0 0 3.28 1.3 1 1 0 0 3.28 21 0 1 1 2.63 2.1 1 0 1 1 2.63 Note the row names: data frames must have unique row names. I have a table like this named newtable a1 a2 a3 a4 Cnts Score 1 100 4 3.28 1 011 2 2.63 I want the following: a1 a2 a3 a4 Cnts Score 1 100 4 3.28 1 100 4 3.28 1 100 4 3.28 1 100 4 3.28 1 011 2 2.63 1 011 2 2.63 Actually, the Cnts column could be removed, but it doesn't matter if it stays. Anyone know how to disaggregate with Cnts as the index? [[alternative HTML version deleted]] Please use properly formatted plain text, as we do ask in the posting guide. I've had to reformat the double-spaced text provided before pasting the table. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 and provide commented, minimal, self-contained, reproducible code.
[R] Lmer, heteroscedasticity and permutation, need help please
Hi everybody, I'm trying to analyse a set of data with a non-normal response, 2 fixed effects and 1 nested random effect with strong heteroscedasticity in the model. I planned to use the function lmer : lmer(resp~var1*var2 + (1|rand)) and then use permutations based on the t-statistic given by lmer to get p-values. 1/ Is it a correct way to obtain p-values for my variables ? (see below) 2/ I read somewhere that lme is more adequate when heteroscedasticity is strong. Do I have to use lme instead of lmer ? 3/ It is possible to fit a glm in lmer using family= Is it possible to use it in spite of hard heteroscedasticity ? 4/ A last question concerning SAS. My model appears to not converge in SAS, indicating a structure in the variance. Is it implying something in lmer or lme ? Many Thanks Here is the function for the permutation : permut-function(data,vardep,var1,var2,var.random,nboot=10){ # initialisation ms.var1-numeric(length=nboot) ms.var2-numeric(length=nboot) ms.var3-numeric(length=nboot) var1.permut-numeric(length=length(var1)) var2.permut-numeric(length=length(var2)) var3.permut-numeric(length=length(var2)) var1-factor(var1) var2-factor(var2) # model initial model.ini-lmer(vardep~factor(var1)*factor(var2)+(1|var.random),data=data) vc-vcov(model.ini) b - fixef(model.ini) se- sqrt(diag(vc)) z- b/se p- 2*(1-pnorm(abs(z))) # boucle de permutation for(i in 1:nboot){ #boucles de randomisation des traitements for (j in 1:nlevels(var1)){ var2.permut[var1==j]-sample(var2[var1==j])} for (j in 1:nlevels(var2)){ var1.permut[var2==j]-sample(var1[var2==j])} data2-data.frame(vardep,var1,var2,var.random,var1.permut,var2.permut) #test var1: m1-lmer(vardep~factor(var1.permut)*factor(var2)+(1|var.random),data=data2) ms.var1[i]-as.numeric(fixef(m1)/sqrt(diag(vcov(m1[2] #test var2: m2-lmer(vardep~factor(var1)*factor(var2.permut)+(1|var.random),data=data2) ms.var2[i]-as.numeric(fixef(m2)/sqrt(diag(vcov(m2[3] #test interaction: m3-lmer(vardep~factor(var1.permut)*factor(var2.permut)+(1|var.random),data=data2) ms.var3[i]-as.numeric(fixef(m3)/sqrt(diag(vcov(m3[4] } max.boot-c(NA,max(ms.var1),max(ms.var2),max(ms.var3)) min.boot-c(NA,min(ms.var1),min(ms.var2),min(ms.var3)) pval-c(NA,length(ms.var1[ms.var1=z[2]])/nboot,length(ms.var2[ms.var2=z[3]])/nboot,length(ms.var3[ms.var3=z[4]])/nboot) res-cbind(b,se,z,p,permut.min=min.boot,permut.max=max.boot,permut.pval=pval) par(mfrow=c(2,2)) hist(ms.var1);abline(v=z[2],col=RED);hist(ms.var2);abline(v=z[3],col=RED);hist(ms.var3);abline(v=z[4],col=RED) return(res) } -- Alan Juilland – PhD Student Department of Ecology and Evolution Biophore, University of Lausanne 1015 Dorigny Switzerland Tel : ++41 21 692 41 74 Fax : +41 21 692 41 65 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R tcl/tk
Charles Annis, P.E. [EMAIL PROTECTED] writes: Friends: I am a long-time R user, learning tcl/tk, and am tying myself in knots over something that should be simple. I want to create a frame and put that frame inside the toplevel frame. This works (i.e. it places text in col 1, and the corresponding entry box in column 2) and later frame.2 resides where it should in the toplevel frame. tkgrid(tklabel(frame.2, text=FACTOR column ), tkentry(frame.2, textvariable=FACTOR.column.value, width=2), sticky=e) This doesn't work because I don't know how to tell tcl that answer.button1 belongs in frame2: tkconfigure(answer.button1, variable=buttonValue, value=TRUE) tkgrid(tklabel(frame.2, text=Question?yes ), answer.button1, sticky=e) ^^^ I know this can not be as hard as I am making it. Possibly, but there seems to be some context missing, so I can't quite grasp what you want to do. It does look a bit suspicious that you aren't saving the objects generated by tklabel and tkentry though. In general, the hierarchy between widgets is defined at widget creation time, so why is there no answer.button1 - tkbutton(frame.2,..whatever..) ? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] sqlSave, fast=F option, bug?
I've also reproduced this behaviour on WinXP + MS SQL Server and would agree that it's a bug with the fast=FALSE option. Have the package maintainers been contacted about this? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of chao gai Sent: 18 October 2006 08:10 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] sqlSave, fast=F option, bug? The bug spot seems to be the fast option sqlDrop(chan,'test') df - data.frame(T=1, S=10) sqlSave(chan, df, test, rownames=F) df - data.frame(S=20, T=2) sqlSave(chan, df, test, rownames=F, append=T,fast=T) df - data.frame(S=30, T=3) sqlSave(chan, df, test, rownames=F, append=T,fast=F) sqlFetch(chan,'test') T S 1 1 10 2 2 20 3 30 3 On Linux MySQL On Wednesday 18 October 2006 17:06, Dieter Menne wrote: Paul MacManus paul.macmanus at gmail.com writes: Using the fast=F option, sqlSave saves without matching column names. It looks like a bug to me.. In other words, sqlSave didn't check column names, it simply mapped column 1 to column 1 and column 2 to column 2. This seems to be a problem with SQLServer. The following example with Access works correctly for me, even if I close the connection in between. (Win2k, R 2.4.0) Dieter Menne - library(RODBC) channel - odbcConnectAccess(db1.mdb) df - data.frame(T=1, S=10) sqlSave(channel, df, test, rownames=F) #odbcClose(channel) #channel - odbcConnectAccess(db1.mdb) df - data.frame(S=20, T=2) sqlSave(channel, df, test, rownames=F, append=T,fast=T) odbcClose(channel) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Nedbank Limited Reg No 1951/09/06. The following link displays the names of the Nedbank Board of Directors and Company Secretary. [ http://www.nedbank.co.za/terms/DirectorsNedbank.htm ] This email is confidential and is intended for the addressee only. The following link will take you to Nedbank's legal notice. [ http://www.nedbank.co.za/terms/EmailDisclaimer.htm ] [[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 and provide commented, minimal, self-contained, reproducible code.
[R] calculate area of outer polygon
Dear all, Does anyone know of a function that calculates the area of the outer polygon constructed from a data frame with co-ordinates? For example, library(splancs) test = rbind(c(0,0), c(10,0),c(10,10),c(0,20)) plot(test) areapl(test) [1] 150 This is OK, but I want the same area to be returned (150) when adding yet another co-ordinate in the middle of the polygon: test = rbind(c(0,0), c(10,0),c(10,10),c(0,20),c(5,5)) plot(test) areapl(test) [1] 100 I have also tested area.owin() in library(spatstat) but the co-ordinates of the outer polygon is one of the arguments. Thanks! Tord -- NOTE, new e-mail and contact information: Tord Snäll Department of Conservation Biology Swedish University of Agricultural Sciences (SLU) P.O. 7002, SE-750 07 Uppsala, Sweden Office/Mobile/Fax +46-18-672740/+46-730-891356/+46-18-673537 E-mail: [EMAIL PROTECTED] www.nvb.slu.se/staff_tordsnall __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Adjusted residuals
Dear users, Given a equation of the form y=a(1-exp(bt), where a,b parameters and t=age and given prevalences for t=1,2,3,4,5 What is a nice way to plot a kind of adjusted residuals at those values for t? How should one scale them to account for small counts at some values for t? Thanks -- Dominik Heinzmann Institute of Mathematics University of Zurich __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Key colour problem with lattice plot
Hi Geoffrey, I replicated your problem, and I came up with the same solution as Deepayan, so I won't reprint it here but: Can anyone explain why the key is inverted versus the bar order? I'd also like to thank you for showing me a different approach to lattice formulae. I would have used the following formulation: ex2 = stack(example) ex3 = cbind(country=rep(rownames(example),2),ex2) barchart(country ~ values, ex3,group=ind, auto.key=TRUE) -Alex Brown On 22 Oct 2006, at 12:21, Geoff Russell wrote: Hi, I seem to have a key colour problem with a lattice barchart. The colours on my key rectangle don't match the colours on the barchart. Here is my data frame: LandFill Ruminants United States (USA) .21428 5528.16 France 200.527083 1299.87 Australia 185.878368 2448.17 Russian Federation 1752.8334 2024.29 Argentina 283.98732 2567.02 Brazil 1048.42248 8839.61 Colombia 265.125 1307.61 Mexico 981.023351 1814.89 Ethiopia 9.38020424 1237.49 Sudan 16.0184936 1796.67 India 553.425328 12360.3 Pakistan 47.1593928 2346.71 China 455.680191 8041.79 example LandFill Ruminants United States (USA) .214280 5528.16 France 200.527083 1299.87 Australia185.878368 2448.17 Russian Federation 1752.833400 2024.29 Argentina283.987320 2567.02 Brazil 1048.422480 8839.61 Colombia 265.125000 1307.61 Mexico 981.023351 1814.89 Ethiopia 9.380204 1237.49 Sudan 16.018494 1796.67 India553.425328 12360.30 Pakistan 47.159393 2346.71 China455.680191 8041.79 And here is my plotting statement. barchart(rownames(example)~example$LandFill+example $Ruminants,type=c(p,h), key=list(text=list(c(Landfill,Enteric Fermentation)), rectangles=Rows(trellis.par.get(superpose.symbol),c(1,2)) Cheers, Geoff Russell __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] calculate area of outer polygon
Tord Snäll wrote: Dear all, Does anyone know of a function that calculates the area of the outer polygon constructed from a data frame with co-ordinates? For example, If by 'outer polygon' you mean 'convex hull', then look at help(chull). Barry __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How can I calculate adjusted means?
Hi, I have been looking for help about adjusted means but it seems like there is no specific information about it. My problem is following: In a 2 level ANOVA my model is - anova(Y~treat1+treat2+covarX) I have 4 factors in treat1 and 2 factors in treat2. Now I want the adjusted means for my measured variable. I.e. taking into account the covariate variable. How can I do that? Regards, Gustaf Granath, phd student __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] getting the by() function to work properly
Hi maybe somebody can help you more but in meantime I would recommend to debug your function with debug(f3) and call by(ss3, sub, f3) to see where exactly comes the error from. HTH Petr On 22 Oct 2006 at 22:49, Jancik, Jasper F. wrote: Date sent: Sun, 22 Oct 2006 22:49:23 -0400 From: Jancik, Jasper F. [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] getting the by() function to work properly Hola everyone, Solving this issue would be a huge time saver for analyzing my thesis data, so I'll try to be as concise as possible and hope that someone can give me a hand. I am trying to run a function that I created, which works fine until I try to use it with the by function. That function is listed at the bottom (f3) just in case that might be the issue. Essentially I have compiled a large list of data coming from about 30 subjects with 88 trials each and I am trying to get that function to apply to each subject without having to manually attach each subject's data. The entire filename is 'ss2' so when i run ss2f3=f3(ss2) ss2f3 everything is fine. However when I try to use the by() function: by(ss3, sub, f3) #sub=subject header in the data I get the error message: Error in var(x, na.rm = na.rm) : missing observations in cov/cor There are no missing observations anywhere in the data so I'm really confused as to how this is happening. My professor thought it might have something to do with the variance calculations in the function, so when we had it remove bad data the function would run, however it did not calculate everything and it erroneously gave the exact same calculations for each subject. I even get the message when I try to manually subset the data e.g.: s2f3=f3(alldata[sub==2,]) Error in var(x, na.rm = na.rm) : missing observations in cov/cor I hope I've provided all the necessary info (the data set is attached just in case anyone has the time to make it work), but I'd be glad to give more if its needed. I would really appreciate any suggestions at all. Thanks in advance. f3=function(x) { + + twodied=x[died==2,]; + twosaved=x[saved==2,]; + hit2=x[saved==2 choice==+,]; + fa2=x [died==2 choice==+,]; + d2=(qnorm(((nrow(hit2))/(nrow(twosaved-qnorm((nrow(fa2))/(nrow( + twodied; hitrate=((nrow(hit2))/(nrow(twosaved))); + FArate=((nrow(fa2))/(nrow(twodied))); + zhit2=qnorm(((nrow(hit2))/(nrow(twosaved;zfa2=qnorm((nrow(fa2)) + /(nrow(twodied)));B2= -.5*(zhit2+zfa2); tp2=mean(twosaved$resp); + ta2=mean(twodied$resp); tpsd2=sd(twosaved$resp); + tasd2=sd(twodied$resp); dmj2=((tp2-ta2)/((tasd2+tpsd2)/2)); + + L=list(d2=d2,B2=B2,dmj2=dmj2,tpsd2=tpsd2,tasd2=tasd2,tp2=tp2,ta2=ta2 + ,hitrate=hitrate,FArate=FArate) } Jasper Jancik 910.352.7546 Petr Pikal [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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Book for Maximum Likelihood Methods in R
On 23-Oct-06 Ben Bolker wrote: Milton Cezar Ribeiro milton_ruser at yahoo.com.br writes: Hi R-guys, Is there a good book for maximum likelihood methods in R? I´m looking mainly to Ecological approaches to apply ML. ** BLATANT PLUG warning **: I'm working on a book on statistical/ecological modeling in R, to be published by Princeton University Press sometime in (?) 2007, that focuses on constructing maximum likelihood models. I have a draft up on my web site at http://www.zoo.ufl.edu/bolker/emdbook . I would be very grateful if other R aficionados wanted to have a look and tell me what they thought (keeping the target audience in mind --- ecology students and researchers who know a bit of classical statistics and want to be able to do more by rolling their own in R) Ben, your plug is welcome. There is a hole to be filled in this area, and I'm looking forward to checking your plug for shape and size! A question or two: I notice that one can get the whole book in one shot from http://www.zoo.ufl.edu/bolker/emdbook/book.pdf rather than piece by piece from the individual chapter links (though the revision status may differ). But must one also get the Exercises, R code, Data and Scripts separately? And/or can one use wget for it all? Thanks, Ben, and best wishes for its future! Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 23-Oct-06 Time: 10:31:29 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Cube plots
Hi does anyone know of any R functions or packages for the following :- . generating cube plots for displaying the results from a response surface experiment design . generating ternary plots from a mixture design . tetrahedral plot or quaternary plot for displaying results from a four factor mixture experiment thanks Bob Kinley [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Cube plots
On 10/23/2006 7:17 AM, Robert Kinley wrote: Hi does anyone know of any R functions or packages for the following :- . generating cube plots for displaying the results from a response surface experiment design . generating ternary plots from a mixture design . tetrahedral plot or quaternary plot for displaying results from a four factor mixture experiment persp (in graphics) or persp3d (in rgl) can do surface plots; is that what a cube plot is? I'm sure I've seen mixture plots before; try RSiteSearch or look in the R Graphics Gallery. I don't think I've see tetrahedral plots, but the strategy above might turn them up. Duncan Murdoch thanks Bob Kinley [[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 and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R tcl/tk
Peter: Thank you for your response. I apologize for not sending a reproducible example. I have attached a reproducible example of the problem here. This is a much abbreviated version of my problem and even so it's rather long for an example. Run with tcl.tk.example(PROBLEM = TRUE) tcl.tk.example(PROBLEM = FALSE) to turn the problem on and off. I have also attached a tcl.tk.example.txt file since these long inclusions within an R-help note often have the line feeds missing. Thank you for your insights. Charles Annis, P.E. ### tcl.tk.example - function(PROBLEM = TRUE) { require(tcltk) t2 - tktoplevel() tktitle(t2) - Hit/Miss group.button1 - tkradiobutton(t2) group.button2 - tkradiobutton(t2) repeated.measures.value - tclVar(3) l.repeated.measures.value - tklabel(t2, text= hit/miss column(s) ) e.repeated.measures.value - tkentry(t2, textvariable=repeated.measures.value, width=5, borderwidth = 3, relief=sunken) tkgrid(tklabel(t2, text=Hit/Miss POD Setup), columnspan=2, sticky=n) tkgrid.configure(l.repeated.measures.value, e.repeated.measures.value, sticky=e) tkgrid.configure(e.repeated.measures.value, sticky=w, padx=5) frame.2 - tkframe(t2, borderwidth = 3, width=150, height=100, relief=ridge) GROUP.column.value - tclVar(4) l.GROUP.column.value - tklabel(frame.2, text=GROUP column ) e.GROUP.column.value - tkentry(frame.2, textvariable=GROUP.column.value, width=2, borderwidth = 3, relief=sunken) l.group.value.yes - tklabel(frame.2, text=group data?yes ) l.group.value.no - tklabel(frame.2, text=NO ) group.buttonValue - tclVar(GROUP.DATA) tkconfigure(group.button1, variable=group.buttonValue, value=TRUE) tkconfigure(group.button2, variable=group.buttonValue, value=FALSE) if(PROBLEM){ ### group.button1 not placed within frame.2 because I don't know how to indicate frame.2 tkgrid(l.group.value.yes, group.button1, sticky=e) tkgrid(group.button1, sticky=w) tkgrid(l.group.value.no, group.button2, sticky=e) tkgrid(group.button2, sticky=w) } else { ### second dummy lable is correctly placed because I can tell it that it belongs in frame.2 tkgrid(l.group.value.yes, tklabel(frame.2, text=dummy), sticky=e) tkgrid(l.group.value.no, tklabel(frame.2, text=dummy), sticky=e) } tkgrid(l.GROUP.column.value, e.GROUP.column.value, sticky=e) tkgrid(e.GROUP.column.value, sticky=w, padx=5, pady=5) tkgrid(frame.2, columnspan=2) OnOK - function() { hit.miss.columns - eval(parse(text=paste(c(, substr(gsub(pattern = -, replacement=:, as.character(tclvalue(repeated.measures.value))),start=1,stop=1), n.columns - length(hit.miss.columns) GROUP.column - as.double(as.character(tclvalue(GROUP.column.value))) repeated.measures.GROUP.names - as.character(tclvalue(repeated.measures.GROUP.value)) ###read.hit.miss.input() tkdestroy(t2) } OK.but - tkbutton(t2,text= OK , command=OnOK, borderwidth = 3, relief=raised) tkgrid(tklabel(t2,text= Must click OK\nto register changes. ), (OK.but), sticky=e) tkgrid(OK.but, sticky=w) tkfocus(t2) } tcl.tk.example(PROBLEM = TRUE) tcl.tk.example(PROBLEM = FALSE) ## Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Monday, October 23, 2006 3:35 AM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R tcl/tk Charles Annis, P.E. [EMAIL PROTECTED] writes: Friends: I am a long-time R user, learning tcl/tk, and am tying myself in knots over something that should be simple. I want to create a frame and put that frame inside the toplevel frame. This works (i.e. it places text in col 1, and the corresponding entry box in column 2) and later frame.2 resides where it should in the toplevel frame. tkgrid(tklabel(frame.2, text=FACTOR column ), tkentry(frame.2, textvariable=FACTOR.column.value, width=2), sticky=e) This doesn't work because I don't know how to tell tcl that answer.button1 belongs in frame2: tkconfigure(answer.button1, variable=buttonValue, value=TRUE) tkgrid(tklabel(frame.2, text=Question?yes ), answer.button1, sticky=e) ^^^ I know this can not be as hard as I am making it. Possibly, but there seems to be some context missing, so I can't quite grasp what you want to do. It does look a bit suspicious that you aren't saving the objects generated by tklabel and tkentry though. In general, the hierarchy between widgets is defined at widget creation time, so why is there no answer.button1 - tkbutton(frame.2,..whatever..) ? -- O__ Peter Dalgaard Øster Farimagsgade 5,
[R] Recurrence plot in package tseriesChaos
Hi, I'm a new user of the R package, and I need to generate recurrence plots for a set of 56 time series data. The package tseriesChaos has the function recurr that gives a plot. But what I really need are the recurrence plot parameters that are calculated from each plot (like %recur, %det, trend, etc...) and that can be stored dynamically in a output file for all the 56 datasets. It seems that the function recurr does not calculate these parameters. Is there another function in the package that does so? If not, is there another package that deals with recurrence quantification analysis? I would be very glad to have this problem solved in R itself. Thanking in advance, Joy __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Cube plots
I don't think I've see tetrahedral plots, but the strategy above might turn them up. There was a userR presentation on them - http://www.r-project.org/useR-2006/Abstracts/Matthews.pdf With a little work, you could also do them in GGobi (http://www.ggobi.org), which would generalise to more than 3d. There are some hints on how to do this (and why it might be useful) in an old xgobi paper: http://www.research.att.com/areas/stat/xgobi/papers/xgobi96.pdf Regards, Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Multilevel model (lme) question
On 10/22/06, Lukas Rode [EMAIL PROTECTED] wrote: Thanks Douglas for the detailed explanation; it was very helpful (I'll definitely give lme4 a try as well). For the record: I also found it helpful to play with model.matrix (e.g. p. 14ff and p.28 of the book by Jose Pinheiro and Douglas) to see how the formulas for fixed and random effects are related to the LairdWare'82 formulation for mixed-effects models. Now I have one follow-up question, about model selection: From your advice, I figure that the suggested procedure is to build a number of models (with differences in fixed and/or random effects) and then comparing them to select the most adequate one. When using anova(model1, model2) to compare two models that differ in both fixed and random effects, I get a warning message: Fitted objects with different fixed effects. REML comparisons are not meaningful. in: anova.lme(model1, model2). You can compare models with different fixed-effects specifications if you use method = ML. The REML criterion does not behave like a likelihood when you change the fixed-effects specification. Generally if you are using lme (and, as in your case, you have a simple specification like (1|Subject) for the random effects) then you can use anova applied to the model with the main effects and interactions to test for the significance of the interaction term. If you decide to eliminate that term then you can test for the other terms. With lmer fits I recommend checking a Markov chain Monte Carlo sample from the posterior distribtuion of the parameters to determine which are signification (although this is not terribly well documented at the present time). So apparently this means that anova only works for comparing models with same fixed-effects component but different random effects, right? So what is then the correct way to compare models with different fixed and/or random effects? For example, would it be correct to simply choose the model with the lowest AIC/BIC? (this seems to be a better choice than selecting by logLikelihood since AIC/BIC penalize higher #parameters, whereas likelihood does not). Some people like to use AIC/BIC. I find the definition of the cut-off points to be rather arbitrary. Also, one will frequently have the model selection by AIC and by BIC disagree. Or is there another, better way? Many thanks so far, Lukas On 10/22/06, Douglas Bates [EMAIL PROTECTED] wrote: On 10/21/06, Lukas Rode [EMAIL PROTECTED] wrote: Dear list, I'm trying to fit a multilevel (mixed-effects) model using the lme function (package nlme) in R 2.4.0. As a mixed-effects newbie I'm neither sure about the modeling nor the correct R syntax. You may also want to consider using the lmer function from package lme4. It's a later version of lme for R and is generally faster than lme. I'll show the syntax for both. My data is structured as follows: For each subject, a quantity Y is measured at a number (= 2) of time points. Moreover, at time point 0 (baseline), a quantity X is measured for each subject (I am interested to see whether X, or log(X), is a predictor of Y). I saw in some examples that time-invariant predictors should be repeated for all rows of a subject, which is why I copied the baseline value of X also to time points 0. That's correct. For both lme and lmer the data need to be in the 'long' form, also called the 'person-period' form. You can reshape the data by hand, as you have done, or you can use the 'reshape' function or the more general capabilities in Hadley Wickham's reshape package. The resulting data frame looks like this: Grouped Data: Y ~ TIME | Subject Y TIMESubject X.Baseline 9 0.0 11084 7 3.7 11084 11 0.0 27150 8 9.2 27150 Intra-subject trajectories of Y very close to linear. I'd like to check whether slope (and maybe also offset) of this line are (in part) predicted by X.baseline. I would say that this question would be addressed as part of the fixed-effects specification. You would be comparing a model with main effects for TIME and X.Baseline and their interaction to various submodels. In the S language formula notation these fixed effects specifications are Y ~ TIME * X.Baseline # main effects for TIME and X.Baseline and their interaction Y ~ TIME + X.Baseline + TIME:X.Baseline # equivalent to first model Y ~ TIME + X.Baseline # main effects but no interaction. That is X.Baseline does not affect slope Y ~ TIME + TIME: X.Baseline # X.Baseline affects slope (wrt TIME) but not offset Y ~ TIME # X.Baseline has no effect on Y Thus, I think the multilevel model specification should be as follows (i = subject, j=measurement): y_ij = \beta_i + b_i *
[R] likelihood question not so related to R but probably requires the use of R
I have a question and it's only relation to R is that I probably need R after I understand what to do. Both models are delta y_t = Beta + epslion and suppose I have a null hypothesis and alternative hypothesis H_0 : delta y_t = zero+ epsilonepsilon is normal ( 0, sigmazero^2 ) H_1 delta y_t = beta + epsilon epsilon is normal ( sigmabeta^2 ) -- so, i calculate the MLE's under the null and the alternative as : under H_0 beta hat = 0 and sigmazero^2 hat = sum over t ( delta y_t - zero )^2/ (n-1) under H_1 beta hat = ( sum of delta y_t ) /nand sigmabeta^2 = sum over t ( delta y_t - beta hat )^2/(n-1) --- what i have blanked out on is how i take the estimates above and test which model is more likely given the data ? I think I used to know this so I apologize if this is a stupid question. I used to take my estimates and th use dnorm or pnorm or one of those but I can't remember what I did and I can't find my old code. thanks. This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation. Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers. This is not research and is not from MS Research but it may refer to a research analyst/research report. Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm. We do not represent this is accurate or complete and we may not update this. Past performance is not indicative of future returns. For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls. You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions. We cannot guarantee that any such requests received via ! e-mail will be processed in a timely manner. This communication is solely for the addressee(s) and may contain confidential information. We do not waive confidentiality by mistransmission. Contact me if you do not wish to receive these communications. In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules). [[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 and provide commented, minimal, self-contained, reproducible code.
[R] FW: Debug package question
Dear list, I received the response below from the package author of 'debug'. I post it to the list, with Mark's approval, in case it is useful to others too. Regards, Matthew -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 22 October 2006 23:53 To: Matthew Dowle Cc: [EMAIL PROTECTED] Subject: RE: Debug package question Hi Matthew That's an interesting point. If it's your own code, my recommendation would be to predefine the function and then mtrace it, as you suggest. But I can see that this isn't always easy, e.g. if you're trying to debug a system function. Because every little operation in R is actually a function call, it's probably not very useful for 'mtrace' to have a step-into mode. [Anyway, whether useful or not, it doesn't have one! ;)] The simplest way to get what you're after-- but it might not work-- would be to 'mtrace(apply)' and then call 'mtrace( FUN)' manually when the debug window for 'apply' appears. The snag is that 'apply' is quite likely to feature somewhere in the workings of 'debug' (I can't remember!) so you might hang the thing altogether. Also, if your own function happens to call 'apply' (directly or indirectly) you will get stuck with a lot of debug windows. A more robust, complicated, and devious way to get what you're after, is to write a version of 'apply' that automatically calls 'mtrace' on its function-argument and then invokes the real 'apply'. Something like this: mtrace.apply - function( X, MARGIN, FUN, ...) { FFF - FUN # don't know whether this is necessary mtrace( FFF) # naughty-- should really arrange for name to be unique mc - match.call( expand.dots=TRUE) mc$FUN - FFF mc[[1]] - quote( apply) eval( mc, envir=parent.frame()) } Then call 'mtrace.apply' instead of 'apply'. BTW: if your pass-in function isn't crashing the first time it's called, you might find it useful to use the 'bp(1,F)' trick the first time it appears in a debug window-- this means that it won't pop the window up and wait for input until/unless there's a crash. Hope this helps-- and glad you like the package Mark Mark Bravington CSIRO Mathematical Information Sciences Marine Laboratory Castray Esplanade Hobart 7001 TAS ph (+61) 3 6232 5118 fax (+61) 3 6232 5012 mob (+61) 438 315 623 -Original Message- From: Matthew Dowle [mailto:[EMAIL PROTECTED] Sent: Friday, 20 October 2006 8:20 PM To: Bravington, Mark (CMIS, Hobart) Subject: Debug package question Hi Mark, I've been using your excellent debug for a while now. Its truly excellent. The most common reason I find it useful is when R returns subscript out of bounds error. R provides no context information in the message so I just mtrace() the function and your package tells me the line straight away. Perfect. I have one question ... when I use the apply() family to apply a function and the error occurs inside the function *defined* inside the function, e.g. : X = matrix(...) apply(X, 2, function(x) { lots of lines ... M[m,] ... lots of lines ... N[n,] ... lots of lines ... O[o,] ... lots of lines }) Where it is the M[m,], N[n,] or O[o,] which generates the out of bounds on a particular iteration, but you don't know which one. Mtrace() will skip over the apply() and say the same as R, that an out of bounds has occurred somewhere, but not where, since mtrace has not been called on the function(x). One way to work around this, is to define the sub-function first with a name, call mtace() on it, then execute the apply. Is that the only way? Is there a way to set mtrace() to automatically mtrace() any function it calls, like step into and step over in other languages ? Regards, Matthew version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R and also version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major2 minor1.1 year 2005 month06 day 20 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 and provide commented, minimal, self-contained, reproducible
Re: [R] Recurrence plot in package tseriesChaos
Hi Joy. 2006/10/23, Joydeep [EMAIL PROTECTED]: Hi, I'm a new user of the R package, and I need to generate recurrence plots for a set of 56 time series data. The package tseriesChaos has the function recurr that gives a plot. But what I really need are the recurrence plot parameters that are calculated from each plot (like %recur, %det, trend, etc...) and that can be stored dynamically in a output file for all the 56 datasets. It seems that the function recurr does not calculate these parameters. I'm sorry, but I don't ever know what these parameters are. The 'recurr' function only computes a matrix of distances in the state space embedding-reconstructed from the given time series, and plots it as an image plot. I can only guess the parameters you're claiming can be computed from the distance matrix. Antonio. Is there another function in the package that does so? If not, is there another package that deals with recurrence quantification analysis? I would be very glad to have this problem solved in R itself. Thanking in advance, Joy __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R tcl/tk
Charles Annis, P.E. [EMAIL PROTECTED] writes: Peter: Thank you for your response. I apologize for not sending a reproducible example. I have attached a reproducible example of the problem here. This is a much abbreviated version of my problem and even so it's rather long for an example. Run with tcl.tk.example(PROBLEM = TRUE) tcl.tk.example(PROBLEM = FALSE) ... group.button1 - tkradiobutton(t2) This would appear to be the problem. If you want button 1 to be a child of frame.2, use tkradiobutton(frame.2) (after creating the frame, of course) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R tcl/tk
D'oh! You are right of course. How very obvious these things are on the other side of the solution. I spent the entire weekend and completely missed it. Thanks! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Monday, October 23, 2006 9:48 AM To: [EMAIL PROTECTED] Cc: 'Peter Dalgaard'; r-help@stat.math.ethz.ch Subject: Re: [R] R tcl/tk Charles Annis, P.E. [EMAIL PROTECTED] writes: Peter: Thank you for your response. I apologize for not sending a reproducible example. I have attached a reproducible example of the problem here. This is a much abbreviated version of my problem and even so it's rather long for an example. Run with tcl.tk.example(PROBLEM = TRUE) tcl.tk.example(PROBLEM = FALSE) ... group.button1 - tkradiobutton(t2) This would appear to be the problem. If you want button 1 to be a child of frame.2, use tkradiobutton(frame.2) (after creating the frame, of course) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R tcl/tk
This must be dumbest question ever asked, but... When I ask help.search(tcltk), I get a reference to tcltk-package. When I ask help(tcltk-package), I get rtfm(s) in 'R_HOME/Tcl/doc'. But then when I ask help.search(R_HOME), I get nothing. Is something missing here in those help pages? Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Agnes Help
Hi, I'm trying to use the cluster package and I'm having some trouble... I always get the message: myagnes - agnes(datafile.dat) Error: could not find function agnes the package cluster is listed in the library() command, and I can reach the help files from Agnes as well I know that this can be some really easy thing to fix, but right now I have no idea how to solve it. Thanks. Vinicius [[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 and provide commented, minimal, self-contained, reproducible code.
[R] Citation for tseries help pages for R
Good Morning/Afternoon! I am editing a document and am not sure how to cite the Time series analysis and computational finance help pages that are accessible at this url: www.maths.lth.se/help/R/.R/library/tseries/html/00Index.html. Can anyone on this list help me with this? Thank you for your time and have an excellent day!! Jenny VP -- Jenny Vander Pluym NOAA, NOS, Center for Coastal Fisheries and Habitat Research Applied Ecology and Restoration Research Branch 101 Pivers Island Rd. Beaufort, NC 28516-9722 office: 252.728.8777 fax: 252.728.8784 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] one is not one
On Sat, 21 Oct 2006, Philipp Pagel wrote: On Sat, Oct 21, 2006 at 11:04:13AM +0200, Patrick Giraudoux wrote: Which means that actually sum(x) is NOT considered equal to 1... Any idea about what is going wrong? Others have already pointed out the problem and I would like to add a reference to a classical paper on this topic: David Goldberg What Every Computer Scientist Should Know About Floating-Point Arithmetic Computing Surveys, 1991 Reprints can be found in many places online - e.g. here: Yes, and one place is linked from the FAQ entry. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Citation for tseries help pages for R
On Mon, 23 Oct 2006, Jenny Vander Pluym wrote: Good Morning/Afternoon! I am editing a document and am not sure how to cite the Time series analysis and computational finance help pages that are accessible at this url: www.maths.lth.se/help/R/.R/library/tseries/html/00Index.html. Can anyone on this list help me with this? Cite the package itself using the citation provided by citation(tseries) Best, Z Thank you for your time and have an excellent day!! Jenny VP -- Jenny Vander Pluym NOAA, NOS, Center for Coastal Fisheries and Habitat Research Applied Ecology and Restoration Research Branch 101 Pivers Island Rd. Beaufort, NC 28516-9722 office: 252.728.8777 fax: 252.728.8784 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] problem of using list element in for cycle
sorry, pressed sent by mistake. for example data - read.csv(data.txt) data V1 V2 1 YHR165C CG8877 2 YJL130C CG18572 3 YDL171C CG9674 4 YKR054C CG7507 5 YDL140C CG1554 6 YLR106C CG13185 7 YGL206C CG9012 8 YNL262W CG6768 9 YER172C CG5931 typeof(data) [1] list for (i in 1:nrow(data)){ cat(data[i,1] } it'll not return things like YHR165C but number like 6,7,9.. is this a new feature of list? how to turn off it. thanks [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem about using list element in for cycle
sorry, pressed sent by mistake. for example data - read.csv(data.txt) single V1 V2 1 YHR165C CG8877 2 YJL130C CG18572 3 YDL171C CG9674 4 YKR054C CG7507 5 YDL140C CG1554 6 YLR106C CG13185 7 YGL206C CG9012 8 YNL262W CG6768 9 YER172C CG5931 typeof(data) [1] list for (i in 1:nrow(data)){ cat(data[i,1] } it'll not return things like YHR165C but number like 6,7,9.. is this a new feature of list? how to turn off it. thanks On 10/23/06, Hu Chen [EMAIL PROTECTED] wrote: for example data - read.csv(data.txt) typeof(data) [1] list for (i in 1:nrow(data)){ [[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 and provide commented, minimal, self-contained, reproducible code.
[R] Agnes Help
Hi I'm trying to use the cluster package and I'm having some trouble... I always get the message: myagnes - agnes(datafile.dat) Error: could not find function agnes the package cluster is listed in the library() command, and I can reach the help files from Agnes as well I know that this can be some really easy thing to fix, but right now I have no idea how to solve it. Thanks. Vinicius __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R tcl/tk
On 10/23/2006 10:11 AM, Alberto Monteiro wrote: This must be dumbest question ever asked, but... When I ask help.search(tcltk), I get a reference to tcltk-package. When I ask help(tcltk-package), I get rtfm(s) in 'R_HOME/Tcl/doc'. But then when I ask help.search(R_HOME), I get nothing. Is something missing here in those help pages? R_HOME is a short form for the directory where you installed R. This is referring you to a directory on your system that holds documentation that's outside of R's help system. 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 and provide commented, minimal, self-contained, reproducible code.
[R] problem about using list element in for cycle
for example data - read.csv(data.txt) typeof(data) [1] list for (i in 1:nrow(data)){ [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Latex editor recommendations
Tom Backer Johnsen [EMAIL PROTECTED] writes: This question is not oriented towards R, but is posted here because I have the impression that there are at least some Latex users among the contributors. The question is: What editors for Latex are to be recommended? I have located one: EMACS. It's not just an editor, it's a religion. - Allen S. Rout __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R tcl/tk
On 10/23/06, Duncan Murdoch [EMAIL PROTECTED] wrote: On 10/23/2006 10:11 AM, Alberto Monteiro wrote: This must be dumbest question ever asked, but... When I ask help.search(tcltk), I get a reference to tcltk-package. When I ask help(tcltk-package), I get rtfm(s) in 'R_HOME/Tcl/doc'. But then when I ask help.search(R_HOME), I get nothing. Is something missing here in those help pages? R_HOME is a short form for the directory where you installed R. This is referring you to a directory on your system that holds documentation that's outside of R's help system. Note that R_HOME corresponds to the R.home() path so you can do this on Windows (and the analogous operations on other platforms): setwd(file.path(R.home(), Tcl, doc)) dir() [1] tcl84.cnt tcl84.GID TCL84.HLP tk84.cnt TK84.HLP system(cmd /c start TCL84.HLP) system(cmd /c start TK84.HLP) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R tcl/tk
On Mon, 23 Oct 2006, Alberto Monteiro wrote: This must be dumbest question ever asked, but... When I ask help.search(tcltk), I get a reference to tcltk-package. When I ask help(tcltk-package), I get rtfm(s) in 'R_HOME/Tcl/doc'. But then when I ask help.search(R_HOME), I get nothing. Is something missing here in those help pages? R_HOME is an environment variable: use Sys.getenv(R_HOME) to find its value (the same as R.home()), which will be the top-level directory of that particular R installation. BTW, you have not been as careful as you require of others: your comments are only true if preceded by the missing 'library(tcltk)' and only if you are running on Windows. -- 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 and provide commented, minimal, self-contained, reproducible code.
[R] character manipulation
Dear R'helpers, I am reading lines in a .txt file Each line is stocked into a n elements object, as this: [958] 422 287 339 31 203 602 547 1026 500 366 346 227 [959] 410 67 11 220 110 451 562 598 732 163 163 220 [960] 179 513 95 186 102 595 333 1289 804 210 294 459 [961] 276 153 307 138 126 233 623 739 521 421 209 75 [962] 64 392 60 45 332 371 290 887 599 106 62 184 [963] 171 168 374 43 71 567 1110 799 960 189 339 279 [964] 151 353 648 150 85 422 883 962 923 296 228 273 [965] 213 805 403 43 271 445 463 846 1124 345 295 85 [966] 574 420 200 39 243 187 249 378 714 318 286 114 [967] 85 73 192 91 146 484 710 782 750 321 261 65 [968] 53 487 27 76 150 345 663 848 620 192 129 187 [969] 461 216 8 251 279 558 1012 838 1330 258 138 115 [970] 53 83 39 298 117 488 880 815 1087 390 266 355 [971] 225 184 173 121 167 416 411 667 605 172 60 157 [972] 318 138 552 192 100 461 450 852 190 361 17 192 Now, I would like to determine how many (space) there are in each line ... After to have wipes out the extra spaces (double spaces) with data1[i]-gsub(x=data1[i],pattern= ,replacement= ,fixed=FALSE,extended=FALSE) I have attempted with regrexpr, sub, strsplit and many other character fonctions but I could not obtain the number of in each line, in order to further do a test on it. The answer may be trivial but at this time I gave up!! Cheers Nicolas Degallier UMR 7159 / IRD UR182 Laboratoire d'Océanographie et du Climat, Expérimentation et Approches Numériques (LOCEAN) Tour 45-55, 4e ét., case 100, 4 place Jussieu 75252 Paris Cedex 5 France tél: (33) 01 44 27 51 57 fax: (33) 01 44 27 38 05 E-mail: [EMAIL PROTECTED] pdf reprints (login=anonymous; password=[EMAIL PROTECTED]): ftp://ftp.lodyc.jussieu.fr/LOCEAN/ndelod __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] character manipulation
Forgot the second part. To replace multiple spaces with one: gsub( +, , your.data) On 10/23/06, Nicolas Degallier [EMAIL PROTECTED] wrote: Dear R'helpers, I am reading lines in a .txt file Each line is stocked into a n elements object, as this: [958] 422 287 339 31 203 602 547 1026 500 366 346 227 [959] 410 67 11 220 110 451 562 598 732 163 163 220 [960] 179 513 95 186 102 595 333 1289 804 210 294 459 [961] 276 153 307 138 126 233 623 739 521 421 209 75 [962] 64 392 60 45 332 371 290 887 599 106 62 184 [963] 171 168 374 43 71 567 1110 799 960 189 339 279 [964] 151 353 648 150 85 422 883 962 923 296 228 273 [965] 213 805 403 43 271 445 463 846 1124 345 295 85 [966] 574 420 200 39 243 187 249 378 714 318 286 114 [967] 85 73 192 91 146 484 710 782 750 321 261 65 [968] 53 487 27 76 150 345 663 848 620 192 129 187 [969] 461 216 8 251 279 558 1012 838 1330 258 138 115 [970] 53 83 39 298 117 488 880 815 1087 390 266 355 [971] 225 184 173 121 167 416 411 667 605 172 60 157 [972] 318 138 552 192 100 461 450 852 190 361 17 192 Now, I would like to determine how many (space) there are in each line ... After to have wipes out the extra spaces (double spaces) with data1[i]-gsub(x=data1[i],pattern= ,replacement= ,fixed=FALSE,extended=FALSE) I have attempted with regrexpr, sub, strsplit and many other character fonctions but I could not obtain the number of in each line, in order to further do a test on it. The answer may be trivial but at this time I gave up!! Cheers Nicolas Degallier UMR 7159 / IRD UR182 Laboratoire d'Océanographie et du Climat, Expérimentation et Approches Numériques (LOCEAN) Tour 45-55, 4e ét., case 100, 4 place Jussieu 75252 Paris Cedex 5 France tél: (33) 01 44 27 51 57 fax: (33) 01 44 27 38 05 E-mail: [EMAIL PROTECTED] pdf reprints (login=anonymous; password=[EMAIL PROTECTED]): ftp://ftp.lodyc.jussieu.fr/LOCEAN/ndelod __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] character manipulation
nchar(gsub([^ ], '', your.data)) This replaces all non-blanks with nulls leaving only blanks and then determines number of characters. On 10/23/06, Nicolas Degallier [EMAIL PROTECTED] wrote: Dear R'helpers, I am reading lines in a .txt file Each line is stocked into a n elements object, as this: [958] 422 287 339 31 203 602 547 1026 500 366 346 227 [959] 410 67 11 220 110 451 562 598 732 163 163 220 [960] 179 513 95 186 102 595 333 1289 804 210 294 459 [961] 276 153 307 138 126 233 623 739 521 421 209 75 [962] 64 392 60 45 332 371 290 887 599 106 62 184 [963] 171 168 374 43 71 567 1110 799 960 189 339 279 [964] 151 353 648 150 85 422 883 962 923 296 228 273 [965] 213 805 403 43 271 445 463 846 1124 345 295 85 [966] 574 420 200 39 243 187 249 378 714 318 286 114 [967] 85 73 192 91 146 484 710 782 750 321 261 65 [968] 53 487 27 76 150 345 663 848 620 192 129 187 [969] 461 216 8 251 279 558 1012 838 1330 258 138 115 [970] 53 83 39 298 117 488 880 815 1087 390 266 355 [971] 225 184 173 121 167 416 411 667 605 172 60 157 [972] 318 138 552 192 100 461 450 852 190 361 17 192 Now, I would like to determine how many (space) there are in each line ... After to have wipes out the extra spaces (double spaces) with data1[i]-gsub(x=data1[i],pattern= ,replacement= ,fixed=FALSE,extended=FALSE) I have attempted with regrexpr, sub, strsplit and many other character fonctions but I could not obtain the number of in each line, in order to further do a test on it. The answer may be trivial but at this time I gave up!! Cheers Nicolas Degallier UMR 7159 / IRD UR182 Laboratoire d'Océanographie et du Climat, Expérimentation et Approches Numériques (LOCEAN) Tour 45-55, 4e ét., case 100, 4 place Jussieu 75252 Paris Cedex 5 France tél: (33) 01 44 27 51 57 fax: (33) 01 44 27 38 05 E-mail: [EMAIL PROTECTED] pdf reprints (login=anonymous; password=[EMAIL PROTECTED]): ftp://ftp.lodyc.jussieu.fr/LOCEAN/ndelod __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] R tcl/tk
Gabor Grothendieck wrote: But then when I ask help.search(R_HOME), I get nothing. Is something missing here in those help pages? Note that R_HOME corresponds to the R.home() path So I guess there _is_ something missing in those help pages, after all! Instead of R_HOME, the help page should mention R.home() evil grin Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] libz lib
Hi all, Please, what libz must/could I use to build RMySQL in my Mac OS X 10.4.8 box? Thanks! Best, Ricardo -- Ricardo Rodríguez Your EPEC ICT Team __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem about using list element in for cycle
Your problem is that you are using cat() on a factor. Use as.character() or format() to convert the factor to character data, which cat will then print in the way you want. x - data.frame(L=letters[1:3]) x L 1 a 2 b 3 c x$L [1] a b c Levels: a b c cat(x$L, \n) 1 2 3 cat(as.character(x$L), \n) a b c cat(format(x$L), \n) a b c Hu Chen wrote: sorry, pressed sent by mistake. for example data - read.csv(data.txt) single V1 V2 1 YHR165C CG8877 2 YJL130C CG18572 3 YDL171C CG9674 4 YKR054C CG7507 5 YDL140C CG1554 6 YLR106C CG13185 7 YGL206C CG9012 8 YNL262W CG6768 9 YER172C CG5931 typeof(data) [1] list for (i in 1:nrow(data)){ cat(data[i,1] } it'll not return things like YHR165C but number like 6,7,9.. is this a new feature of list? how to turn off it. thanks On 10/23/06, Hu Chen [EMAIL PROTECTED] wrote: for example data - read.csv(data.txt) typeof(data) [1] list for (i in 1:nrow(data)){ [[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 and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Construction of Dataset for time varying COXPH analysis
Question: When survfit() function is used upon a coxph object, the 'n' returned is vastly smaller (n=6) than the number of distinct loans in the dataset used. I am trying to estimate a Cox proportional hazards model for a set of loans (over 6000) using using time varying covariates. For this 6000+ loans, I have some 62,000 different vectors representing the loans at different periods of time. I did the following: resultsOpt - coxph(Surv(Start,Stop,PrepayDate)~ closingCoupon + loanPurposeId, data=latest) which returned: Call: coxph(formula = Surv(Start, Stop, PrepayDate) ~ closingCoupon + loanPurposeId, data = latest) coef exp(coef) se(coef)z p closingCoupon 0.101 1.11 0.0271 3.73 1.9e-04 loanPurposeId 0.434 1.54 0.0624 6.96 3.3e-12 Likelihood ratio test=50.3 on 2 df, p=1.18e-11 n= 62297 which seems fair. However when I do: survfit(resultsOpt) Call: survfit.coxph(object = resultsOpt) n events median 0.95LCL 0.95UCL 6 489 Inf Inf Inf the n = 6 when the number of distinct loans in the dataset is more like 6554. My dataset looks like the following when I call it from within R: latest[1:5, 1:5] Start Stop PrepayDate modBalance closingCoupon 1 67 0 811.2769 8.35 2 78 0 811.2769 8.35 3 89 1 811.2769 8.35 4 45 0 2226.0825 8.70 5 56 0 2226.0825 8.70 where the first 3 rows present 1 loan, and the next 2 loans a new one. Am I putting the data in an incorrect format, and if so how should I correct it? Thanks much. Pan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Hi,about the png device
Hi Li, Sadly, the png and jpg devices are not really appropriate for your needs, since they rely on the X11 device for their operation. In your case, the X11 device is not necessary, although if you did use it as you describe, it would let the png device work. However, there are other ways to get png and jpg output from R which do not require the X11 device. The pdf device gives beautiful pdf output, and the imagemagick tool can convert pdf into png. The still-in-development GD device can also output png and it can do it faster than pdf + imagemagick, although it does not come with the standard R distribution - you will have to get it from CRAN, and I don't personally think the output is as nice, so far (although it has the potential to be better). -Alex Brown On 23 Oct 2006, at 14:29, lidaof wrote: Hi, Thank you for your reply:) i thought maybe that is because i use SSH to run R maybe i should run R in front of a linux server and under Genome or KDE environment? i an a little confuse about that you said examine the pdf device and the convert (imagemagick) tool for best quality png output.,that seems i shoud install imagemagick fisr,then use pdf() to generate png picture? and forgive my pool english:) Thanks again! Li On 10/23/06, Alex Brown [EMAIL PROTECTED] wrote: Hi, Li: Your error message + the documention to png are sufficient for you to work out what has happened here. Here's a clue: your error message: 'unable to open connection to X11 display '' ' ?png ... 'They may not be usable unless the X11 display is available to the owner of the R process.' If you are using an interactive R session, you should examine why your X11 session is not available. If you are NOT using an interactive R session, I recommend you examine the pdf device and the convert (imagemagick) tool for best quality png output. -Alex Brown On 23 Oct 2006, at 03:45, lidaof wrote: Hi, i have a problem with png device that is my error log png(file=figure1.png);plot (significant,type=scatter);dev.off() Error in X11(paste(png::, filename, sep = ), width, height, pointsize, : unable to start device PNG In addition: Warning message: unable to open connection to X11 display '' i searched the mailing list,someone said because no libpng installed but i had installed the libpng and libpng-devel and i use Fedora Core4 my R version is 2.4.0 and i use RPMs to install any solution? Thanks Li -- DaoFeng,Li Box A1053 China Agriculture University, No.2 Yuanmingyuan Rd.West Haidian District Beijing,100094 P.R.China Tel:+86-10-62814726 Cell:+8613121987798 [[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 and provide commented, minimal, self-contained, reproducible code. -- DaoFeng,Li Box A1053 China Agriculture University, No.2 Yuanmingyuan Rd.West Haidian District Beijing,100094 P.R.China Tel:+86-10-62814726 Cell:+8613121987798 [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] getting the by() function to work properly
Hi Jasper, For me it seems that you are fooling around with attach() or something. For one thing, it will not work like this,: e.g. twodied=x[died==2,]is the first statement died is not locally defined, hence it is gotten from somewhere else... For the second thing, this will throw an error: by(ss3, sub, f3) sub is defind (unless attached from some data.frame), it is a statement. Both these seem to suggest that somewhere there is a version of your dataframe attached from which values are being read. As a quick fix I made the following: f3 - function(x) { attach(x) twodied - x[died==2,] twosaved=x[saved==2,] hit2=x[saved==2 choice==+,] fa2=x [died==2 choice==+,] d2=(qnorm(((nrow(hit2))/(nrow(twosaved-qnorm((nrow(fa2))/(nrow(twodied hitrate=((nrow(hit2))/(nrow(twosaved))) FArate=((nrow(fa2))/(nrow(twodied))) zhit2=qnorm(((nrow(hit2))/(nrow(twosaved zfa2=qnorm((nrow(fa2))/(nrow(twodied))) B2= -.5*(zhit2+zfa2) tp2=mean(twosaved$resp) ta2=mean(twodied$resp) tpsd2=sd(twosaved$resp) tasd2=sd(twodied$resp) dmj2=((tp2-ta2)/((tasd2+tpsd2)/2)) detach(x) L=list(d2=d2,B2=B2,dmj2=dmj2,tpsd2=tpsd2,tasd2=tasd2,tp2=tp2,ta2=ta2,hitrate=hitrate,FArate=FArate) return(L) } f3(SS2) by(SS2, SS2$sub, f3) It did not throw an error for me. As a note, could you not use table() or xtabs() for some of these calculations? All this nrow() stuff does not look very efficient. Kees On Monday 23 October 2006 04:49, Jancik, Jasper F. wrote: Hola everyone, Solving this issue would be a huge time saver for analyzing my thesis data, so I'll try to be as concise as possible and hope that someone can give me a hand. I am trying to run a function that I created, which works fine until I try to use it with the by function. That function is listed at the bottom (f3) just in case that might be the issue. Essentially I have compiled a large list of data coming from about 30 subjects with 88 trials each and I am trying to get that function to apply to each subject without having to manually attach each subject's data. The entire filename is 'ss2' so when i run ss2f3=f3(ss2) ss2f3 everything is fine. However when I try to use the by() function: by(ss3, sub, f3) #sub=subject header in the data I get the error message: Error in var(x, na.rm = na.rm) : missing observations in cov/cor There are no missing observations anywhere in the data so I'm really confused as to how this is happening. My professor thought it might have something to do with the variance calculations in the function, so when we had it remove bad data the function would run, however it did not calculate everything and it erroneously gave the exact same calculations for each subject. I even get the message when I try to manually subset the data e.g.: s2f3=f3(alldata[sub==2,]) Error in var(x, na.rm = na.rm) : missing observations in cov/cor I hope I've provided all the necessary info (the data set is attached just in case anyone has the time to make it work), but I'd be glad to give more if its needed. I would really appreciate any suggestions at all. Thanks in advance. f3=function(x) { + + twodied=x[died==2,]; + twosaved=x[saved==2,]; + hit2=x[saved==2 choice==+,]; + fa2=x [died==2 choice==+,]; d2=(qnorm(((nrow(hit2))/(nrow(twosaved-qnorm((nrow(fa2))/(nrow(twodied) ))); + hitrate=((nrow(hit2))/(nrow(twosaved))); FArate=((nrow(fa2))/(nrow(twodied))); + zhit2=qnorm(((nrow(hit2))/(nrow(twosaved;zfa2=qnorm((nrow(fa2))/(nrow(t wodied)));B2= -.5*(zhit2+zfa2); + tp2=mean(twosaved$resp); + ta2=mean(twodied$resp); + tpsd2=sd(twosaved$resp); + tasd2=sd(twodied$resp); + dmj2=((tp2-ta2)/((tasd2+tpsd2)/2)); + + L=list(d2=d2,B2=B2,dmj2=dmj2,tpsd2=tpsd2,tasd2=tasd2,tp2=tp2,ta2=ta2,hitrat e=hitrate,FArate=FArate) } Jasper Jancik 910.352.7546 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Worm distribution :-)
I don't know if anyone has heard this tale, but it runs more or like this way: A biologist was studing a (semi-spherical) cave where bats lives. He fell asleep in the cave, and he woke up in the middle of the night. Half-dreaming, he thought that he was outside, because glow-worms were living in the walls, and they looked like stars. However, he noticed that, unlike a real sky, these stars had no _pattern_: there were no recognized images like The Cross, a Scorpion, The Hunter, etc. When he woke up, he conjectured that the reason we _can_ see patterns in the real sky is that the stars are randomly distributed, while the glow-worms tried to keep a distance to each other. My question: what is the best way to generate a glow-worm-like distribution? I imagine that using a Latin Hypercube would leave too many holes in the (x,y) plane. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Worm distribution :-)
You are talking about random point patterns, since the glow-worms appear as ``stars'' (= points). See the package ``spatial'' (which comes with R) and try simulating a pattern using Strauss(). Or install the package ``spatstat'' from CRAN --- in this package there is a variety of ways to simulate ``regular'' random point patterns --- rMaternI, rMaternII, rSSI, and rmh (which simulates several point pattern models depending on the specified Papangelou conditional intensity function). cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Worm distribution :-)
Have you heard of Boids? (google it if not) Depending upon what you want this for a simulation approach might be appropriate. Regards, Ana Nelson On 23 Oct 2006, at 18:18, Alberto Monteiro wrote: I don't know if anyone has heard this tale, but it runs more or like this way: A biologist was studing a (semi-spherical) cave where bats lives. He fell asleep in the cave, and he woke up in the middle of the night. Half-dreaming, he thought that he was outside, because glow-worms were living in the walls, and they looked like stars. However, he noticed that, unlike a real sky, these stars had no _pattern_: there were no recognized images like The Cross, a Scorpion, The Hunter, etc. When he woke up, he conjectured that the reason we _can_ see patterns in the real sky is that the stars are randomly distributed, while the glow-worms tried to keep a distance to each other. My question: what is the best way to generate a glow-worm-like distribution? I imagine that using a Latin Hypercube would leave too many holes in the (x,y) plane. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Methods of addressing multicollinearity in multiple linear regression with R
In searching the R help archives I find a number of postings in April of 2005, but nothing since then. If readers are aware of more recent contributions addressing the problems arising from multicollinearity (such as with the bootstrap, jackknife, or other techniques) I would appreciate a reference. Thank you, Ben Fairbank [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Key colour problem with lattice plot
On 10/23/06, Alex Brown [EMAIL PROTECTED] wrote: Hi Geoffrey, I replicated your problem, and I came up with the same solution as Deepayan, so I won't reprint it here but: Can anyone explain why the key is inverted versus the bar order? Because the key goes from top to bottom, while cartesian coordinates go from bottom to top. Neither can really be any other way by default, if you think about it. I did promise someone that I would add an option to reverse the order in key, but looks like I haven't done that yet. I'd also like to thank you for showing me a different approach to lattice formulae. I would have used the following formulation: ex2 = stack(example) ex3 = cbind(country=rep(rownames(example),2),ex2) barchart(country ~ values, ex3,group=ind, auto.key=TRUE) Since we are talking about alternatives, here's another: barchart(as.matrix(example), stack = FALSE, auto.key = TRUE) -Deepayan -Alex Brown __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Bayesian Information Criterion
Hello! I calculate a Bayesian logistic regression with the function MCMClogit from the package MCMCpack. After the calculation I use the package CODA to test the model in respect to convergence. Is there a compatible package to calculate the BIC (bayesian information criterion)? So that it is possible to write BIC(mcmc object) with an mcmc object from the function MCMClogit. I found the package nlme, but the function BIC in this package does not work with the mcmc object from the function MCMClogit. Regards Alex -- Alexander Geisler * Moserhofgasse 36/1 * A-8010 Graz StV Technische Mathematik | FakV TMTP email: [EMAIL PROTECTED] | [EMAIL PROTECTED] phone: +43 650 / 811 61 90 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] toggleDoc: clutter reduction mainly for S4 documentation files
The following perl-script is available from http://www.menne-biomed.de/download/toggleDoc.zip After it is tested on other systems (currently only Windows), I plan to upload it to http://cran.mirroring.de/other-software.html toggleDoc.pl: Clutter reduction for S4-R documentation files. Version 1.0, 23.10.2006 [EMAIL PROTECTED] Perl script to optionally reduce clutter in the index file of S4 html and in S3 files with many repetitive functions documentation. For an example using the documentation of the coin package, see http://www.menne-biomed.de/download/00Index.html . Install and Convert Put the file toggleDoc.pl and the javascript file toggleDoc.js into the Rxxx/library directory (you should find the R.css file there). For the protection of your valuable assets, when you run this script unmodified new files 00IndexNew.html will be generated in each directory. If you want to replace your original 00Index.html with the modified ones, re-run this script with the two commented lines a the bottom of the Perl script commented out. * Warning: this script has been tested under Windows only. Please report required changes for Linux to [EMAIL PROTECTED] What it does: Only 00Index.html files are changed by adding a javascript reference and a checkbox to switch between the Show All mode and the short mode; the latter is made the default on startup. All references that have a , are hidden in the short mode, e.g. dperm,IndependenceTest-method In addition, repetitive similar entries with a common target file are collapsed to the first entry. For example, in R2HTML the following list only shows the first HTML reference in short mode. HTML Outputs an object to a HTML file HTML.anova.loglm Outputs an object to a HTML file HTML.aovOutputs an object to a HTML file The program does not touch files with the string toggleDoc.js in the header, so if you want to protect single files from being processed, simply add this string in a comment to the html file (but not that this will be overridden anyway on the next update.) The function has been tested with IE and Firefox 1.5. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Plotting Text on a graph
Hi, I plotted 12 graphs on a page and output to a png file. I wanted to have an overall title for all 12 graphs. What command can I use to do this? Below is the code that plotted the 12 graphs in one page. # FM10 by Month/ Export the plot to Wash2005FM10.png png(file=Wash2005FM10.png,bg=white) par(mfrow = c(3,4)) # Plot 12 Month of OFM10, FFM10 for(i in 1:12) { Temp - subset (Wash2005, MM == i) plot (Temp$FM10.1, Temp$FM10,main=month.name[i],xlim=c(5,25),ylim=c(5,25)) } text(10,10, Overall Title) 'This will plot Overall Title at coordinate (10,10) on the last graph, and so it is not what I want. dev.off() Thank you. Daniel Chan Meteorologist Georgia Forestry Commission P O Box 819 Macon, GA 31202 Tel: 478-751-3508 Fax: 478-751-3465 [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plotting Text on a graph
Have you thought of using split.screen instead? Something like might work for you: split.screen(c(1,1)) split.screen(c(3,4), 1) for (i in 1:12) { screen(i+1) par(mar=c(2,2,4,2)) plot(1:20,rnorm(20),xlab=,ylab=) } screen(1) title(Overall title) On 23/10/06, Dan Chan [EMAIL PROTECTED] wrote: Hi, I plotted 12 graphs on a page and output to a png file. I wanted to have an overall title for all 12 graphs. What command can I use to do this? Below is the code that plotted the 12 graphs in one page. # FM10 by Month/ Export the plot to Wash2005FM10.png png(file=Wash2005FM10.png,bg=white) par(mfrow = c(3,4)) # Plot 12 Month of OFM10, FFM10 for(i in 1:12) { Temp - subset (Wash2005, MM == i) plot (Temp$FM10.1, Temp$FM10,main=month.name[i],xlim=c(5,25),ylim=c(5,25)) } text(10,10, Overall Title) 'This will plot Overall Title at coordinate (10,10) on the last graph, and so it is not what I want. dev.off() Thank you. Daniel Chan Meteorologist Georgia Forestry Commission P O Box 819 Macon, GA 31202 Tel: 478-751-3508 Fax: 478-751-3465 [[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 and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Plotting text on a graph
Hi Daniel: Here is a sample code that I have used: z1 - rexp(100) z2 - rexp(100) z3 - rexp(100) par(mfrow=c(2,2),oma = c(0, 0, 3, 0)) curve(dexp,from=0,to=5) hist(z1,main=Size 5) hist(z2,main=Size 15) hist(z3,main=Size 30) mtext(Densities, outer = TRUE, cex = 1.5) And this will do the trick. Hope this helps! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] Hi, I plotted 12 graphs on a page and output to a png file. I wanted to have an overall title for all 12 graphs. What command can I use to do this? Below is the code that plotted the 12 graphs in one page. # FM10 by Month/ Export the plot to Wash2005FM10.png png(file=Wash2005FM10.png,bg=white) par(mfrow = c(3,4)) # Plot 12 Month of OFM10, FFM10 for(i in 1:12) { Temp - subset (Wash2005, MM == i) plot (Temp$FM10.1, Temp$FM10,main=month.name[i],xlim=c(5,25),ylim=c(5,25)) } text(10,10, Overall Title) 'This will plot Overall Title at coordinate (10,10) on the last graph, and so it is not what I want. dev.off() Thank you. Daniel Chan Meteorologist Georgia Forestry Commission P O Box 819 Macon, GA 31202 Tel: 478-751-3508 Fax: 478-751-3465 [[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 and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Color eps/ps output from specialized plots?
Hello, First a disclaimer :) I am very new to using R. I am generating some plots and eventhough I can get colored output in the encapsulated postscript files in the simplest of commands (e.g. plot(1:10,1:10, type=l, col=red) ), it does not work for the particular plots I want. It works on the screen. Here is an example taken out from Mixed-Effects Models in S and S-Plus by Pinheiro and Bates; library(nlme) plot(CO2) postscript(tmp.eps) plot(CO2) dev.off() The first plot has few colors on the screen, but postscript output is monochrome. I tried a more complex one too: postscript(test1.eps,horizontal = FALSE, onefile = FALSE, paper = special). BTW, loading NLME chances the built-in (is it really?) data-set CO2 to a groupeddata with a formula uptake ~ conc | Plant , which could be recreated as: CO2 - groupedData( uptake ~ conc | Plant,data=CO2) I could not dig out any pointers on figuring this issue out from the internet, specially since the simple plot command works. Turgut __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Extended CR model
I was wondering if someone could point me to the R package that implements the partial proportional odds (PO) model discussed by Peterson and Harrell (1990). In Harrell (2001), the model is explained in Chapt. 13. Respectfully, Frank R. Lawrence __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help with recode and factor functions
I have a data set with seven inputs. Four of which are categorical. For my midterm, my professor wants us to scale all the inputs. This means, I pressume, that I have to use 'recode' or 'factor' to transform the categorical data in numerical. For example, one input variable is 'race=(b,w,h,o)'. I just want to assign a numerical value to all 'b,w,h,o'. I thought 'recode' should do this, but it doesn't work. Here's the code I'm using for recode: recode(race, b='1';w='2';h='3';o='4') this is the error I get: Error in eval(expr, envir, enclos) : object o not found It's not that there's no o. If I change the order or combination of the variables, it always can't find one of them. I could also use 'factor', from what I hear. But, I looked at the help section on this function and I ended up more confused. How do I code it so these variables take on numerial values? I need to be able to use: race.centered = race - mean(race) This scaling code doesn't really make sense if the values of 'race' are non-numerical. I might end up dividing by 2 SD's as well. But, I don't know if I need to. I'll have to do some more reading. Thank you for your help! [[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 and provide commented, minimal, self-contained, reproducible code.
[R] The Censummary Function...
Hi Forum, I am new and learning this research tool. was trying to run some tests on a censored dataset using the NADA library. Everything is hunky dory except 'censummary' throws an error and I am trying to figure out a reason for this. Please help! below you will see the error statement... thnx --nk library(NADA) Loading required package: survival Loading required package: splines AsExample -structure(list(AsLow = as.integer(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), AsHigh = as.integer(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)), AsCen = as.integer(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1))), .Names = c(AsLow, AsHigh, AsCen), class = data.frame, row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)) AsExample AsLow AsHigh AsCen 1 0 1 1 2 0 1 1 3 0 1 1 4 0 1 1 5 0 1 1 6 0 1 1 7 0 1 1 8 0 1 1 9 0 1 1 10 0 1 1 11 0 1 1 12 1 3 1 13 1 3 1 14 1 3 1 15 1 3 1 16 1 3 1 17 1 3 1 18 1 3 1 19 1 3 1 20 1 3 1 21 1 3 1 22 1 3 1 23 1 3 1 24 1 3 1 names(AsExample) [1] AsLow AsHigh AsCen censummary(AsLow, AsHigh, AsCen) Error: object AsLow not found Error in censummary(AsLow, AsHigh, AsCen) : unable to find the argument 'obs' in selecting a method for function 'censummary' [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to create a vector with different categories in a simple way?
Thank you so much, Marc and Phil. Unfortunenately, I misunderstood the problem myself and wasn't clear how i wanted the variables to be. I will describe the issue again and hope you can help me out. Here is part of data called layout Id Name block col row 1 a1 11 2 b1 21 3 c131 4 a14 1 5 b112 6 c122 7 b132 8 c14 2 9 d 1 1 3 10 e 1 2 3 11 a 1 3 3 12 d 1 4 3 13 e 1 1 4 14 a 1 2 4 15 d 1 3 4 16 c 1 4 4 17 d 2 1 1 18 c 2 2 1 19 e 2 3 1 20 d 2 4 1 21 b 2 1 2 22 e 2 2 2 23 f2 3 2 24 d 2 4 2 32 a 2 4 4 and so on .. . . . .. . . . .. . . . 768 f 48 44 As you can see for each row there are 4 columns. the total observations in each block is 16. My real data contains 48 blocks which give totally 768 observations. The blocks ranged from 1-48 are displayed four and four after each other like below. Note there are 4 rows and 4 columns in each block. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 What I want is to create two variables called blockrow respective blockcol in such a way that blockrow will have value 1 for block 1,2 3 and 4, blockrow=2 for blocks 5,6,7 and 8 and so on. Similarly, blockcol = 1 for blocks 1,5 ,9,13,17,21,25,29,33,37,41 and 44 and so on. As you can see there are 12 blockrows and 4 blockcols. The data should look like Id Name block col row blockrow blockcol 1 a1 11 11 2 b1 21 11 3 c131 11 4 a14 1 11 5 b112 11 6 c122 1 1 7 b132 1 1 8 c142 1 1 9 d1 1 3 1 1 10 e 1 2 3 1 1 11 a 1 3 3 1 1 12 d 1 4 3 1 1 13 e 1 1 4 1 1 14 a 1 2 4 1 1 15 d 1 3 4 1 1 16 c 1 4 4 1 1 17 d 2 1 1 1 2 18 c 2 2 1 1 2 19 e 2 3 1 1 2 20 d 2 4 1 1 2 21 b 2 1 2 1 2 22 e 2 2 2 1 2 23 f2 3 2 1 2 24 d 2 4 2 1 2 32 a 2 4 4 and so on .. . . . .. . . . .. . . . 768 f 48 44 12 4 I have an algorithm blockrow -1 if(layout$block = 4) blockrow -1 if(5=layout$block = 8) blockrow -2 if(9=layout$block = 12) blockrow -3 and so on Can I do a for loop like : #-- Append some more columns to matrix layout-- blockrow-rep(0,nrow(layout)) blockcol-rep(0,nrow(layout)) for (a in 1:12){ if(4*a+1=layout$block=(a+1)*4) blockrow-(a+1) } Similarly, blockcol-1 if(layout$block = 5,9,13,17,21,25,29,33,37,41,45) blockcol-1 if(layout$block = 2,6,10,14,18,22,26,30,34,38,42,46) blockcol-2 and so on which give the for loop blockcol-1 for (a in 1:12){ if(layout$block==(4*a+1)) blockrow-1 } or how can i do it in R so I get blockrow and blockcol as i want ? Thanks again for your help, Best regards, Yen [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Color eps/ps output from specialized plots?
On 10/23/06, Turgut Durduran [EMAIL PROTECTED] wrote: Hello, First a disclaimer :) I am very new to using R. I am generating some plots and eventhough I can get colored output in the encapsulated postscript files in the simplest of commands (e.g. plot(1:10,1:10, type=l, col=red) ), it does not work for the particular plots I want. It works on the screen. Here is an example taken out from Mixed-Effects Models in S and S-Plus by Pinheiro and Bates; library(nlme) plot(CO2) postscript(tmp.eps) plot(CO2) dev.off() You are seeing the results of what was, in hindsight, an unfortunate design decision in nlme. Since the plot function in R is generic, not all plot() calls are guaranteed to behave the same way. In particular, the (several) plot() functions in nlme don't actually plot anything, instead they return an object of class trellis, which themselves need to be 'plot'ted or 'print'ed to see any output. Now, this is not normally a problem, but it is when you run your code through source (which I presume you are, although you have neglected to mention it). The solution is to replace the plot(CO2) command by either print(plot(CO2)) or the even odder plot(plot(CO2)) See http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f for a relevant discussion. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] unexpected read.csv behavior
Example data in a recent post was: LandFill Ruminants United States (USA) .214280 5528.16 France 200.527083 1299.87 Australia185.878368 2448.17 Russian Federation 1752.833400 2024.29 Argentina283.987320 2567.02 Brazil 1048.422480 8839.61 Colombia 265.125000 1307.61 Mexico 981.023351 1814.89 Ethiopia 9.380204 1237.49 Sudan 16.018494 1796.67 India553.425328 12360.30 Pakistan 47.159393 2346.71 China455.680191 8041.79 In trying to play with this posting, I saved the data as a .csv file where the first row had only two entries and read: , LandFill, Reminants I tried reading the data in with read.csv(ex.csv, header=TRUE) To my surprise this created a 3 column dataframe with the first column labeled as X. X was a factor. According to the help file: If there is a header and the first row contains one fewer field than the number of columns, the first column in the input is used for the row names. Otherwise if row.names is missing, the rows are numbered. I got the expected default behavior of having the unlabeled column become row labels when I tried, read.csv(ex.csv, header=TRUE, row.names=1) Is this unexpected behavior somehow related to how I designed a .csv file or is there something I'm misinterpreting in the documentation? Thanks, Rob Baer version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) [[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 and provide commented, minimal, self-contained, reproducible code.
[R] nested if/else very slow, more efficient ways?
Hello, in the data.frame resultsfuzzy I would like to replace the characters in the second column (5a, 5b, ... 5e) with numbers from 1 to 5. The data.frame has 39150 entries. I seems to work on samples that are nrow(resultsfuzzy) but it takes suspicously long. Do you have any suggestions how to make the character replacing more efficient? Code: for (i in 1:nrow(resultsfuzzy)) { if (resultsfuzzy[i,2] == 5a){resultsfuzzy[i,2] - 1} else if (resultsfuzzy[i,2] == 5b){resultsfuzzy[i,2] - 2} else if (resultsfuzzy[i,2] == 5c){resultsfuzzy[i,2] - 3} else if (resultsfuzzy[i,2] == 5d){resultsfuzzy[i,2] - 4} else resultsfuzzy[i,2] - 5 } Thanks, Kim 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 __ Kim Milferstedt University of Illinois at Urbana-Champaign Department of Civil and Environmental Engineering 4125 Newmark Civil Engineering Laboratory 205 North Mathews Avenue MC-250 Urbana, IL 61801 USA phone: (001) 217 333-9663 fax: (001) 217 333-6968 email: [EMAIL PROTECTED] http://cee.uiuc.edu/research/morgenroth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] The Censummary Function...
Try: censummary(AsExample$AsLow, AsExample$AsHigh, AsExample$AsCen) From the Introduction to R (http://cran.r-project.org/doc/manuals/R- intro.html#Lists-and-data-frames): Components of lists may also be named, and in this case the component may be referred to either by giving the component name as a character string in place of the number in double square brackets, or, more conveniently, by giving an expression of the form name$component_name The same goes for data.frames. Jeff. On Oct 23, 2006, at 5:38 PM, nand kumar wrote: Hi Forum, I am new and learning this research tool. was trying to run some tests on a censored dataset using the NADA library. Everything is hunky dory except 'censummary' throws an error and I am trying to figure out a reason for this. Please help! below you will see the error statement... thnx --nk library(NADA) Loading required package: survival Loading required package: splines AsExample -structure(list(AsLow = as.integer(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), AsHigh = as.integer(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)), AsCen = as.integer(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1))), .Names = c (AsLow, AsHigh, AsCen), class = data.frame, row.names = c (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)) AsExample AsLow AsHigh AsCen 1 0 1 1 2 0 1 1 3 0 1 1 4 0 1 1 5 0 1 1 6 0 1 1 7 0 1 1 8 0 1 1 9 0 1 1 10 0 1 1 11 0 1 1 12 1 3 1 13 1 3 1 14 1 3 1 15 1 3 1 16 1 3 1 17 1 3 1 18 1 3 1 19 1 3 1 20 1 3 1 21 1 3 1 22 1 3 1 23 1 3 1 24 1 3 1 names(AsExample) [1] AsLow AsHigh AsCen censummary(AsLow, AsHigh, AsCen) Error: object AsLow not found Error in censummary(AsLow, AsHigh, AsCen) : unable to find the argument 'obs' in selecting a method for function 'censummary' [[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 and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] unexpected read.csv behavior
On 10/23/2006 5:54 PM, Robert Baer wrote: Example data in a recent post was: LandFill Ruminants United States (USA) .214280 5528.16 France 200.527083 1299.87 Australia185.878368 2448.17 Russian Federation 1752.833400 2024.29 Argentina283.987320 2567.02 Brazil 1048.422480 8839.61 Colombia 265.125000 1307.61 Mexico 981.023351 1814.89 Ethiopia 9.380204 1237.49 Sudan 16.018494 1796.67 India553.425328 12360.30 Pakistan 47.159393 2346.71 China455.680191 8041.79 In trying to play with this posting, I saved the data as a .csv file where the first row had only two entries and read: , LandFill, Reminants I tried reading the data in with read.csv(ex.csv, header=TRUE) To my surprise this created a 3 column dataframe with the first column labeled as X. X was a factor. According to the help file: If there is a header and the first row contains one fewer field than the number of columns, the first column in the input is used for the row names. Otherwise if row.names is missing, the rows are numbered. Your first row contains 3 columns, the first one blank. You don't want a comma before LandFill. Duncan Murdoch I got the expected default behavior of having the unlabeled column become row labels when I tried, read.csv(ex.csv, header=TRUE, row.names=1) Is this unexpected behavior somehow related to how I designed a .csv file or is there something I'm misinterpreting in the documentation? Thanks, Rob Baer version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) [[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 and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Key colour problem with lattice plot
Can anyone explain why the key is inverted versus the bar order? Because the key goes from top to bottom, while cartesian coordinates go from bottom to top. Neither can really be any other way by default, if you think about it. I did promise someone that I would add an option to reverse the order in key, but looks like I haven't done that yet. In the case of barchart, what would be the justification for not ordering the bars (in a group) as for the key, or vice versa? Please forgive my ignorance - I am curious to understand the design principles. I am certainly very pleased to have the power of auto.key in lattice - it's the main reason why I stopped using the default plot function. -Alex Brown __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] nested if/else very slow, more efficient ways?
One way that might do what you want is to change the character column to a factor, and then apply as.numeric. resultsfuzzy$x-as.numeric(factor(resultsfuzzy$x,levels=c(5a,5b,5c,5d,5e))) This assumes, of course, that you know that the levels are going to be in the set {5a,5b,5c,5d,5e}. However, it may be better to just leave it as a factor, depending upon what you intend to do with it later. Hope this helps. Regards, Mike On 10/23/06, Kim Milferstedt [EMAIL PROTECTED] wrote: Hello, in the data.frame resultsfuzzy I would like to replace the characters in the second column (5a, 5b, ... 5e) with numbers from 1 to 5. The data.frame has 39150 entries. I seems to work on samples that are nrow(resultsfuzzy) but it takes suspicously long. Do you have any suggestions how to make the character replacing more efficient? Code: for (i in 1:nrow(resultsfuzzy)) { if (resultsfuzzy[i,2] == 5a){resultsfuzzy[i,2] - 1} else if (resultsfuzzy[i,2] == 5b){resultsfuzzy[i,2] - 2} else if (resultsfuzzy[i,2] == 5c){resultsfuzzy[i,2] - 3} else if (resultsfuzzy[i,2] == 5d){resultsfuzzy[i,2] - 4} else resultsfuzzy[i,2] - 5 } Thanks, Kim 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 __ Kim Milferstedt University of Illinois at Urbana-Champaign Department of Civil and Environmental Engineering 4125 Newmark Civil Engineering Laboratory 205 North Mathews Avenue MC-250 Urbana, IL 61801 USA phone: (001) 217 333-9663 fax: (001) 217 333-6968 email: [EMAIL PROTECTED] http://cee.uiuc.edu/research/morgenroth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Regards, Mike Nielsen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] nested if/else very slow, more efficient ways?
There are a number of ways this might be approached. Can you please give a sample of your data, and your desired output? Are 5a ... 5e the only values that appear in that column, or are there other values, 4e for instance, that should stay the same during your conversion? Do you wish to use the numbers 1 to 5 in the processed column in arithmetic processing, or are they just an enumeration of possible values? While you think about it, I direct your attention to the functions: sub factor -Alex On 23 Oct 2006, at 23:03, Kim Milferstedt wrote: Hello, in the data.frame resultsfuzzy I would like to replace the characters in the second column (5a, 5b, ... 5e) with numbers from 1 to 5. The data.frame has 39150 entries. I seems to work on samples that are nrow(resultsfuzzy) but it takes suspicously long. Do you have any suggestions how to make the character replacing more efficient? Code: for (i in 1:nrow(resultsfuzzy)) { if (resultsfuzzy[i,2] == 5a){resultsfuzzy[i,2] - 1} else if (resultsfuzzy[i,2] == 5b){resultsfuzzy[i,2] - 2} else if (resultsfuzzy[i,2] == 5c){resultsfuzzy[i,2] - 3} else if (resultsfuzzy[i,2] == 5d){resultsfuzzy[i,2] - 4} else resultsfuzzy[i,2] - 5 } Thanks, Kim 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 __ Kim Milferstedt University of Illinois at Urbana-Champaign Department of Civil and Environmental Engineering 4125 Newmark Civil Engineering Laboratory 205 North Mathews Avenue MC-250 Urbana, IL 61801 USA phone: (001) 217 333-9663 fax: (001) 217 333-6968 email: [EMAIL PROTECTED] http://cee.uiuc.edu/research/morgenroth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] nested if/else very slow, more efficient ways?
On 10/23/2006 6:03 PM, Kim Milferstedt wrote: Hello, in the data.frame resultsfuzzy I would like to replace the characters in the second column (5a, 5b, ... 5e) with numbers from 1 to 5. The data.frame has 39150 entries. I seems to work on samples that are nrow(resultsfuzzy) but it takes suspicously long. Do you have any suggestions how to make the character replacing more efficient? I don't know if nested if/else is inefficient, but indexing of data.frames certainly is. You would do a lot better with ifelse() on the whole column. For example, if column 2 is named B, this would be much faster: resultsfuzzy$B - ifelse(resultsfuzzy$B == 5a, 1, ifelse(resultsfuzzy$B == 5b, 2, ... )) (where you'll have to fill in the ... yourself in the obvious way. But an even faster way for your particular problem would be resultsfuzzy$B - match(resultsfuzzy$B, c(5a, 5b, 5c, 5d, 5e)) Duncan Murdoch Code: for (i in 1:nrow(resultsfuzzy)) { if (resultsfuzzy[i,2] == 5a){resultsfuzzy[i,2] - 1} else if (resultsfuzzy[i,2] == 5b){resultsfuzzy[i,2] - 2} else if (resultsfuzzy[i,2] == 5c){resultsfuzzy[i,2] - 3} else if (resultsfuzzy[i,2] == 5d){resultsfuzzy[i,2] - 4} else resultsfuzzy[i,2] - 5 } Thanks, Kim 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 __ Kim Milferstedt University of Illinois at Urbana-Champaign Department of Civil and Environmental Engineering 4125 Newmark Civil Engineering Laboratory 205 North Mathews Avenue MC-250 Urbana, IL 61801 USA phone: (001) 217 333-9663 fax: (001) 217 333-6968 email: [EMAIL PROTECTED] http://cee.uiuc.edu/research/morgenroth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] pdf/ convert/ font problem
Hi Sam McClatchie wrote: Background: OS: Linux Ubuntu Dapper R : Version 2.3.1 (2006-06-01) Emacs 21.4.1 ESS Colleagues This is neither a bug report, nor a complaint, so I think this is the appropriate list. I am getting an odd font problem with a pdf generated using pdf(file = ../figures/PCNM.models.larvae.fluor.zoo.stability.2001.and.2002.pdf, title=, family=serif, pointsize=10, width=6.75, height=8.625) The figure produced from my code is here: http://www.members.iinet.net.au/~s.mcclatchie/aslo/PCNM.models.larvae.fluor.zoo.stability.2001.and.2002.pdf (I can't really send all of the code as there are several subroutines for the analysis that are not relevant here anyway). The pdf loads into acroread or xpdf fine, so is not corrupted, but ghostscript gives an error: Acroread (Windows) works for me, xpdf (Linux CentOS) thrashes my machine for ever (or until I gave up), and ghostscript gives me ... /undefinedresult in --currentpoint-- ... but I can't see anything obvious in the raw PDF. ERROR: /invalidfont in --.type1execchar--ESP Ghostscript 815.02: Unrecoverable error, exit code 1 Operand stack: --dict:4/4(L)-- --dict:16/17(ro)(G)-- 108 a71 -string- Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nostringval-- %finish_show --nostringval-- --nostringval-- 7 9 1 --nostringval-- (gs_show_enum) %op_show_continue Dictionary stack: --dict:1124/1686(ro)(G)-- --dict:0/20(G)-- --dict:85/200(L)-- --dict:104/127(ro)(G)-- --dict:241/347(ro)(G)-- --dict:20/24(L)-- --dict:4/6(L)-- --dict:20/20(L)-- --dict:12/13(L)-- Current allocation mode is local -- Also Imagemagick cannot display or convert the file to .png: I think that's the same problem: ImageMagick is just calling ghostscript. Sorry, no solution to suggest yet. Paul [EMAIL PROTECTED]:~/dynamic_data/projects2005/sardine_egg_distribution/journal$ convert PCNM.models.larvae.fluor.zoo.stability.2001.and.2002.pdf PCNM.models.larvae.fluor.zoo.stability.2001.and.2002.png ERROR: /invalidfont in --.type1execchar-- Operand stack: --dict:4/4(L)-- --dict:15/16(ro)(G)-- 108 a71 -string- Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nostringval-- %finish_show --nostringval-- --nostringval-- 9 10 1 --nostringval-- (gs_show_enum) %op_show_continue Dictionary stack: --dict:1125/1686(ro)(G)-- --dict:0/20(G)-- --dict:85/200(L)-- --dict:85/200(L)-- --dict:104/127(ro)(G)-- --dict:241/347(ro)(G)-- --dict:20/24(L)-- --dict:4/6(L)-- --dict:20/20(L)-- --dict:12/13(L)-- Current allocation mode is local ESP Ghostscript 815.02: Unrecoverable error, exit code 1 convert: Postscript delegate failed `PCNM.models.larvae.fluor.zoo.stability.2001.and.2002.pdf'. I have all of the true type fonts installed. Probably the solution is just to use png() rather than pdf(), but I thought this problem was curious enough to report. Best fishes Sam -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Key colour problem with lattice plot
On 10/23/06, Alex Brown [EMAIL PROTECTED] wrote: Can anyone explain why the key is inverted versus the bar order? Because the key goes from top to bottom, while cartesian coordinates go from bottom to top. Neither can really be any other way by default, if you think about it. I did promise someone that I would add an option to reverse the order in key, but looks like I haven't done that yet. In the case of barchart, what would be the justification for not ordering the bars (in a group) as for the key, or vice versa? Please forgive my ignorance - I am curious to understand the design principles. I am certainly very pleased to have the power of auto.key in lattice - it's the main reason why I stopped using the default plot function. No particular reason, it's just (I think) one of the weaknesses in the Trellis design. There is no actual communication between legends and panel functions. Basically, the flexibility of Trellis comes from almost completely separating the various elements of a graphic, and you get an illusion of consistency if all the elements are allowed to derive their defaults from the same settings. This is the reason there will never be (without wrappers or other kinds of hacks) any hope of 'auto.key' ``detecting'' when you give a col=c('green', 'red') argument to xyplot (or panel.xyplot) and changing colors automatically in response. If you think about it, panel.barchart does the only reasonable thing, namely order levels in the right direction. If you want things to be ordered from top to bottom, you can reverse the axes: barchart(as.matrix(example), stack = FALSE, ylim = c(14, 0)) which will lose the nice labels, but that's again a whole different element of the graph. Changing the order for bars within y-levels is one option, but would you really want that when the bars are vertical? Similarly, the legend also does the only reasonable thing. It should have an option to reverse the order, and it will in the next version of lattice (which I plan to upload within a couple of days), where you should be able to say: barchart(as.matrix(example), stack = FALSE, auto.key = list(reverse.rows = TRUE)) -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Replacing for loop with apply type function.
Hi Everyone, I want to replace the following for loop with an apply type function to (possibly) speed up the process. # The for loop I want to replace x - numeric(10) for(i in 2:10) x[i] - x[i-1]+1 x To give you some more background, I am running a Metropolis Hastings MCMC chain with k parameters. So, if x represents the sample from the chain, the ith row (representing the ith iteration) depends on the (i-1)th row. Thanks in advance, Ritwik Sinha Graduate Student Epidemiology and Biostatistics Case Western Reserve University [EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extended CR model
The posting guide (see below) suggests using something like RSiteSearch(continuation ratio) before posting to the list. There are many relevant hits including several to packages on CRAN. On Mon, 23 Oct 2006, Cougar Lawrence wrote: I was wondering if someone could point me to the R package that implements the partial proportional odds (PO) model discussed by Peterson and Harrell (1990). In Harrell (2001), the model is explained in Chapt. 13. Respectfully, Frank R. Lawrence __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extended CR model
Or better still RSiteSearch(partial proportional odds) and see the second hit. On Mon, 23 Oct 2006, Charles C. Berry wrote: The posting guide (see below) suggests using something like RSiteSearch(continuation ratio) before posting to the list. There are many relevant hits including several to packages on CRAN. On Mon, 23 Oct 2006, Cougar Lawrence wrote: I was wondering if someone could point me to the R package that implements the partial proportional odds (PO) model discussed by Peterson and Harrell (1990). In Harrell (2001), the model is explained in Chapt. 13. Respectfully, Frank R. Lawrence __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] why it returns list level number instead of its content?
for example: I have a data frame. data$V4 returns: . [6936] P05796 P11096 P76174 P04475 P18775 [6941] P33225 P76387 P76388 P76388 P09375 [6946] P15300 P15723 1375 Levels: O50190 O65938 O69415 P00274 P00363 P00364 P00370 P00373 ... Q9AJ15 data$V5 returns something like data$V4 I want to cbind this two columns, so I use new - cbind(data$V4,data$V5) I expect it to return something like: [1] P05761 P11986 [2] ... however it returns [1] 215 434 [2] 134 213 . it uses level number instead of its content like P05761. What's wrong with it? how can I get its content instead of level number? I can use some dirty ways to do that but I didn't understand why. [[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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] linear mixed effects models with breakpoints
Are you familiar with how to include include the desired serial correlation structure in 'lme', ignoring the breakpoint question? If no, please consult Pinheiro and Bates (2000) Mixed-Effects Models in S and S-Plus (Springer)? If yes, it should be a relatively easy matter to add that to the 'lmeChgPt' function. If you'd like further help from this listserve, please provide commented, minimal, self-contained, reproducible code, as suggested in the posting guide www.R-project.org/posting-guide.html. Hope this helps. Spencer Graves Ewan Wakefield wrote: Hi folks I have some data to which I've been fitting linear mixed effects models. I am currently using a lme model in the nlme package, with terms for random effects due to repeated measures on individuals and the corCAR1 serial correlation structure. However, there is some suggestion in the data (and from theory) that a breakpoint (change point) model may be more appropriate. Scott, Norman and Berger's lmeChgPt model seems to go some way to fitting the requirements for such a model but does not incorporate, as I understand it, a serial correlation structure. Is anyone aware of a model fitting procedure that incorporates the correlation structures of the lme models in a breakpoint model? Kind regards, Ewan Wakefield British Antarctic Survey, High Cross, Madingley Road, Cambridge CB3 OET Tel. +44 (0) 1223 221215 E-mail: [EMAIL PROTECTED] Website: antarctica.ac.uk -- This message (and any attachments) is for the recipient only...{{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 and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] why it returns list level number instead of its content?
The class factor is defined for vectors, not matrices. The attempt to use a factor in a matrix setting coerces it to numeric. See the documentation for factor where it says In particular, as.numeric applied to a factor is meaningless, and may happen by implicit coercion. tmp - matrix(1:8, 4) tmp [,1] [,2] [1,]15 [2,]26 [3,]37 [4,]48 factor(tmp) [1] 1 2 3 4 5 6 7 8 Levels: 1 2 3 4 5 6 7 8 ## A simplified example based on yours: tmp - data.frame(a=factor(letters[1:4]), b=factor(letters[5:8])) tmp a b 1 a e 2 b f 3 c g 4 d h cbind(tmp$a, tmp$b) ## coerced to numeric, both factors went to 1:4 [,1] [,2] [1,]11 [2,]22 [3,]33 [4,]44 tmp[, c(a,b)] ## in your example, subscripting is probably the right method a b 1 a e 2 b f 3 c g 4 d h cbind.data.frame(tmp$a, tmp$b) ## explicit use of cbind.data.frame works. tmp$a tmp$b 1 a e 2 b f 3 c g 4 d h Rich __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] set.seed() and .Random.number
Hi R-users I have two conditions. For each condition, 100 sets of 10 random numbers from N(0,1) need to be generated. Here is my question. At the begining I specify a seed number. I want to make the 100th set of the first condition and 1st set of the second conditon the same. What do I need to do ? After generating 99th set of 10 random numbers and then saving .Random.seed then using .Random.seed for generating 100th set of the first condition and 1st set of the second condtion. Is this right? .Random.seed is a vector with 626 numbers, but set.seed() only accepts a integer number. What do I need to do for saving .Random.seed and using the saved .Random.seed for setting set.seed() ? Thanks Taka _ Get FREE company branded e-mail accounts and business Web site from Microsoft Office Live __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.