Re: [R] (no subject)
Salang Pan wrote: > hi, > > Is it possible to draw a string text in a rectangle according the width of > this rectangle? that is, the fontsize of this string text can be adjusted > according the width of the rectangle. > How to set the cex parameter in text function? > > text (x, y = NULL, labels = seq(along = x), adj = NULL, > pos = NULL, offset = 0.5, vfont = NULL, > cex = 1, col = NULL, font = NULL, xpd = NULL, ...) > >thanks! The grid framework might be helpful. For standard graphics, you can optimze the strwidth(): plot(1:10) rect(1,1,9,9) cex <- optimize(function(x) abs(strwidth("Hello World", cex=x)-8), interval=c(1, 10))$minimum text(5,5, "Hello World", cex=cex) Uwe Ligges > > > > > > = > Salang > [EMAIL PROTECTED] > > Tel: 021-64363311-123 > Shanghai Center for Bioinformatics Technology > Floor 12th,100# QinZhou Road > Shanghai,China,200235 > > > > > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Fisher's method in discriminant analysis
Hi, I read your answer and the message you pointed me at, and you talked about the page 347 of the book MASS 3 in your posting as a place where the Fisher's method was mentioned. The thing is that I don't have that book, so I would like to ask you if you can give me that information. If you don't, do you know any other resource where I can search for it? I'm desperately looking for information related to how to obtain Fisher's classification functions, and I don't know if it is too obvious or simply I'm not finding what I need. Thanks a lot and sorry for my insistence. Regards Carlos --- Adaikalavan Ramasamy <[EMAIL PROTECTED]> escribió: > See this thread > http://finzi.psych.upenn.edu/R/Rhelp02a/archive/34951.html > > Sorry, my memory has not improved since then but > there are others on > this list who know better this than myself. > > Regards, Adai > > > > On Mon, 2005-09-05 at 18:15 +0200, C NL wrote: > > Hi, > > > > I'm using mda library to solve a discriminant > > analysis. I get results, but the thing is that I > want > > to use Fisher's method to obtain the > classification > > functions and I'm lost in what I should do: > libraries > > to use, ... Can anybody give me a clue?? > > > > Thanks. > > > >Carlos Niharra López > > > > __ > > R-help@stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > > > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Sorting Text Frames
Uwe Ligges wrote: > I guess there is just too much space or some special characters in your > variables that cause problems when printing ... > Hence you have to "debug" your data yourself. > > Uwe Ligges However the problem persists when I don't try to print the fram "thanks" to a file. thanks[tord[1:74],] gives me row numbers, V1 and V2 to the console, but thanks[tord[1:75],] gives only the row numbes and V1. It is not a special problem with row tord[75]: > thanks[tord[75],] V1 V2 1192 Votic (Russia) [may God give you health]Antagoo Jumal tervüt teilee Murray Jorgensen -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: [EMAIL PROTECTED]Fax 7 838 4155 Phone +64 7 838 4773 wk Home +64 7 825 0441 Mobile 021 1395 862 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] irregular time series prediction
Hello. This is my first post, so allow me to introduce myself. But first, I'd like to thank all the authors and contributors to the R software, as I think that it is truly a great and very useful package. I am the author of moodss, a GPL modular monitoring application (http://moodss.sourceforge.net). Moodss collects, archives in a SQL database and displays data from monitored devices, mostly computers, databases and network equipment. My idea is to use the stored data to perform predictions for capacity planning purposes. For example, based on the trafic on a network line for the last 12 months, what is the expected evolution in the next 3 months. Since there is no guarantee that the data samples are regularly spaced in time, I was thinking of using the "its" package for a start. But data samples, most of the time, are roughly regularly spaced. For example, the monitored network device could return data every 10 seconds, but sometimes at 11 seconds or 9 seconds after the last sample. So another idea would be to normalize the data (by interpolation maybe) to make it a regular time series as a first step. All I need from you at this time is to point me in the right direction, maybe suggest resources on the web about this subject applied to R, knowing that I would prefer to use only R base packages if possible. I apologize if this is a trivial question, but last time I studied statistics was more than 20 years ago, so I need a little time to warm up... Many thanks in advance, -- Jean-Luc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Sorting Text Frames
Murray Jorgensen wrote: > > thanks <- read.fwf("C:\\Files\\Reading\\thankyou.txt", c(43,37)) [CCing R-help again: I have looked at Murray Jorgensen's data in the meantime] tord <- order(thanks$V2) sink("C:\\thanks.txt") thanks[tord,] sink() Works for me with R-2.1.1. --> Please upgrade your version of R and try again. Uwe Ligges __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Doubt about nested aov output
Ronaldo , It looks as though you have specified you model incorrectly. In the Rats example ,the Treatment is the only fixed effect,Rat and Liver are random effects In aov testing for sig of 'Means' of Random Effects is pointless and that is why 'p' values are not given.Further more the interaction between a Random Effect and a Fixed Effect is also a Random Effect. The 'aov' with error structure terms output reflects this by only giving 'p' values to Fixed Effects and their interactions. Note That the Fixed Effects of Block, Variety and their interaction Block:Variety are given "p" values while the Field'Random Effects have not. > model <- aov(Glycogen~Treatment+Error(Rat/Liver)) > summary(model) Error: Rat Df Sum Sq Mean Sq F value Pr(>F) #Rat is random effect Residuals 1 413.44 413.44 Error: Rat:Liver #Rat:Liver is Random effect Df Sum Sq Mean Sq F value Pr(>F) Residuals 4 164.444 41.111 Error: Within Df Sum Sq Mean Sq F valuePr(>F) Treatment 2 1557.56 778.78 18.251 8.437e-06 *** #Fixed effect Residuals 28 1194.78 42.67 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 I hope that this is of help. John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] (no subject)
hi, when I use bclust in R, bclust(dat,centers=5,minsize=3,base.centers=4) dat has 25 rows, there is an error as following: Error in knn1(object$allcenters, x, factor(1:nrow(object$allcenters))) : train and class have different lengths when I debug this function , I found the error is in the prune.bclust function. But I can not search the help doc of this function. which package is this function in? Meanwhile I think there is a bug in blcust: bclust(x, centers=2, iter.base=10, minsize=0, dist.method="euclidian", hclust.method="average", base.method="kmeans", base.centers=20, verbose=TRUE, final.kmeans=FALSE, docmdscale=FALSE, resample=TRUE, weights=NULL, maxcluster=base.centers, ...) if the centers is larger than base.centers, maxcluster is default,ie is equal to base.centers, then it will occur an error as following: Error in clusters.bclust(object, centers) : subscript out of bounds because this line object$members <- cutree(object$hclust, 2:maxcluster) in hclust.bclust function denotes that object$members has (maxcluster-1) columns, it will occur subscript out of bounds. I think the maxcluster may be setted as max(base.centers, centers), is it right? Thanks you very much! > > > > > > >= > Salang > [EMAIL PROTECTED] > > Tel: 021-64363311-123 > Shanghai Center for Bioinformatics Technology > Floor 12th,100# QinZhou Road > Shanghai,China,200235 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] fitting distribution tails
Hello, I want to fit a distribution to a dataset. Important is not the "overall" fitting but the fitting in the tail (e.g. all observations > x or the n highest values). Standard ML-estimation sometimes doesn't work here very well. We see that especially when we have truncated datasets the algorithms won't converge. In the case of lognormal distribution: It seems that the farer the truncation point is away from the peak of the whole distribution the more unlikely is the convergence. So I think to do the following. And my questions are: Before I try to do it with basic R-knowledge on my own ... maybe there is a similar solution already available in R. And: maybe somebody can give me further reading on this topic or has other/better ideas how to cope this type of problem (except EVT-Approaches). First I produce the quantiles for all points of my dataset. I fix that the fitting will be done for the n largest values. Then an optimization algorithm starts. The objective function could be a goodness-of-fit criterion, for a first try e.g: Minimize the sum over all squared deltas [empirical - theoretical distribution]. In *any* case should be found parameters that fulfill the condition. The criterion should be able to overweight observations the higher they are. What do you think about ? Regards, Carsten [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] fitting distribution tails
Not an R-response, but see this reference: Dolan CV, van der Maas HLJ, Molenaar PCM A framework for ML estimation of parameters of (mixtures of) common reaction time distributions given optional truncation or censoring BEHAVIOR RESEARCH METHODS INSTRUMENTS & COMPUTERS 34 (3): 304-323 AUG 2002 on estimating distribution parameters on truncated data sets, there is an accompanying program available (which may or may not easily port to R ...) hth, ingmar > From: "Carsten Steinhoff" <[EMAIL PROTECTED]> > Date: Wed, 7 Sep 2005 13:15:39 +0200 > To: > Subject: [R] fitting distribution tails > > Hello, > > I want to fit a distribution to a dataset. Important is not the "overall" > fitting but the fitting in the tail (e.g. all observations > x or the n > highest values). Standard ML-estimation sometimes doesn't work here very > well. We see that especially when we have truncated datasets the algorithms > won't converge. In the case of lognormal distribution: It seems that the > farer the truncation point is away from the peak of the whole distribution > the more unlikely is the convergence. > > So I think to do the following. And my questions are: Before I try to do it > with basic R-knowledge on my own ... maybe there is a similar solution > already available in R. And: maybe somebody can give me further reading on > this topic or has other/better ideas how to cope this type of problem > (except EVT-Approaches). > > First I produce the quantiles for all points of my dataset. I fix that the > fitting will be done for the n largest values. Then an optimization > algorithm starts. The objective function could be a goodness-of-fit > criterion, for a first try e.g: Minimize the sum over all squared deltas > [empirical - theoretical distribution]. In *any* case should be found > parameters that fulfill the condition. The criterion should be able to > overweight observations the higher they are. > > What do you think about ? > > Regards, Carsten > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R: optim
funny optim message: $MLE $MLE$par [1] -0.09554688 1.13100488 0.06651340 $MLE$value [1] 48.93381 $MLE$counts function gradient 100 100 $MLE$convergence [1] 52 $MLE$message [1] "ERROR: ABNORMAL_TERMINATION_IN_LNSRCH" WHAT DOES THIS ERROR MESSAGE MEAN??? hope some one can help. / allan Clark Allan wrote: > > thanx for the reply. i understood that the function found a maximum. i > was just a bit worried about the message. i assumed that it was an > ERROR message. > > i see now that it is some sort of stopping rule. does this make sense? > / > allan > > Douglas Bates wrote: > > > > On 9/6/05, Clark Allan <[EMAIL PROTECTED]> wrote: > > > hi all > > > > > > i dont understand the error message that is produced by the optim > > > function. can anybody help??? > > > > > > ie: > > > [[1]]$message > > > [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" > > > > > > can anyone help? > > > > That code indicates that the optimizer has declared convergence > > because the relative reduction in the objective function in successive > > iterates is below a tolerance. As documented in ?optim, a convergence > > code of 0 indicates success > > > > ... > > convergence: An integer code. '0' indicates successful convergence. > > Error codes are > > ... > > > > This may be counter-intuitive but it does make sense to shell > > programmers. The idea is that there is only one way you can succeed > > but there are many different ways of failing so you use the nonzero > > codes to indicate the types of failure and the zero code, which we > > usually read as FALSE in a logical context, to indicate success. > > > > > > > > > > > > > > ### > > > > > > SK.FIT(XDATA=a,XDATAname="a",PHI1=1,v=5,vlo=2,vhi=300,phi2lo=.01) > > > [[1]] > > > [[1]]$par > > > [1] -0.01377906 0.83859445 0.34675230 300. > > > > > > [[1]]$value > > > [1] 90.59185 > > > > > > [[1]]$counts > > > function gradient > > > 53 53 > > > > > > [[1]]$convergence > > > [1] 0 > > > > > > [[1]]$message > > > [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" > > > > > > # > > > > > > > > > > > > i ghave included the function used in the optim call: > > > > > > SKEWMLE=function(l,DATA=XDATA,...) > > > { > > > #alpha = l[1] > > > #beta = l[2] > > > #phi2 = l[3] > > > #v= l[4] > > > phi1=PHI1 > > > > > > DATA<-as.matrix(DATA) > > > > > > fnew<-function(x,y,l,...) > > > { > > > #when we do not estimate phi1 > > > > > > t1=(1+((y-l[1]-l[2]*x)^2)/(l[4]*l[3]^2))^(-0.5*(1+l[4])) > > > t2=(1+(x^2)/l[4])^(-0.5*(1+l[4])) > > > > > > t3=2*((gamma(0.5*(1+l[4]))/(gamma(0.5*l[4])*sqrt(l[4]*pi)))^2)/l[3] > > > > > > t1*t2*t3 > > > } > > > > > > a<-double(length(DATA)) > > > y=DATA > > > a=apply(y,1,function(q) > > > log(integrate(fnew,lower=0,upper=Inf,y=q,l=l)$value)) > > > -sum(a) > > > } > > > > > > __ > > > R-help@stat.math.ethz.ch mailing list > > > https://stat.ethz.ch/mailman/listinfo/r-help > > > PLEASE do read the posting guide! > > > http://www.R-project.org/posting-guide.html > > > > > > > > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice key seems to ignore the key list
Patrick Connolly wrote: > I've never had this problem before and can't see what could be > different from other times I've used keys with lattice. > > > > It appears that auto.key is being taken as TRUE when I specify a key > list. The list I specify seems to be ignored. > > Where can I place a browser to figure out what is going on? > > Having made a list key.symbol from trellis.par.get, and specified a > scales list and a between list, and a formula object (form), I use > xyplot like this: > > xyplot(form, data = xx, groups = Entry, layout = c(8,8, 1), > par.strip.text = list(cex = .65), between = between, > scales = scales, > panel = function(x, y, ...) > panel.superpose(x, y, ...), > key = list(points = Rows(key.symbol, 1:4), > text = list(levels(xx$Entry), > space = "right", columns = 1)) > ) > > What is implied in there that would set auto.key to TRUE? The space > and columns part of the list seems to be ignored and the autokey > values substituted. > > Ideas, please. > > Thanks. > Hi, Patrick, You have "space" and "column" in your "text" list. I.e. text = list(levels(xx$Entry), space = "right", columns = 1)) This should be text = list(levels(xx$Entry)), space = "right", columns = 1) Note the placement of the parantheses. --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Plot of multiple data sets
Hello ! There is something quite simple I want to do with R but I found nowhere in the help how to do it. I just want to plot data which are in a matrix, every column being a data set and having the same x-axis (just an index). So for example if I have a 50 x 6 matrix I want 6 set of points on the same plot. I tried plot,new() plot(MATRIX[,1]) plot(MATRIX[,2]) ... but it replaces the previous plot each time. Thank you very much if you can help ! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plot of multiple data sets
On 9/7/2005 9:28 AM, Stéphane Mattei wrote: > Hello ! > > > There is something quite simple I want to do with R but I found nowhere in > the help how to do it. > I just want to plot data which are in a matrix, every column being a data set > and having the same > x-axis (just an index). > > So for example if I have a 50 x 6 matrix I want 6 set of points on the same > plot. > > I tried > plot,new() > plot(MATRIX[,1]) > plot(MATRIX[,2]) > ... > > but it replaces the previous plot each time. See ?matplot. For example, matplot(1:10, cbind(rnorm(10),rnorm(10)), type='l') __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] references in the manual to endnote and spanish versions of everything
Chris Buddenhagen, Botany Department, Charles Darwin Research Station, Santa Cruz,Galapagos. Mail: Charles Darwin Foundation, Casilla 17-01-3891 Avenida 6 de Diciembre N36-109 y Pasaje California Quito, ECUADOR Dear all 1) I have been really pleased with R as a means of doing and learning statistics. I work in a Spanish speaking country- and I wanted to pass on the benefits of R to my Spanish speaking colleagues. There are a couple of introductions to R in Spanish but I could only find Portuguese installation option, is there a Spanish version of the fullref manual or the program? 2) You can some references out of R and the help files in BibTex or LaTex or something, does anyone have the refs entered into endnote? Can you extract them into something readable by endnote? Chris Buddenhagen, Botany Department, Charles Darwin Research Station, Santa Cruz, Galapagos Mailing address: Charles Darwin Foundation Casilla 17-01-3891 Avenida 6 de Diciembre N36-109 y Pasaje California Quito, ECUADOR __ EL CONTENIDO DE ESTE MENSAJE ES DE ABSOLUTA RESPONSABILIDAD DEL AUTOR. FUNDACION CHARLES DARWIN WWW.DARWINFOUNDATION.ORG __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plot of multiple data sets
Le 07.09.2005 15:28, Stéphane Mattei a écrit : >Hello ! > > >There is something quite simple I want to do with R but I found nowhere in the >help how to do it. >I just want to plot data which are in a matrix, every column being a data set >and having the same >x-axis (just an index). > >So for example if I have a 50 x 6 matrix I want 6 set of points on the same >plot. > >I tried >plot,new() >plot(MATRIX[,1]) >plot(MATRIX[,2]) >... > >but it replaces the previous plot each time. > > Hello Stephane, there is a lot of solutions for your problem. It's up to you : ?matplot ?points ?lines par(new=TRUE) http://addictedtor.free.fr/graphiques/search.php?q=parallel Good day. Romain -- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques ~ ~~ Romain FRANCOIS - http://addictedtor.free.fr ~~ Etudiant ISUP - CS3 - Industrie et Services ~~http://www.isup.cicrp.jussieu.fr/ ~~ Stagiaire INRIA Futurs - Equipe SELECT ~~ http://www.inria.fr/recherche/equipes/select.fr.html~~ ~ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plot of multiple data sets
Have a look at ?matplot Stéphane Mattei wrote: > Hello ! > > > There is something quite simple I want to do with R but I found nowhere in > the help how to do it. > I just want to plot data which are in a matrix, every column being a data set > and having the same > x-axis (just an index). > > So for example if I have a 50 x 6 matrix I want 6 set of points on the same > plot. > > I tried > plot,new() > plot(MATRIX[,1]) > plot(MATRIX[,2]) > ... > > but it replaces the previous plot each time. > > > Thank you very much if you can help ! > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > -- - Henrik Andersson Netherlands Institute of Ecology - Centre for Estuarine and Marine Ecology P.O. Box 140 4400 AC Yerseke Phone: +31 113 577473 [EMAIL PROTECTED] http://www.nioo.knaw.nl/ppages/handersson __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Hotelling Test
Hello R-users, I've been looking for a function performing one and two sample Hotelling test for testing equality of mean vectors. Has anyone implemented such a function in R? thanks a lot, Bill == Bill Donner Statistician __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Plot of multiple data sets
Thank you all for your answers. I eventually use the points command plot(MATRIX[,1]) points(MATRIX[,2]) points(MATRIX[,3]) ... with matplot I had numbers instead of points with type="p" and par(new=TRUE) makes complications with the axis. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Survival analysis with COXPH
Dear all, I would have some questions on the coxph function for survival analysis, which I use with frailty terms. My model is: mdcox<-coxph(Surv(time,censor)~ gender + age + frailty(area, dist='gauss'), data) I have a very large proportion of censored observations. - If I understand correctly, the function mdcox$frail will return the random effect estimated for each group on the scale of the linear predictor? - Similarly, the variance of the frailties is the variance of the terms on the scale of the linear predictor? - A p-value is provided for this variance. Is that possible to obtain a 95% CI for the variance of the random effect instead of a p-value? - I would like to make predictions for different combinations of covariate values (but with an average value of 0 for the gaussian frailty term). I saw on the list that it is impossible to obtain a mean or a median survival time for each combinaison of covariates? Would that be possible to predict a probability of survival at the end of my follow up period, even if most observations are censored? How could I do that within the survival package? - Is there somewhere an explanation of the different possibilities of predictions offered by the predict.coxph function: lp, risk, expected, terms? Is that possible to use it with a model including frailties? In that case, should I include in the new dataset with observations to predict at, a column corresponding to the frailty term (containing the code of the group for which a prediction is desired)? Thank you so much for your help for solving some or all of these questions. Best regards, Basile Chaix French National Institute of Health and Medical Research [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plot of multiple data sets
On 9/7/05, Stéphane Mattei <[EMAIL PROTECTED]> wrote: > Hello ! > > > There is something quite simple I want to do with R but I found nowhere in > the help how to do it. > I just want to plot data which are in a matrix, every column being a data set > and having the same > x-axis (just an index). > > So for example if I have a 50 x 6 matrix I want 6 set of points on the same > plot. > > I tried > plot,new() > plot(MATRIX[,1]) > plot(MATRIX[,2]) > ... > > but it replaces the previous plot each time. Others have already mentioned matplot, lines and points but just to add to the list, if your problem is a time series then you could also use plot.zoo: library(zoo) z <- zoo(MATRIX, x) plot(z, plot.type ="single") # one plot plot(z) # separate plots __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] references in the manual to endnote and spanish versions of everything
On Wed, 7 Sep 2005, Chris Buddenhagen wrote: > > 1) I have been really pleased with R as a means of doing and learning > statistics. I work in a Spanish speaking country- and I wanted to pass on > the benefits of R to my Spanish speaking colleagues. There are a couple of > introductions to R in Spanish but I could only find Portuguese installation > option, is there a Spanish version of the fullref manual or the program? Not at the moment. The translations rely very heavily on volunteers who actually know the languages in question. Spanish-speaking users have contributed documentation, but we have no translation teams for any version of Spanish. > 2) You can some references out of R and the help files in BibTex or LaTex or > something, does anyone have the refs entered into endnote? Can you extract > them into something readable by endnote? There are bibtex to endnote converters out there on the web One is at http://www.cs.usyd.edu.au/~tapted/bib2endnote.html -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
Re: [R] Hotelling Test
some time ago I've written a function for the Hotelling test, maybe you could give it a try: hotel.test <- function(x, y = NULL, mu = 0) { if(!is.numeric(x) || !is.matrix(x)) stop("'x' must be a numeric matrix") n <- nrow(x) p <- ncol(x) xbar <- colMeans(x, na.rm = TRUE) if(!is.numeric(mu) || ((lmu <- length(mu)) > 1 & lmu != p)) stop("'mu' must be a numeric vector of length ", p) if(lmu == 1) mu <- rep(mu, p) xbar.mu <- xbar - mu V <- var(x, na.rm = TRUE) out <- if(is.null(y)){ k <- n / (n - 1) * (n - p) / p stat <- k * crossprod(xbar.mu, solve(V, xbar.mu))[1, ] pvalue <- 1 - pf(stat, p, n - p) list(statistic = stat, parameter = c(p, n - p), p.value = pvalue, estimate = xbar, null.value = mu, alternative = "two-sided", method = "Hotelling one sample test", data.name = deparse(substitute(x))) } else{ if(!is.numeric(y) || !is.matrix(y)) stop("'y' must be a numeric matrix") if(ncol(y) != p) stop("incompatible arguments") ny <- nrow(y) k <- n + ny - p - 1 k1 <- (n * ny) / (n + ny) k2 <- (n + ny - 2) * p dif.means <- xbar - colMeans(y, na.rm = TRUE) Vy <- var(y, na.rm = TRUE) V <- ((n - 1) * V + (ny - 1) * Vy) / (n + ny - 2) stat <- k * k1 * crossprod(dif.means, solve(V, dif.means))[1, ] / k2 pvalue <- 1 - pf(stat, p, k) list(statistic = stat, parameter = c(p, k), p.value = pvalue, estimate = rbind(xbar, ybar = xbar - dif.means), null.value = NULL, alternative = "two-sided", method = "Hotelling two sample test", data.name = c(deparse(substitute(x)), deparse(substitute(y } class(out) <- "hotel" out } print.hotel <- function(x, digits = 3, ...){ cat("\n\t", x$method, "\n\n") if(length(dnam <- x$data.name) == 1) cat("data:", dnam, "\n") else cat("data:", dnam[1], "and", dnam[2], "\n") pval <- if(x$p.value < 1e-04) "< 1e-04" else paste("= ", round(x$p.value, 4), sep = "") cat("t = ", x$statistic, ", df1 = ", x$parameter[1], ", df2 = ", x$parameter[2], ", p-value ", pval, "\n", sep = "") if(!is.null(null <- x$null.value)) cat("alternative hypothesis: true mean vector is not equal to", paste("(", paste(round(null, digits), collapse = ", "), ")'", sep = ""), "\n") else cat("alternative hypothesis: true difference in mean vectors is not equal to 0\n") cat("sample estimates:") if(!is.matrix(est <- x$estimate)) cat("\nmean x-vector", paste("(", paste(round(est, digits), collapse = ", "), ")'", sep = ""), "\n") else{ rownames(est) <- c("mean x-vector", "mean y-vector") if(is.null(colnames(est))) colnames(est) <- rep("", ncol(est)) print(round(est, digits)) } cat("\n") invisible(x) } # Examples mat <- matrix(rnorm(100 * 3), 100, 3) mat2 <- matrix(rnorm(100 * 3), 100, 3) hotel.test(mat) hotel.test(mat, mu = -1:1) hotel.test(mat, y = mat2) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: "Bill Donner" <[EMAIL PROTECTED]> To: Sent: Wednesday, September 07, 2005 3:48 PM Subject: [R] Hotelling Test > Hello R-users, > > I've been looking for a function performing one and two sample > Hotelling > test for testing equality of mean vectors. Has anyone implemented > such a > function in R? > > > thanks a lot, > > Bill > > == > Bill Donner > Statistician > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] solving a system of nonlinear equations
What is the "classic" R function for solving a (possibly over determined) system of non-linear equations? Thank you! Moshe Olshansky e-mail: [EMAIL PROTECTED] The information transmitted is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of Brevan Howard Asset Management LLP, its members and affiliates. Brevan Howard Asset Management LLP is authorised and regulated by the Financial Services Authority. Registered Office: 42 Portman Road, Reading, Berkshire RG3O 1EA. Phone number 020 7022 6100. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Survival analysis with COXPH
On Wed, 7 Sep 2005, Basile Chaix wrote: > Dear all, > I would have some questions on the coxph function for survival analysis, > which I use with frailty terms. > > My model is: > mdcox<-coxph(Surv(time,censor)~ gender + age + frailty(area, dist='gauss'), > data) > I have a very large proportion of censored observations. > > - If I understand correctly, the function mdcox$frail will return the random > effect estimated for each group on the scale of the linear predictor? Yes > - Similarly, the variance of the frailties is the variance of the terms on > the scale of the linear predictor? Yes > - A p-value is provided for this variance. Is that possible to obtain a 95% > CI for the variance of the random effect instead of a p-value? I don't think anyone knows how to do this. Personally, I'm not really convinced of the usefulness of these frailty models and I don't know how well their properties are known. I wouldn't use them except when I was actually interested in the variance components, and I haven't worked on any problems like that, so I haven't investigated the issue. [I don't write the survival package, I just port it] -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] irregular time series prediction
On 9/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello. > > This is my first post, so allow me to introduce myself. > > But first, I'd like to thank all the authors and contributors to the R > software, > as I think that it is truly a great and very useful package. > > I am the author of moodss, a GPL modular monitoring application > (http://moodss.sourceforge.net). Moodss collects, archives in a SQL database > and displays data from monitored devices, mostly computers, databases and > network equipment. > > My idea is to use the stored data to perform predictions for capacity planning > purposes. For example, based on the trafic on a network line for the last 12 > months, what is the expected evolution in the next 3 months. > > Since there is no guarantee that the data samples are regularly spaced in > time, > I was thinking of using the "its" package for a start. > But data samples, most of the time, are roughly regularly spaced. For example, > the monitored network device could return data every 10 seconds, but sometimes > at 11 seconds or 9 seconds after the last sample. So another idea would be to > normalize the data (by interpolation maybe) to make it a regular time series > as > a first step. > > All I need from you at this time is to point me in the right direction, maybe > suggest resources on the web about this subject applied to R, knowing that I > would prefer to use only R base packages if possible. > > I apologize if this is a trivial question, but last time I studied statistics > was more than 20 years ago, so I need a little time to warm up... > The zoo package has support for irregular series and weakly regular series (classes 'zoo' and 'zooreg') where the latter are series that have an underlying regularity, e.g. every 10 minutes, but there may be some missing ones. Also you might want to look at the article on dates and times in R News 4/1. library(zoo) vignette("zoo") __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] FW: Re: Doubt about nested aov output
Ronaldo, Further to my previous posting on your Glycogen nested aov model. Having read Douglas Bates' response and Reflected on his lmer analysis output of your aov nested model example as given.The Glycogen treatment has to be a Fixed Effect.If a 'treatment' isn't a Fixed Effect what is ? If Douglas Bates' lmer model is modified to treat Glycogen Treatment as a purely Fixed Effect,with Rat and the interaction Rat:Liver as random effects then-- > model.lmer<-lmer(Glycogen~Treatment+(1|Rat)+(1|Rat:Liver)) > summary(model.lmer) Linear mixed-effects model fit by REML Formula: Glycogen ~ Treatment + (1 | Rat) + (1 | Rat:Liver) AIC BIClogLik MLdeviance REMLdeviance 239.095 248.5961 -113.5475 238.5439 227.095 Random effects: GroupsNameVariance Std.Dev. Rat:Liver (Intercept) 2.1238e-08 0.00014573 Rat (Intercept) 2.0609e+01 4.53976242 Residual 4.2476e+01 6.51733769 # of obs: 36, groups: Rat:Liver, 6; Rat, 2 Fixed effects: Estimate Std. Error DF t value Pr(>|t|) (Intercept) 140.5000 3.7208 33 37.7607 < 2.2e-16 *** Treatment2 10.5000 2.6607 33 3.9463 0.0003917 *** Treatment3 -5. 2.6607 33 -2.0045 0.0532798 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) Trtmn2 Treatment2 -0.358 Treatment3 -0.358 0.500 > anova(model.lmer) Analysis of Variance Table Df Sum Sq Mean Sq Denom F valuePr(>F) Treatment 2 1557.56 778.78 33.00 18.335 4.419e-06 *** which agrees with the aov model below. > model <- aov(Glycogen~Treatment+Error(Rat/Liver)) > summary(model) John -Original Message- From: John Wilkinson (pipex) [mailto:[EMAIL PROTECTED] Sent: 07 September 2005 12:04 PM To: "Ronaldo Reis-Jr." Cc: r-help Subject: Re: [R] Doubt about nested aov output Ronaldo , It looks as though you have specified your model incorrectly. In the Rats example ,the Treatment is the only fixed effect,Rat and Liver are random effects In aov testing for sig of 'Means' of Random Effects is pointless and that is why 'p' values are not given.Further more the interaction between a Random Effect and a Fixed Effect is also a Random Effect. The 'aov' with error structure terms output reflects this by only giving 'p' values to Fixed Effects and their interactions > model <- aov(Glycogen~Treatment+Error(Rat/Liver)) > summary(model) Error: Rat Df Sum Sq Mean Sq F value Pr(>F) #Rat is random effect Residuals 1 413.44 413.44 Error: Rat:Liver #Rat:Liver is Random effect Df Sum Sq Mean Sq F value Pr(>F) Residuals 4 164.444 41.111 Error: Within Df Sum Sq Mean Sq F valuePr(>F) Treatment 2 1557.56 778.78 18.251 8.437e-06 *** #Fixed effect Residuals 28 1194.78 42.67 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 I hope that this is of help. John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plot of multiple data sets
Selon Gabor Grothendieck <[EMAIL PROTECTED]>: > On 9/7/05, Stéphane Mattei <[EMAIL PROTECTED]> wrote: > > Hello ! > > > > > > There is something quite simple I want to do with R but I found nowhere in > > the help how to do > it. > > I just want to plot data which are in a matrix, every column being a data > > set and having the > same > > x-axis (just an index). > > > > So for example if I have a 50 x 6 matrix I want 6 set of points on the same > > plot. > > > > I tried > > plot,new() > > plot(MATRIX[,1]) > > plot(MATRIX[,2]) > > ... > > > > but it replaces the previous plot each time. > > Others have already mentioned matplot, lines and points but just to add > to the list, if your problem is a time series then you could also use > plot.zoo: > library(zoo) > z <- zoo(MATRIX, x) > plot(z, plot.type ="single") # one plot > plot(z) # separate plots > Thank you very much Gabor! Your solution is best because with points it doesn't adapt the axis. But it's funny it needs an extra-package for such a simple thing ! I thought that could be done with just the plot command __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] solving a system of nonlinear equations
Olshansky,Moshe wrote: > What is the "classic" R function for solving a (possibly over > determined) system of non-linear equations? > > > > Thank you! > > > > Moshe Olshansky > > e-mail: [EMAIL PROTECTED] > > > I'm not sure what your definition of '"classic"' is, but there are several options in R: ?optim ?nls ?nlm Or better yet, try RSiteSearch("nonlinear system of equations"). This gave me 43 hits, many of which are directly related to your question. --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] variables from command line
How can I pass parameters to an R script from the command line. And how can I read them from within the script? This is how I want to invoke the script: R CMD BATCH r.in r.out The script with read in the input values, process them and spit the output to r.out. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plot of multiple data sets
Le 07.09.2005 16:00, Stéphane Mattei a écrit : >Thank you all for your answers. > >I eventually use the points command > >plot(MATRIX[,1]) >points(MATRIX[,2]) >points(MATRIX[,3]) >... > >with matplot I had numbers instead of points with type="p" and par(new=TRUE) >makes complications >with the axis. > > So, add pch=21 or something else to your matplot call and you won't need an extra package for that. R> matplot(iris[,1:4], type="p", pch=21) Also, if you want to do it with plot and points, you must specify the y range like that : R> plot(MATRIX[,1], ylim=range(MATRIX)) R> points(MATRIX[,2]) R> points(MATRIX[,3]) Proceeding that way, par(new=TRUE) won't make complications anymore. Romain -- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques ~ ~~ Romain FRANCOIS - http://addictedtor.free.fr ~~ Etudiant ISUP - CS3 - Industrie et Services ~~http://www.isup.cicrp.jussieu.fr/ ~~ Stagiaire INRIA Futurs - Equipe SELECT ~~ http://www.inria.fr/recherche/equipes/select.fr.html~~ ~ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plot of multiple data sets
Hi what is wrong with matplot sines <- outer(1:20, 1:4, function(x, y) sin(x / 20 * pi * y)) matplot(sines, pch = 1:4, type = "o", col = rainbow(ncol(sines))) so you can use aditional parameters to exactly specify what type of point and/or line and in what colour you will plot. Or with plot/points construction you can adapt xlim and ylim setting to suite the whole plotting range e.g.. ddd<-dim(sines)[1] # length of x axis plot(1:ddd,rep(1,ddd), type="n", ylim=range(sines)) # y in propper range for (i in 1:4) points(1:ddd,sines[,i], pch = i, type = "b", col = rainbow(ncol(sines))[i]) # 4 columns plotted If you want do more complicated things you usually has to use more complicated constructions. BTW help.search("plot column") goes stright to matplot and from its help page you could learn how to use it. HTH Petr On 7 Sep 2005 at 16:24, Stéphane Mattei wrote: > Selon Gabor Grothendieck <[EMAIL PROTECTED]>: > > > On 9/7/05, Stéphane Mattei <[EMAIL PROTECTED]> wrote: > > > Hello ! > > > > > > > > > There is something quite simple I want to do with R but I found > > > nowhere in the help how to do > > it. > > > I just want to plot data which are in a matrix, every column being > > > a data set and having the > > same > > > x-axis (just an index). > > > > > > So for example if I have a 50 x 6 matrix I want 6 set of points on > > > the same plot. > > > > > > I tried > > > plot,new() > > > plot(MATRIX[,1]) > > > plot(MATRIX[,2]) > > > ... > > > > > > but it replaces the previous plot each time. > > > > Others have already mentioned matplot, lines and points but just to > > add to the list, if your problem is a time series then you could > > also use plot.zoo: library(zoo) z <- zoo(MATRIX, x) plot(z, > > plot.type ="single") # one plot plot(z) # separate plots > > > Thank you very much Gabor! > Your solution is best because with points it doesn't adapt the axis. > But it's funny it needs an extra-package for such a simple thing ! I > thought that could be done with just the plot command > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html 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
[R] using system()
Using system() is theer a way to make the R interpreter not wait for the command to finish? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] using system()
Omar Lakkis schrieb: > Using system() is theer a way to make the R interpreter not wait for > the command to finish? system("cmd", wait=FALSE) see ?system in online help. Thomas P. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Avoid Sweave from stopping on errors
Hi all, Is there an option in Sweave to avoid it from stopping on a code chunk with an error? (I purposefully want to include code with an error in class notes.) I suspect the answer is "no" and that I will be pointed to options("error"). That'd be fine, but which error parameter will just "do nothing" in case of an error? Thanks in advance! -- Vincent Goulet, Associate Professor École d'actuariat Université Laval, Québec [EMAIL PROTECTED] http://vgoulet.act.ulaval.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] using system()
On 9/7/05, Thomas Petzoldt <[EMAIL PROTECTED]> wrote: > Omar Lakkis schrieb: > > Using system() is theer a way to make the R interpreter not wait for > > the command to finish? > > system("cmd", wait=FALSE) > > see ?system in online help. > Coincidentially I recently posted on r-devel a note pointing out that system is not the same on all operating systems. https://www.stat.math.ethz.ch/pipermail/r-devel/2005-September/034539.html In particular, wait= is available on Windows but not on UNIX. On UNIX you could & in the usual way. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Hotelling Test
Check some of the threads at RSiteSearch("Hotelling") Cheers Francisco >From: Bill Donner <[EMAIL PROTECTED]> >To: R-help@stat.math.ethz.ch >Subject: [R] Hotelling Test >Date: Wed, 7 Sep 2005 06:48:06 -0700 (PDT) > >Hello R-users, > >I've been looking for a function performing one and two sample Hotelling >test for testing equality of mean vectors. Has anyone implemented such a >function in R? > > >thanks a lot, > >Bill > >== >Bill Donner >Statistician > >__ >R-help@stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! >http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Hotelling Test
"Francisco J. Zagmutt" <[EMAIL PROTECTED]> writes: > Check some of the threads at RSiteSearch("Hotelling") Or use anova(lm(X~g), test="Hotelling"), where X is the matrix of responses and g is the grouping factor. > Cheers > > Francisco > > >From: Bill Donner <[EMAIL PROTECTED]> > >To: R-help@stat.math.ethz.ch > >Subject: [R] Hotelling Test > >Date: Wed, 7 Sep 2005 06:48:06 -0700 (PDT) > > > >Hello R-users, > > > >I've been looking for a function performing one and two sample Hotelling > >test for testing equality of mean vectors. Has anyone implemented such a > >function in R? > > > > > >thanks a lot, > > > >Bill > > > >== > >Bill Donner > >Statistician > > > >__ > >R-help@stat.math.ethz.ch mailing list > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide! > >http://www.R-project.org/posting-guide.html > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Hotelling Test
Peter Dalgaard <[EMAIL PROTECTED]> writes: > "Francisco J. Zagmutt" <[EMAIL PROTECTED]> writes: > > > Check some of the threads at RSiteSearch("Hotelling") > > Or use anova(lm(X~g), test="Hotelling"), where X is the matrix of > responses and g is the grouping factor. Oops, sorry. That is in r-devel only. For R 2.1.1 you need an explicit comparison of models: anova(lm(X~g), lm(X~1), test="Hotelling") For the one-sample test, you probably need to sweep() out the H0 column mean vector and compare X~1 to X~-1 . > > Cheers > > > > Francisco > > > > >From: Bill Donner <[EMAIL PROTECTED]> > > >To: R-help@stat.math.ethz.ch > > >Subject: [R] Hotelling Test > > >Date: Wed, 7 Sep 2005 06:48:06 -0700 (PDT) > > > > > >Hello R-users, > > > > > >I've been looking for a function performing one and two sample Hotelling > > >test for testing equality of mean vectors. Has anyone implemented such a > > >function in R? > > > > > > > > >thanks a lot, > > > > > >Bill > > > > > >== > > >Bill Donner > > >Statistician > > > > > >__ > > >R-help@stat.math.ethz.ch mailing list > > >https://stat.ethz.ch/mailman/listinfo/r-help > > >PLEASE do read the posting guide! > > >http://www.R-project.org/posting-guide.html > > > > __ > > R-help@stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! > > http://www.R-project.org/posting-guide.html > > > > -- >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 > -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Course***R/Splus Programming Techniques***New York, September 2005
FYI XLSolutions Corporation (www.xlsolutions-corp.com) is proud to announce 2-day "R/S-plus Fundamentals and Programming Techniques" in New York City. www.xlsolutions-corp.com/Rfund.htm New York City September 22nd-23rd, 2005 Reserve your seat now at the early bird rates! Payment due AFTER the class Course Description: This two-day beginner to intermediate R/S-plus course focuses on a broad spectrum of topics, from reading raw data to a comparison of R and S. We will learn the essentials of data manipulation, graphical visualization and R/S-plus programming. We will explore statistical data analysis tools,including graphics with data sets. How to enhance your plots, build your own packages (librairies) and connect via ODBC,etc. We will perform some statistical modeling and fit linear regression models. Participants are encouraged to bring data for interactive sessions With the following outline: - An Overview of R and S - Data Manipulation and Graphics - Using Lattice Graphics - A Comparison of R and S-Plus - How can R Complement SAS? - Writing Functions - Avoiding Loops - Vectorization - Statistical Modeling - Project Management - Techniques for Effective use of R and S - Enhancing Plots - Using High-level Plotting Functions - Building and Distributing Packages (libraries) - Connecting; ODBC, Rweb, Orca via sockets and via Rjava Interested in R/Splus Advanced course? email us. Email us for group discounts. Email Sue Turner: [EMAIL PROTECTED] Phone: 206-686-1578 Visit us: www.xlsolutions-corp.com/training.htm Please let us know if you and your colleagues are interested in this classto take advantage of group discount. Register now to secure your seat! Interested in R/Splus Advanced course? email us. Cheers, Elvis Miller, PhD Manager Training. XLSolutions Corporation 206 686 1578 www.xlsolutions-corp.com [EMAIL PROTECTED] _ Dont just search. Find. Check out the new MSN Search! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Avoid Sweave from stopping on errors
You could use <>= and the code inside the chunk will not be evaluated. I suppose two other options could be to comment out the bad code inside the code chunk or to use verbatim to make it look like a code chunk in your output. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vincent Goulet Sent: Wednesday, September 07, 2005 11:44 AM To: r-help@stat.math.ethz.ch Subject: [R] Avoid Sweave from stopping on errors Hi all, Is there an option in Sweave to avoid it from stopping on a code chunk with an error? (I purposefully want to include code with an error in class notes.) I suspect the answer is "no" and that I will be pointed to options("error"). That'd be fine, but which error parameter will just "do nothing" in case of an error? Thanks in advance! -- Vincent Goulet, Associate Professor École d'actuariat Université Laval, Québec [EMAIL PROTECTED] http://vgoulet.act.ulaval.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Avoid Sweave from stopping on errors
On 9/7/05, Doran, Harold <[EMAIL PROTECTED]> wrote: > You could use <>= and the code inside the chunk will not be > evaluated. I suppose two other options could be to comment out the bad code > inside the code chunk or to use verbatim to make it look like a code chunk in > your output. > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vincent Goulet > Sent: Wednesday, September 07, 2005 11:44 AM > To: r-help@stat.math.ethz.ch > Subject: [R] Avoid Sweave from stopping on errors > > Hi all, > > Is there an option in Sweave to avoid it from stopping on a code chunk with > an error? (I purposefully want to include code with an error in class notes.) > > I suspect the answer is "no" and that I will be pointed to options("error"). > That'd be fine, but which error parameter will just "do nothing" in case of > an error? > > Thanks in advance! > Another option is to wrap the call that will produce an error in try(). You still get the error report, etc. but execution does not stop. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] summary of problem with mCall function.
Last week I posted a question concerning the mCall function, which is used to create self-starting functions and is described in the book by Pinheiro, J.C. and Bates, D.M. (Mixed-effects models in S and S-PLUS). On page 345 one finds the following call: xy<-sortedXyData(mCall[["x"]], LHS,data) It is necessary to replace the "x" in the call to mCall by the actual variable name for the dependent variable. The error message that I was getting was due to the fact that I had called by dependent variable in the data frame (data) by another name than x without changing this in the call to mCall. Bill Shipley [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] FW: Re: Doubt about nested aov output
On 9/7/05, John Wilkinson (pipex) <[EMAIL PROTECTED]> wrote: > Ronaldo, > > Further to my previous posting on your Glycogen nested aov model. > > Having read Douglas Bates' response and Reflected on his lmer analysis > output of your aov nested model example as given.The Glycogen treatment has > to be a Fixed Effect.If a 'treatment' isn't a Fixed Effect what is ? If > Douglas Bates' lmer model is modified to treat Glycogen Treatment as a > purely Fixed Effect,with Rat and the interaction Rat:Liver as random effects > then-- > > > model.lmer<-lmer(Glycogen~Treatment+(1|Rat)+(1|Rat:Liver)) > > summary(model.lmer) > Linear mixed-effects model fit by REML > Formula: Glycogen ~ Treatment + (1 | Rat) + (1 | Rat:Liver) > AIC BIClogLik MLdeviance REMLdeviance > 239.095 248.5961 -113.5475 238.5439 227.095 > Random effects: > GroupsNameVariance Std.Dev. > Rat:Liver (Intercept) 2.1238e-08 0.00014573 > Rat (Intercept) 2.0609e+01 4.53976242 > Residual 4.2476e+01 6.51733769 > # of obs: 36, groups: Rat:Liver, 6; Rat, 2 > > Fixed effects: > Estimate Std. Error DF t value Pr(>|t|) > (Intercept) 140.5000 3.7208 33 37.7607 < 2.2e-16 *** > Treatment2 10.5000 2.6607 33 3.9463 0.0003917 *** > Treatment3 -5. 2.6607 33 -2.0045 0.0532798 . > --- > Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > Correlation of Fixed Effects: >(Intr) Trtmn2 > Treatment2 -0.358 > Treatment3 -0.358 0.500 > > > anova(model.lmer) > Analysis of Variance Table > Df Sum Sq Mean Sq Denom F valuePr(>F) > Treatment 2 1557.56 778.78 33.00 18.335 4.419e-06 *** > > which agrees with the aov model below. > > > model <- aov(Glycogen~Treatment+Error(Rat/Liver)) > > summary(model) > > > John > > -Original Message- > From: John Wilkinson (pipex) [mailto:[EMAIL PROTECTED] > Sent: 07 September 2005 12:04 PM > To: "Ronaldo Reis-Jr." > Cc: r-help > Subject: Re: [R] Doubt about nested aov output > > > Ronaldo , > > It looks as though you have specified your model incorrectly. > > In the Rats example ,the Treatment is the only fixed effect,Rat and Liver > are random effects > > In aov testing for sig of 'Means' of Random Effects is pointless and that is > why 'p' values are not given.Further more the interaction between a Random > Effect and a Fixed Effect is also a Random Effect. The 'aov' with error > structure terms output reflects this by only giving 'p' values to > Fixed Effects and their interactions > > > model <- aov(Glycogen~Treatment+Error(Rat/Liver)) > > summary(model) > > Error: Rat > Df Sum Sq Mean Sq F value Pr(>F) #Rat is random effect > Residuals 1 413.44 413.44 > > Error: Rat:Liver #Rat:Liver is Random > effect > Df Sum Sq Mean Sq F value Pr(>F) > Residuals 4 164.444 41.111 > > Error: Within > Df Sum Sq Mean Sq F valuePr(>F) > Treatment 2 1557.56 778.78 18.251 8.437e-06 *** #Fixed effect > Residuals 28 1194.78 42.67 > --- > Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > > > I hope that this is of help. > > John The difference between models like lmer(Glycogen~Treatment+(1|Rat)+(1|Rat:Liver)) and lmer(Glycogen~Treatment+(1|Treatment:Rat)+(1|Treatment:Rat:Liver)) is more about the meaning of the levels of "Rat" than about the meaning of "Treatment". As I understood it there are three different rats labelled 1. There is a rat 1 on treatment 1 and a rat 1 on treatment 2 and a rat 1 on treatment 3. Thus the levels of Rat do not designate the "experimental unit", it is the levels of Treatment:Rat that do this. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Avoid Sweave from stopping on errors
On Wed, 7 Sep 2005, Douglas Bates wrote: > On 9/7/05, Doran, Harold <[EMAIL PROTECTED]> wrote: > > You could use <>= and the code inside the chunk will not > > be evaluated. I suppose two other options could be to comment out the > > bad code inside the code chunk or to use verbatim to make it look like > > a code chunk in your output. > > > > > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vincent > > Goulet > > Sent: Wednesday, September 07, 2005 11:44 AM > > To: r-help@stat.math.ethz.ch > > Subject: [R] Avoid Sweave from stopping on errors > > > > Hi all, > > > > Is there an option in Sweave to avoid it from stopping on a code chunk > > with an error? (I purposefully want to include code with an error in > > class notes.) > > > > I suspect the answer is "no" and that I will be pointed to > > options("error"). That'd be fine, but which error parameter will just > > "do nothing" in case of an error? > > > > Thanks in advance! > > > > Another option is to wrap the call that will produce an error in > try(). You still get the error report, etc. but execution does not > stop. This works very nicely for the original purposes, as the try() can be hidden and the command in error echoed: <>= y <- rnorm(10) is.na(y) <- 1 y @ <>= lm(y ~ 1, na.action=na.fail) @ <>= try_out <- try(lm(y ~ 1, na.action=na.fail)) cat(try_out) @ looks in output as it should, with the error message set after the command that provoked it. Sweave is a remarkable tool. -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [R-pkgs] Revised versions of the maptools and sp packages
Revised versions of maptools, a package for reading geographical data from shapefiles, and sp, a package with classes and methods for spatial data handling, have been released on CRAN. They are maptools release 0.5-1 and sp release 0.8-1. The maptools package now depends on sp (>= 0.8), so that users of maptools will need both to update the package itself, and to install the sp package. All previous maptools classes and functions are still available, but users are encouraged to try out the cleaner and more robust versions in sp. Further details of changes (particularly incompatible changes in sp) are available on the R-sig-geo mailing list (see the "Spatial" task view on CRAN), and at http://r-spatial.sourceforge.net -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Predicting responses using ace
I sent this email before, but I got a r-help-bounce message and I don know if it got to the m-list. Sorry if you had already seen it. I'm using the areg.boot function to do an ace regression. So far I've been able to do some simple running tests to fit a model with some input data, predict the response with new data, and find the inverse transform of such prediction (apparently). The commands I'm using are the following: library(MASS) library(Hmisc) xyt = read.table("tra100unifxy.dat") #2x100 table of training data (expl. variables) zt = read.table("tra100unifzR.dat") #1x100 table of training data (resp. variables) zs = read.table("sim1z.dat") #2x1 table of new data to predict (expl. variables) xys = read.table("sim1xy.dat") #1x1 table of expected responses x = xyt[,1] y = xyt[,2] z = zt[,1] xynew = data.frame(x=xys[,1],y=xys[,2]) ace.r = areg.boot(z ~ x + y, B = 100) f = Function(ace.r, ytype='inverse') za = f$z(predict(ace.r,xynew)) I have a couple question: 1.) Is that the correct way of finding the inverse transform for the responses? 2.) I'm evaluating the model's goodness of fit using the Fraction of Variance Unexplained, which I'm calculating as: rsa = za - zs FVUa = sum(rsa*rsa)/(1*var(zs)) #1 is the size of the test set The thing is I'm not getting satisfactory results. Is there a way to improve the results of the regression?. At the moment I'm not too confident with the formula I'm using as a parameter for areg.boot, since the response variables were generated as a substantially more complex function than z = x+y. I don't get this formula thing yet and maybe I'm passing a totally unrelated formula to the function. On 9/7/05, Frank E Harrell Jr <[EMAIL PROTECTED]> wrote: > > Luis Pineda wrote: > > Well, I had no idea, since I read this in the documentation: > > > > "|x| - for |transace| a numeric matrix. For |areg.boot| |x| may be a > > numeric matrix or a formula...||" > > > > Luis Pineda > > Sorry about that - you are right. > > Thomas - please debug the code to make areg.boot work with x = numeric > matrix, or correct the help file. Thanks -Frank > > -- > Frank E Harrell Jr Professor and Chair School of Medicine > Department of Biostatistics Vanderbilt University > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Using Tk table widget to display matrix
Has anyone written a matrix editor or data.entry() replacement using the Tk table widget? I've been playing around with the examples at http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tktable.html and making some progress, but I'd rather not spend much time on this if someone else has already done it. Jeff __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Leading in line-wrapped Lattice value and panel labels
On 9/7/05, Tim Churches <[EMAIL PROTECTED]> wrote: > Version 2.1.1 > Platforms: all > > What is the trellis parameter (or is there a trellis parameter) to set the > leading (the gap between lines) when long axis values labels or panel header > labels wrap over more than one line? By default, there is a huge gap between > lines, and much looking and experimentation has not revealed to me a suitable > parameter to adjust this. > There is none. Whatever grid.text does happens. 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
[R] Language issue
Dear all, I am running R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 Under Mac os X, a french version! I am preparing a package and I got the following issue I am trying to read dates that are written in english and have them recognized by R using as.Date function. I realized strangely that when I type > month.abb [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" [11] "Nov" "Dec" I get the abbreviated english version of every month > x <- c("1-jan-1960", "2-feb-1960", >"31-mar-1960", "30-apr-1960","2-may-1960", >"31-jun-1960", "30-jul-1960","2-aug-1960", >"31-sep-1960", "30-oct-1960", "30-nov-1960", >"30-dec-1960"); > strptime(x, "%d-%b-%Y") [1] "1960-01-01" NA "1960-03-31" NA [5] NA NA "1960-07-30" NA [9] "1960-10-01" "1960-10-30" "1960-11-30" NA It is only once I have found through trial an error the french abbreviation, that I got a match for every month. > x <- c("1-jan-1960", "2-fév-1960", >"31-mar-1960", "30-avr-1960","2-mai-1960", >"31-jui-1960", "30-jul-1960","2-aoû-1960", >"31-sep-1960", "30-oct-1960", "30-nov-1960", >"30-déc-1960"); > strptime(x, "%d-%b-%Y") [1] "1960-01-01" "1960-02-02" "1960-03-31" "1960-04-30" [5] "1960-05-02" "1960-07-01" "1960-07-30" "1960-08-02" [9] "1960-10-01" "1960-10-30" "1960-11-30" "1960-12-30" I got simply two questions: First, why since R was install on a french system the month.abb command didn't give me the french abbreviations. Secondly, since I am producing a package, I would like to know how can I tell R to momentairly use the english abbreviations instead of the french ones... Thanks a lot -- Sébastien Durand Maîtrise en biologie Université de Montréal (514) 343-6864 Université du Québec à Montréal (514) 987-3000 (1572#) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Leading in line-wrapped Lattice value and panel labels
Hi Deepayan Sarkar wrote: > On 9/7/05, Tim Churches <[EMAIL PROTECTED]> wrote: > >> Version 2.1.1 Platforms: all >> >> What is the trellis parameter (or is there a trellis parameter) to >> set the leading (the gap between lines) when long axis values >> labels or panel header labels wrap over more than one line? By >> default, there is a huge gap between lines, and much looking and >> experimentation has not revealed to me a suitable parameter to >> adjust this. >> > > > There is none. Whatever grid.text does happens. grid does have a "lineheight" graphical parameter. For example, library(grid) grid.text("line one\nlinetwo", x=rep(1:3/4, each=3), y=rep(1:3/4, 3), gp=gpar(lineheight=1:9/2)) Could you add this in relevant places in trellis.par Deepayan? Paul -- 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
Re: [R] Using Tk table widget to display matrix
[EMAIL PROTECTED] writes: > Has anyone written a matrix editor or data.entry() replacement using the Tk > table widget? I've been playing around with the examples at > > http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tktable.html > > and making some progress, but I'd rather not spend much time on this if > someone else has already done it. I don't think so. It's been on my mind for a long time a I put in the tclArray stuff to support it. As you've seen, James W. took it up and went quite some distance with it, but he didn't go all the way. When I've been thinking of these matters, I've been sidetracked by a generic issue with Tcl extensions: How do you make sure that e.g. tktable is available? Installation instructions tend to become nontrivial and depend on details of the Tcl installation. One possible idea that I have been toying with is to wrap the whole extension in an R package, but we seem to have some issues on Windows where building Tcl/Tk themselves using the Mingw32 toolchain doesn't quite work. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Leading in line-wrapped Lattice axis value and panel labels
Paul Murrell wrote: > Hi > > Deepayan Sarkar wrote: > > On 9/7/05, Tim Churches <[EMAIL PROTECTED]> wrote: > > > >> Version 2.1.1 Platforms: all > >> > >> What is the trellis parameter (or is there a trellis parameter) to > >> set the leading (the gap between lines) when long axis values > >> labels or panel header labels wrap over more than one line? By > >> default, there is a huge gap between lines, and much looking and > >> experimentation has not revealed to me a suitable parameter to > >> adjust this. > >> > > > > There is none. Whatever grid.text does happens. > > grid does have a "lineheight" graphical parameter. For example, > > library(grid) > grid.text("line one\nlinetwo", > x=rep(1:3/4, each=3), > y=rep(1:3/4, 3), > gp=gpar(lineheight=1:9/2)) > > Could you add this in relevant places in trellis.par Deepayan? > Is there a work around we could use in the meantime, or should we attempt to hack trellis.par as per Paul's suggestion (gulp!)? I suppose that is like asking "Should we attempt to climb Teichelmann?" - it depends... We have increased the depth of the panel headers, but this wastes plotting area and the tops of the tees and effs on the upper line and the bottoms of the gees and whys on the bottom line are still cut off, so large is the gap between the two lines. And increasing the panel header depth it doesn't help with y-axis labels - typically the second line of one label will abut the first line of the next label, giving a results which is rather like: Value - One Value - Two Value - Three Value - Four where the actual value labels are "Value One", "Value Two" etc and the "-" are the tick marks. Less than ideal. Suggestions for interim fixes (other than using abbreviated labels... we've thought of that) most welcome. Tim C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Predicting responses using ace
Luis Pineda wrote: > I sent this email before, but I got a r-help-bounce message and I don know > if it got to the m-list. Sorry if you had already seen it. > > I'm using the areg.boot function to do an ace regression. So far I've been > able to do some simple running tests to fit a model with some input data, > predict the response with new data, and find the inverse transform of such > prediction (apparently). The commands I'm using are the following: > > library(MASS) > library(Hmisc) > xyt = read.table("tra100unifxy.dat") #2x100 table of training data (expl. > variables) > zt = read.table("tra100unifzR.dat") #1x100 table of training data (resp. > variables) > zs = read.table("sim1z.dat") #2x1 table of new data to predict > (expl. variables) > xys = read.table("sim1xy.dat") #1x1 table of expected responses > x = xyt[,1] > y = xyt[,2] > z = zt[,1] > xynew = data.frame(x=xys[,1],y=xys[,2]) > ace.r = areg.boot(z ~ x + y, B = 100) > f = Function(ace.r, ytype='inverse') > za = f$z(predict(ace.r,xynew)) > > I have a couple question: > > 1.) Is that the correct way of finding the inverse transform for the > responses? Yes > 2.) I'm evaluating the model's goodness of fit using the Fraction of > Variance Unexplained, which I'm calculating as: > > rsa = za - zs > FVUa = sum(rsa*rsa)/(1*var(zs)) #1 is the size of the test set That is not corrected for overfitting. You need to use the print method for the areg.boot object and note the Bootstrap validated R2 > > The thing is I'm not getting satisfactory results. Is there a way to improve > the results of the regression?. At the moment I'm not too confident with the > formula I'm using as a parameter for areg.boot, since the response variables > were generated as a substantially more complex function than z = x+y. I > don't get this formula thing yet and maybe I'm passing a totally unrelated > formula to the function. z ~ x + y tells areg.boot to fit a model f(z) = g(x) + h(y) which is quite general, if x and y are additive. Frank > > On 9/7/05, Frank E Harrell Jr <[EMAIL PROTECTED]> wrote: > >>Luis Pineda wrote: >> >>>Well, I had no idea, since I read this in the documentation: >>> >>>"|x| - for |transace| a numeric matrix. For |areg.boot| |x| may be a >>>numeric matrix or a formula...||" >>> >>>Luis Pineda >> >>Sorry about that - you are right. >> >>Thomas - please debug the code to make areg.boot work with x = numeric >>matrix, or correct the help file. Thanks -Frank >> >>-- -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Leading in line-wrapped Lattice axis value and panel labels
Hi Tim Churches wrote: > Paul Murrell wrote: > >> Hi >> >> Deepayan Sarkar wrote: >> > On 9/7/05, Tim Churches <[EMAIL PROTECTED]> wrote: >> > >> >> Version 2.1.1 Platforms: all >> >> >> >> What is the trellis parameter (or is there a trellis parameter) to >> >> set the leading (the gap between lines) when long axis values >> >> labels or panel header labels wrap over more than one line? By >> >> default, there is a huge gap between lines, and much looking and >> >> experimentation has not revealed to me a suitable parameter to >> >> adjust this. >> >> >> > >> > There is none. Whatever grid.text does happens. >> >> grid does have a "lineheight" graphical parameter. For example, >> >> library(grid) >> grid.text("line one\nlinetwo", >> x=rep(1:3/4, each=3), >> y=rep(1:3/4, 3), >> gp=gpar(lineheight=1:9/2)) >> >> Could you add this in relevant places in trellis.par Deepayan? >> > Is there a work around we could use in the meantime, or should we > attempt to hack trellis.par as per Paul's suggestion (gulp!)? I suppose > that is like asking "Should we attempt to climb Teichelmann?" - it > depends... We have increased the depth of the panel headers, but this > wastes plotting area and the tops of the tees and effs on the upper line > and the bottoms of the gees and whys on the bottom line are still cut > off, so large is the gap between the two lines. And increasing the > panel header depth it doesn't help with y-axis labels - typically the > second line of one label will abut the first line of the next label, > giving a results which is rather like: > > Value > - > One > Value > - > Two > Value > - > Three > Value >- > Four > > where the actual value labels are "Value One", "Value Two" etc and the > "-" are the tick marks. Less than ideal. > > Suggestions for interim fixes (other than using abbreviated labels... > we've thought of that) most welcome. I don't think lattice explicitly sets lineheight so you could try something like the following (push a [full-page] grid viewport that sets lineheight then draw lattice plot within that) ... library(grid) library(lattice) states <- data.frame(state.x77, state.name = dimnames(state.x77)[[1]], state.region = factor(state.region)) levels(states$state.region) <- c("Northeast", "South", "North\n Central", "West") xyp <- xyplot(Murder ~ Population | state.region, data = states, groups = as.character(state.name), panel = function(x, y, subscripts, groups) ltext(x = x, y = y, label = groups[subscripts], srt = -50, col = "blue", cex=.9, fontfamily = "HersheySans"), par.strip.text = list(cex = 1.3, font = 4, col = "brown", lines = 2), xlab = "Estimated Population\nJuly 1, 1975", ylab = "Murder Rate \n(per 100,000 population)\n 1976", main = "Murder Rates in US states") # default line height for comparison print(xyp) # control line height grid.newpage() pushViewport(viewport(gp=gpar(lineheight=0.8))) print(xyp, newpage=FALSE) popViewport() ... this does not work perfectly for me, but I'm not sure (yet) whether that is a problem in grid, a problem in lattice, or a problem with Hershey fonts (that are used in this example) so your mileage may vary. Paul -- 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
Re: [R] Language issue
Sebastien Durand wrote: > Dear all, > > I am running > R : Copyright 2005, The R Foundation for Statistical Computing > Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 > Under Mac os X, a french version! > > I am preparing a package and I got the following issue > > I am trying to read dates that are written in > english and have them recognized by R using > as.Date function. > > I realized strangely that when I type > >> month.abb > > [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" > [11] "Nov" "Dec" > > I get the abbreviated english version of every month > > >> x <- c("1-jan-1960", "2-feb-1960", >>"31-mar-1960", "30-apr-1960","2-may-1960", >>"31-jun-1960", "30-jul-1960","2-aug-1960", >>"31-sep-1960", "30-oct-1960", "30-nov-1960", >>"30-dec-1960"); >> strptime(x, "%d-%b-%Y") > > [1] "1960-01-01" NA "1960-03-31" NA > [5] NA NA "1960-07-30" NA > [9] "1960-10-01" "1960-10-30" "1960-11-30" NA > > It is only once I have found through trial an > error the french abbreviation, that I got a match > for every month. > > >> x <- c("1-jan-1960", "2-fév-1960", >>"31-mar-1960", "30-avr-1960","2-mai-1960", >>"31-jui-1960", "30-jul-1960","2-aoû-1960", >>"31-sep-1960", "30-oct-1960", "30-nov-1960", >>"30-déc-1960"); >> strptime(x, "%d-%b-%Y") > > [1] "1960-01-01" "1960-02-02" "1960-03-31" "1960-04-30" > [5] "1960-05-02" "1960-07-01" "1960-07-30" "1960-08-02" > [9] "1960-10-01" "1960-10-30" "1960-11-30" "1960-12-30" > > I got simply two questions: > > First, why since R was install on a french system > the month.abb command didn't give me the french > abbreviations. It is documented to give English names. It might be an idea to have a variable that gives months in the local language, but I don't know if the current translation system supports that. It would need to have a different name than month.abb. > > Secondly, since I am producing a package, I would > like to know how can I tell R to momentairly use > the english abbreviations instead of the french > ones... I don't know, but I'd try Sys.setlocale(). Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Fisher's method in discriminant analysis
At 13:15 5/9/2005, you wrote: >Hi, > > I'm using mda library to solve a discriminant >analysis. I get results, but the thing is that I want >to use Fisher's method to obtain the classification >functions and I'm lost in what I should do: libraries >to use, ... Can anybody give me a clue?? Hi Carlos, I think you need something this require(mda) data(iris) attach(iris) irisfit <- mda(Species ~ ., data = iris) irisfit$fit$coef[,1:2] r1<- -4.23481161+0.37972423*Sepal.Length+0.59682846*Sepal.Width+0.01575609*Petal.Length+0.11009570*Petal.Width r2<-0.31169082-0.05826293*Sepal.Length-0.23855482*Sepal.Width+0.18922693*Petal.Length+0.03917652*Petal.Width plot(r1,r2,pch = 21, bg = c("red", "green3", "blue")[unclass(iris$Species)]) Bernardo Rangel Tura, MD, MSc National Institute of Cardiology Laranjeiras Rio de Janeiro Brazil -- No virus found in this outgoing message. Checked by AVG Anti-Virus. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R: optim
On Wed, 7 Sep 2005, Clark Allan wrote: > > $MLE$message > [1] "ERROR: ABNORMAL_TERMINATION_IN_LNSRCH" > > > WHAT DOES THIS ERROR MESSAGE MEAN??? > Looking at the code in optim() a little, it looks as though this error comes when the optimiser tries to do a line search in the steepest descent direction and finds that the derivative along this line is positive, which is impossible. I have seen this when the gradient is wrong, and I suppose it could also happen with numerical gradients when the surface is nearly flat or the problem is very badly scaled. Eg, using the functions in example(optim) and making the gradient wrong: > optim(c(-1.2, 1), fr, function(theta) grr(theta)+1, method = "L-BFGS-B") $par [1] 0.25034245 0.05769649 $value [1] 0.5644614 $counts function gradient 96 96 $convergence [1] 52 $message [1] "ERROR: ABNORMAL_TERMINATION_IN_LNSRCH" -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
[R] graphics support in R help files
I looked through the "Writing R Extensions" pdf, and I don't see how graphics can be input in help files. For example, if I had a .eps plot that I wanted to include in a help file, what would the syntax be to include it in an R help file? If there is graphics support in help files, which format are supported (e.g., gif, png, jpg, eps, ps)? Thanks, -Len Kannapell __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] control parameter for Nelder-Mead algorithm in optim()
Hi, In manual for optim() function, there are three control parameters for Nelder-Mead algorithm: alpha (reflection),beta(contraction) and gamma(expansion), but in the original paper, there is another parameter delta which controls shrinkage, how can I set this shrink parameter? Or is beta actually the same meaning as delta? TIA WC __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Interpolating / smoothing missing time series data
The purpose of this email is to ask for pre-built procedures or techniques for smoothing and interpolating missing time series data. I've made some headway on my problem in my spare time. I started with an irregular time series with lots of missing data. It even had duplicated data. Thanks to zoo, I've cleaned that up -- now I have a regular time series with lots of NA's. I want to use a regression model (i.e. ARIMA) to ill in the gaps. I am certainly open to other suggestions, especially if they are easy to implement. My specific questions: 1. Presumably, once I get ARIMA working, I still have the problem of predicting the past missing values -- I've only seen examples of predicting into the future. 2. When predicting the past (backcasting), I also want to take reasonable steps to make the data look smooth. I guess I'm looking for a really good example in a textbook or white paper (or just an R guru with some experience in this area) that can offer some guidance. Venables and Ripley was a great start (Modern Applied Statistics with S). I really had hoped that the "Seasonal ARIMA Models" section on page 405 would help. It was helpful, but only to a point. I have a hunch (based on me crashing arima numerous times -- maybe I'm just new to this and doing things that are unreasonable?) that using hourly data just does not mesh well with the seasonal arima code? -David __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Crash with seasonal ARIMA
The following command crashes my Mac OS X version of R: (I'm running R on a PowerMac G5, with 1 GB of RAM and dual processors.) > arima.0 <- arima(w3.ts,order=c(1,0,0),seasonal=list(order=c (1,0,0),period=365)) -David Here is some background: w3.ts is hourly temperature data with about 20% NA's. It contains about 3.5 years of data. I am using period = 365, which makes sense me to me. Is this wrong? > summary(w3.ts) Min. 1st Qu. MedianMean 3rd Qu.Max.NA's 14.00 54.00 68.00 66.09 78.00 108.00 2976.00 > length(w3.ts) [1] 29542 > frequency(w3.ts) [1] 24 > deltat(w3.ts) [1] 0.0417 > w3.ts[300:400] [1] 61 63 64 68 66 64 61 59 62 56 53 49 43 45 47 46 44 42 42 40 42 48 52 55 [25] 57 59 60 60 60 59 52 50 49 45 47 41 38 36 37 35 36 37 39 39 38 42 49 54 [49] 58 61 63 64 63 62 59 55 54 51 55 53 53 NA NA NA NA NA NA NA NA NA NA NA [73] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [97] NA NA NA NA NA > w3.ts[720:770] [1] NA NA NA NA NA NA NA NA [9] NA NA NA NA NA NA NA NA [17] NA NA NA NA NA NA NA NA [25] NA 41.5 46.5 40.0 42.5 37.5 41.0 36.5 [33] 40.5 38.5 42.5 41.0 46.0 43.5 46.5 43.5 [41] 47.5 41.5 47.5 42.5 47.3 47.7 51.0 41.5 [49] 51.5 40.0 52.5 -David __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] graphics support in R help files
I cannot state this with the certainty that others might, but the Rd format is a text format. If you want to produce something else then you need to choose an alternative method. For instance, 1.4 of "Writing R Extensions" notes that "Documents in 'inst/doc' can be in arbitrary format, however we strongly recommend to provide them in PDF format, such that users on all platforms can easily read them." Tom > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Leonard > Kannapell > Sent: Thursday, 8 September 2005 8:07 AM > To: r-help@stat.math.ethz.ch > Subject: [R] graphics support in R help files > > > I looked through the "Writing R Extensions" pdf, and I don't > see how graphics > can be input in help files. For example, if I had a .eps plot > that I wanted > to include in a help file, what would the syntax be to > include it in an R > help file? > > If there is graphics support in help files, which format are > supported (e.g., > gif, png, jpg, eps, ps)? Thanks, > > -Len Kannapell > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Crash with seasonal ARIMA
Actually, I think period = 365 * 24 = 8760 is really what I need. That crashes arima as well. > I am using period = 365, which makes sense me to me. Is this wrong? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] RMySQL installation problem on FC4 x86_64
Dear useRs, I'm having a hard time installing RMySQL on a FC4 x86_64 box (R 2.1.0 and MySQL 4.1.11-2 installed through yum). After an initial configuration error ("could not find the MySQL installation include and/or library directories") I managed to install RMySQL with # export PKG_LIBS="-L -lmysqlclient" # R CMD INSTALL RMySQL_0.5-5.tar.gz However, when I load the package I get this error: > require(RMySQL) Loading required package: RMySQL Loading required package: DBI Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/lib64/R/library/RMySQL/libs/RMySQL.so': /usr/lib64/R/library/RMySQL/libs/RMySQL.so: undefined symbol: mysql_field_count [1] FALSE Can anyone offer a suggestion, or perhaps email me a precompiled binary? Thank you, b. platform "x86_64-redhat-linux-gnu" arch "x86_64" os "linux-gnu" system "x86_64, linux-gnu" status "" major"2" minor"1.0" year "2005" month"04" day "18" language "R" # yum list installed mysql Installed Packages mysql.i3864.1.11-2 installed mysql.x86_64 4.1.11-2 installed __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Experimental data analysis (eda) function
Hello, I cant seen to find the equivalent function in version 2.1.1. This always served as a nice preliminary tool for looking visually at data. Thanks, Matt Matthew MacManes PhD Student Museum of Vertebrate Zoology Department of Integrative Biology UC-Berkeley Berkeley, CA. 94720 Office: (510) 642-7782 Fax: (510) 643-8238 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (no subject)
Salang Pan wrote: > hi, > > Is it possible to draw a string text in a rectangle according the width of > this rectangle? that is, the fontsize of this string text can be adjusted > according the width of the rectangle. > How to set the cex parameter in text function? > > text (x, y = NULL, labels = seq(along = x), adj = NULL, > pos = NULL, offset = 0.5, vfont = NULL, > cex = 1, col = NULL, font = NULL, xpd = NULL, ...) > Hi Salang, Have a look at boxed.labels() and textbox() in the plotrix package. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Interpolating / smoothing missing time series data
On 9/7/05, David James <[EMAIL PROTECTED]> wrote: > The purpose of this email is to ask for pre-built procedures or > techniques for smoothing and interpolating missing time series data. > > I've made some headway on my problem in my spare time. I started > with an irregular time series with lots of missing data. It even had > duplicated data. Thanks to zoo, I've cleaned that up -- now I have a > regular time series with lots of NA's. > > I want to use a regression model (i.e. ARIMA) to ill in the gaps. I > am certainly open to other suggestions, especially if they are easy > to implement. > > My specific questions: > 1. Presumably, once I get ARIMA working, I still have the problem of > predicting the past missing values -- I've only seen examples of > predicting into the future. > 2. When predicting the past (backcasting), I also want to take > reasonable steps to make the data look smooth. > > I guess I'm looking for a really good example in a textbook or white > paper (or just an R guru with some experience in this area) that can > offer some guidance. > > Venables and Ripley was a great start (Modern Applied Statistics with > S). I really had hoped that the "Seasonal ARIMA Models" section on > page 405 would help. It was helpful, but only to a point. I have a > hunch (based on me crashing arima numerous times -- maybe I'm just > new to this and doing things that are unreasonable?) that using > hourly data just does not mesh well with the seasonal arima code? Not sure if this answers your question but if you are looking for something simple then na.approx in the zoo package will linearly interpolate for you. > z <- zoo(c(1,2,NA,4,5)) > na.approx(z) 1 2 3 4 5 1 2 3 4 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
[R] Effect of data set size on calculation
Dear listers, I have a piece of code which performs an ANOVA type of analysis on 2D GC data. The code is shown below: # ANOVA 2D GC analysis # maxc <- number of samples # nreps <- number of samples maxc <- 2 nreps <- 4 sscl <- NULL cmean <- NULL # # Initial stat. variable # dftot <- nrow(mat)-1 dfcl <- maxc - 1 dferr <- dftot - dfcl totmean <- mean(mat) sstot <- sd(mat)^2*dftot # # Calculate class-to-class variance # for (j in 1:maxc) { cmean <- rbind(cmean,mean(mat[((j-1)*nreps+1):((j-1)*nreps+nreps),])) } for (j in 1:ncol(mat)) { cmean[,j] <- cmean[,j]-totmean[j] } cmean <- (cmean)^2*nreps for (i in 1:ncol(mat)) { sscl[i] <- sum(cmean[,i]) } # # sserr <- sstot-sscl # ratios <- (sscl/dfcl)/((sstot-sscl)/dferr) I have tested the above on a small data set (based on average on the second dimension) and produced a result which was meaningful. However, when I analyse data with both dimensions (larger dataset), the analysis is not successful. I've narrowed the problem down to the calculation for cmean but I have no idea why there is a problem. If anyone has any suggestions then feel free to comment. Relevant output is given below. Many thanks, Peter. # Averaged dataset > ncol(mat) [1] 636 > nrow(mat) [1] 8 [SNIP] > for (j in 1:maxc) { + cmean <- rbind(cmean,mean(mat[((j-1)*nreps+1):((j-1)*nreps+nreps),])) + } > cmean V2 V3 V4 V5 V6 V7 V8 V9 [1,] 27.38970 27.68816 27.80730 27.72688 27.68044 27.33749 6667.038 15537.47 [2,] 26.36001 26.72920 26.64940 26.82506 26.54539 26.30811 8029.746 13656.60 ... [SNIP] V634 V635 V636 V637 [1,] 27.51868 27.51270 27.52344 27.52127 [2,] 26.45830 26.45837 26.46089 26.46407 > # Full dataset > nrow(mat) [1] 8 > ncol(mat) [1] 390010 [SNIP] > for (j in 1:maxc) { + cmean <- rbind(cmean,mean(mat[((j-1)*nreps+1):((j-1)*nreps+nreps),])) + } > cmean [,1] [1,] 54.48274 [2,] 63.14705 > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Creating very small plots (2.5 cm wide) in Sweave
Hi everyone, I was wondering if anyone has any code they could share for creating thumbnail plots in Sweave. For example, I'd like a plot like the following: y <- c(40, 46, 39, 44, 23, 36, 70, 39, 30, 73, 53, 74) x <- c(6, 4, 3, 6, 1, 5, 6, 2, 1, 8, 4, 6) opar <- par(mar=c(3,3,0,0)) plot(x, y, xlab="", ylab="") abline(h=mean(y), col="red") par(opar) to come out about 2.5 cm wide. Thanks for any assistance, Andrew -- Andrew Robinson Senior Lecturer in Statistics Tel: +61-3-8344-9763 Department of Mathematics and StatisticsFax: +61-3-8344-4599 University of Melbourne, VIC 3010 Australia Email: [EMAIL PROTECTED]Website: http://www.ms.unimelb.edu.au __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Prediction with multiple zeros in the dependent variable
I have a batch of data in each line of data contains three values, calcium score, age, and sex. I would like to predict calcium scores as a function of age and sex, i.e. calcium=f(age,sex). Unfortunately the calcium scorers have a very "ugly distribution". There are multiple zeros, and multiple values between 300 and 600. There are no values between zero and 300. Needless to say, the calcium scores are not normally distributed, however, the values between 300 and 600 have a distribution that is log normal. As you might imagine, the residuals from the regression are not normally distributed and thus violates the basic assumption of regression analyses. Does anyone have a suggestion for a method (or a transformation) that will allow me predict calcium from age and sex without violating the assumptions of the model? Thanks, John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC and University of Maryland School of Medicine Claude Pepper OAIC University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 410-605-7119 - NOTE NEW EMAIL ADDRESS: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] RMySQL installation problem on FC4 x86_64
On 7 Sep 2005, [EMAIL PROTECTED] wrote: > # yum list installed mysql > Installed Packages > mysql.i3864.1.11-2 installed > mysql.x86_64 4.1.11-2 installed I would have thought that you need to have a mysql-dev.x86_64 rpm package installed in order to get the headers to be able to compile, etc. Not a redhat or yum user myself, so don't know. But the error message about unable to find header files is often solved by installed the appropriate devel package that contains those headers. + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Interpolating / smoothing missing time series data
I don't have much experience in the subject but it seems that library(akima) should be useful for your problem. Try library(help="akima") to see a list of the functions available in the library. I hope this helps Francisco >From: Gabor Grothendieck <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: David James <[EMAIL PROTECTED]> >CC: r-help@stat.math.ethz.ch >Subject: Re: [R] Interpolating / smoothing missing time series data >Date: Wed, 7 Sep 2005 22:19:17 -0400 > >On 9/7/05, David James <[EMAIL PROTECTED]> wrote: > > The purpose of this email is to ask for pre-built procedures or > > techniques for smoothing and interpolating missing time series data. > > > > I've made some headway on my problem in my spare time. I started > > with an irregular time series with lots of missing data. It even had > > duplicated data. Thanks to zoo, I've cleaned that up -- now I have a > > regular time series with lots of NA's. > > > > I want to use a regression model (i.e. ARIMA) to ill in the gaps. I > > am certainly open to other suggestions, especially if they are easy > > to implement. > > > > My specific questions: > > 1. Presumably, once I get ARIMA working, I still have the problem of > > predicting the past missing values -- I've only seen examples of > > predicting into the future. > > 2. When predicting the past (backcasting), I also want to take > > reasonable steps to make the data look smooth. > > > > I guess I'm looking for a really good example in a textbook or white > > paper (or just an R guru with some experience in this area) that can > > offer some guidance. > > > > Venables and Ripley was a great start (Modern Applied Statistics with > > S). I really had hoped that the "Seasonal ARIMA Models" section on > > page 405 would help. It was helpful, but only to a point. I have a > > hunch (based on me crashing arima numerous times -- maybe I'm just > > new to this and doing things that are unreasonable?) that using > > hourly data just does not mesh well with the seasonal arima code? > >Not sure if this answers your question but if you are looking for something >simple then na.approx in the zoo package will linearly interpolate for you. > > > z <- zoo(c(1,2,NA,4,5)) > > na.approx(z) >1 2 3 4 5 >1 2 3 4 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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating very small plots (2.5 cm wide) in Sweave
Others may propose more elegant solutions but, in windows one quick an dirty option would be to change the argument 'pin' and 'fin' within par to get an image of exactly 1 inch (2.54 cm) i.e. y <- c(40, 46, 39, 44, 23, 36, 70, 39, 30, 73, 53, 74) x <- c(6, 4, 3, 6, 1, 5, 6, 2, 1, 8, 4, 6) par(pin=c(1,1), fin=c(1,1)) plot(x, y, xlab="", ylab="") abline(h=mean(y), col="red") #Save the plot in bmp format savePlot("myplot", "bmp") and then manually crop the picture using your favorite picture package or even within a word processor. I hope this helps Francisco >From: Andrew Robinson <[EMAIL PROTECTED]> >To: R-Help Discussion >Subject: [R] Creating very small plots (2.5 cm wide) in Sweave >Date: Thu, 8 Sep 2005 13:40:17 +1000 > >Hi everyone, > >I was wondering if anyone has any code they could share for creating >thumbnail plots in Sweave. For example, I'd like a plot like the >following: > >y <- c(40, 46, 39, 44, 23, 36, 70, 39, 30, 73, 53, 74) >x <- c(6, 4, 3, 6, 1, 5, 6, 2, 1, 8, 4, 6) >opar <- par(mar=c(3,3,0,0)) >plot(x, y, xlab="", ylab="") >abline(h=mean(y), col="red") >par(opar) > >to come out about 2.5 cm wide. > >Thanks for any assistance, > >Andrew >-- >Andrew Robinson >Senior Lecturer in Statistics Tel: +61-3-8344-9763 >Department of Mathematics and StatisticsFax: +61-3-8344-4599 >University of Melbourne, VIC 3010 Australia >Email: [EMAIL PROTECTED]Website: >http://www.ms.unimelb.edu.au > >__ >R-help@stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! >http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Interpolating / smoothing missing time series data
Francisco J. Zagmutt wrote: > I don't have much experience in the subject but it seems that library(akima) > should be useful for your problem. Try library(help="akima") to see a list > of the functions available in the library. > > I hope this helps > > Francisco Yes, function aspline() of package akima is well suited for such things: no wiggles like in spline() and less variance reducing than approx(). But in any case: excessive interpolation will definitely lead to biased results, in particular artificial autocorrelations. If ever possible, David should look for methods, capable of dealing with missing data directly. Thomas P. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating very small plots (2.5 cm wide) in Sweave
Dear Francisco, thanks for your solution. It turns out that it's best for me to use \setkeys{Gin}{width=0.15\textwidth} directly before I call the plot - that seems to work just fine. Andrwe On Thu, Sep 08, 2005 at 05:44:59AM +, Francisco J. Zagmutt wrote: > Others may propose more elegant solutions but, in windows one quick an > dirty option would be to change the argument 'pin' and 'fin' within par to > get an image of exactly 1 inch (2.54 cm) i.e. > > y <- c(40, 46, 39, 44, 23, 36, 70, 39, 30, 73, 53, 74) > x <- c(6, 4, 3, 6, 1, 5, 6, 2, 1, 8, 4, 6) > par(pin=c(1,1), fin=c(1,1)) > plot(x, y, xlab="", ylab="") > abline(h=mean(y), col="red") > > #Save the plot in bmp format > savePlot("myplot", "bmp") > > and then manually crop the picture using your favorite picture package or > even within a word processor. > > I hope this helps > > Francisco > > > >From: Andrew Robinson <[EMAIL PROTECTED]> > >To: R-Help Discussion > >Subject: [R] Creating very small plots (2.5 cm wide) in Sweave > >Date: Thu, 8 Sep 2005 13:40:17 +1000 > > > >Hi everyone, > > > >I was wondering if anyone has any code they could share for creating > >thumbnail plots in Sweave. For example, I'd like a plot like the > >following: > > > >y <- c(40, 46, 39, 44, 23, 36, 70, 39, 30, 73, 53, 74) > >x <- c(6, 4, 3, 6, 1, 5, 6, 2, 1, 8, 4, 6) > >opar <- par(mar=c(3,3,0,0)) > >plot(x, y, xlab="", ylab="") > >abline(h=mean(y), col="red") > >par(opar) > > > >to come out about 2.5 cm wide. > > > >Thanks for any assistance, > > > >Andrew > >-- > >Andrew Robinson > >Senior Lecturer in Statistics Tel: +61-3-8344-9763 > >Department of Mathematics and StatisticsFax: +61-3-8344-4599 > >University of Melbourne, VIC 3010 Australia > >Email: [EMAIL PROTECTED]Website: > >http://www.ms.unimelb.edu.au > > > >__ > >R-help@stat.math.ethz.ch mailing list > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide! > >http://www.R-project.org/posting-guide.html > -- Andrew Robinson Senior Lecturer in Statistics Tel: +61-3-8344-9763 Department of Mathematics and StatisticsFax: +61-3-8344-4599 University of Melbourne, VIC 3010 Australia Email: [EMAIL PROTECTED]Website: http://www.ms.unimelb.edu.au __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html