Re: [R] SOLVED kubuntu repository (was vcd package, assoc())
Thanks for your help. And sorry for not having noticed that kubuntu dapper packages were very outdated. This might help other kubuntu dapper users: - add this line to /etc/apt/sources.list deb http://cran.R-project.org/bin/linux/ubuntu dapper/ - uninstall all previously installed r packages added via apt (don't just update them); - update your installation by reinstalling the packages. vcd package now works. Le mercredi 06 décembre 2006 08:42, vous avez écrit : Nicolas Mazziotta wrote: R version is R 2.2.1 (kubuntu dapper package) So update your outdated version of R at first! At least to R-2.4.0, even better to R-2.4.0 patched which will soon become R-2.4.1. Anyway, David, the vcd maintainer, is certainly going to fix the DESCRIPTION's Depends entry. Best, Uwe Ligges Le mercredi 06 décembre 2006 08:26, Uwe Ligges a écrit : Error in unit.c(mar[4], unit(1, null), mar[2], legend_width) : It is invalid to combine unit objects with other types Works for me. Which version of R is this? R-2.4.0, R-patched or R-devel? -- Nicolas Mazziotta The contents of this e-mail, including any attachments, are confidential and are intended for the sole use of the individual or entity to which it is addressed. Any distribution, copying or dissemination of this message is expected to conform to all legal stipulations governing the use of information. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Show date on graph
Thanks Jim and Uwe!! Both methods work for me. Methods: 1. plot as.character(x) 2. mtext(format(date,%Y-%m-%d),...) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Re : stat question - not R question so ignore if not interested
For the first question x'(y-bx)0 or Cov(Ui,Xi)0 you have heterogeinity problem ! OLS estimator in this case in biased. The bias is equal to (Exx')^{-1}Exu You obtain obtain correct estimator by use instrumental variable or 2SLS ... Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. - Message d'origine De : Leeds, Mark (IED) [EMAIL PROTECTED] À : r-help@stat.math.ethz.ch Cc : C. Park [EMAIL PROTECTED] Envoyé le : Mardi, 5 Décembre 2006, 21h42mn 21s Objet : [R] stat question - not R question so ignore if not interested If do a scattrplot of data ( x and y ) and there are two clouds of points. One cloud is in the left bottom corner of the plot and the other cloud is in the upper right. If I fit a regression line to this data ( or equivalently , calculate a correlation ), then obviously, it is going to seem like x and y are related because a line has to be connected between the 2 clouds. But, there must be a regression assumption that is violated here because if the regressions are done separately on each cloud, then there really isn't a relationship between x and y. I was just wondering 1) what assumption in regression is being violated in the first case or 2) possibly if the regression is valid and the results just have some different interpreation ? Thanks. Mark This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ___ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internaut [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] intercept value in lme
Dear all, I've got a problem in fitting multilevel model in lme. I don't know to much about that but suspect that something is wrong with my model. I'm trying to fit: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z,~1|group,data=data,na.action=na.exclude,method=ML) where: X - dependent var. measured on a scale ranging from -25 to 0 Y - level 1 variable Z - level 1 variable In m1 the intercept value is equal -3, in m2 (that is after adding Lev 2 var.) is equal +16. What can be wrong with my variables? Is this possible that intercept value exceeds scale? Best regards, victor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] if(){} else{}
Hi a little bit quicker solution is based on subsetting and a fact that logical vector can be treated as numeric with FALSE=0 and TRUE = 1 Plant-sample(c(NA,1), 10, replace=T); Value1-rnorm(Plant); Value2-rnorm(Plant); mat-data.frame(Plant=Plant,Value1=Value1,Value2=Value2) system.time(mat$Plant1-c(B,A)[is.na(mat$Plant)+1]) [1] 0.03 0.02 0.05 NA NA system.time(mat$Plant2 - ifelse(is.na(mat$Plant), A, B)) [1] 0.28 0.01 0.30 NA NA with(mat, all.equal(Plant1, Plant2)) [1] TRUE HTH Petr On 6 Dec 2006 at 6:39, Andrew Robinson wrote: Date sent: Wed, 6 Dec 2006 06:39:32 +1100 From: Andrew Robinson [EMAIL PROTECTED] To: Hans-Juergen Eickelmann [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch Subject:Re: [R] if(){} else{} Hi Hans, try this ... mat - as.data.frame(cbind(Plant,Value1,Value2)) mat$Plant1 - ifelse(is.na(mat$Plant), A, B) Cheers Andrew On Tue, Dec 05, 2006 at 04:33:15PM +0100, Hans-Juergen Eickelmann wrote: Dear R-community, my data set looks like 'mat' below. Plant-c(NA,1,1,1,NA,NA,NA,NA,NA,1); Value1-rnorm(1:10); Value2-rnorm(1:10); mat-cbind(Plant,Value1,Value2); I receive data from two different sites. One site is identified by an interger number, the other site has no data in column Plant=NA. My pb: I'm trying to assign labels A or B to these 2 sites into a new column, but my if(){} else{} statement fails with the following statement: Error in if (is.na(mat$Plant == TRUE)) { : argument is of length zero if(is.na(mat$Plant==TRUE)){mat$Plant1=A} else{mat$Plant1=B}; I looked through the avail doc and R-help for some time but wasn't able to fix the pb. Thx Hans __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] stat question - not R question so ignore if not interested
I seem to remember a term lurking variable. Bert Gunter [EMAIL PROTECTED] wrote: ... But of course this is always the question underlying all empirical -- or maybe even scientific -- analysis: is there some other perhaps more fundamental variable out there that I'm missing that would explain what's really going on? I clearly remember George Box commenting on this in his Monday night beer and statistics sessions: after you're done and perhaps have written up and presented your (intricate!) analysis, you're always worried that someone might come along and say, Well, did you consider...? Cheers, Bert Bert Gunter Genentech Nonclinical Statistics South San Francisco, CA 94404 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Baron Sent: Tuesday, December 05, 2006 1:45 PM To: Richard M. Heiberger Cc: r-help@stat.math.ethz.ch; C. Park; Leeds,Mark (IED) Subject: Re: [R] stat question - not R question so ignore if not interested A classic example used by my colleague Paul Rozin (when he teaches Psych 1) is to compute the correlation between height and number of shoes owned, in the class. Shorter students own more shoes. But ... On 12/05/06 16:34, Richard M. Heiberger wrote: The missing piece is why there are two clusters. There is most likely a two-level factor distinguishing the groups that was not included in the model. It might not even have been measured and now you need to find it. Rich -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron Editor: Judgment and Decision Making (http://journal.sjdm.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 and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] summaryBy(): Is it the best option?
Hi I did not see any answer yet so I try. You can use aggregate, by or sapply. Something like aggregate(soc6a[, your columns], list(hh=hh), sum, na.rm=T) by(soc6a[, your columns], hh, sum, na.rm=T) sapply(split(soc6a[, your columns], hh), sum, na.rm=T) But you have to check speed gain by yourself. HTH Petr On 5 Dec 2006 at 1:30, Werner Wernersen wrote: Date sent: Tue, 5 Dec 2006 01:30:50 +0100 (CET) From: Werner Wernersen [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] summaryBy(): Is it the best option? Hi, since I have quite large tables and the processing takes quite a while I am curious if I can improve the performance of this aggregation somehow: At the moment I am using summaryBy from the doBy package under R 2.4.0, Win2K. summaryBy(soc_s6aq5 + soc_s6aq7 + soc_s6aq9 + soc_s6aq11 ~ hh + comgroup,soc6a,postfix=c(,,,),FUN=sum, na.rm=T) The data.frame has 124100 rows and 13 cols. Thanks for any hints! Werner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] test of spatial dependence??
How to test the spatial dependence of a column of data? for example [...] All I have is 25 numbers. If you don't have coordinates of your data, as I understand here, there's nothing you can do, of course ... If you have coordinates, you should compute the variogram -and/or the spatial covariance- of your data and look if they are meaningful. Hint: read a book about geostatistics. PS, could someone confirm that spatial dependence is equivalent to spatial correlation or spatial autocorrelation or not. So, to me there is a light difference, but it's really for advanced users, and maybe questionable. Bye. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Prediction and plottiong of several effects against response with GAM (mgcv)
Hi Using GAM (mgcv) I want plots of x against y. Using predict.gam when there is only one effect x works fine. However, when i want to make plots of several x agains y. Can this be done? I have tried using model.gam$model$x2 in pred.2.resp whitout making it work. Thanks Torleif Below is how I have done it: ss - alder==1CPUE0 x1 - altitude[ss] x2 - start[ss] x3 - bunndyp[ss] x4 - longitude[ss] y - CPUE[ss] mean.y - mean(y) model.gam - gam(y~ s(x2, bs=cc) + s(x1, bs=ts) + s(I(x3^.5),bs=ts), poisson, gamma=1.4) # to plot on the response scale val.for.pred - data.frame(x2=seq(min(x2), max(x2), length.out=222), x1=seq(min(x1), max(x1), length.out=222), x3=seq(min(x3), max(x3), length.out=222)) pred.2.resp - predict.gam(model.gam, val.for.pred ,type=response, se.fit=TRUE) lower.band - pred.2.resp$fit - 2*pred.2.resp$se.fit upper.band - pred.2.resp$fit + 2*pred.2.resp$se.fit pred.2.resp - data.frame(val.for.pred, pred.2.resp, lower.band, upper.band) # same thing on term scale pred.2.term - predict.gam(model.gam, val.for.pred ,type=terms, se.fit=TRUE) lower.band - pred.2.term$fit - 2*pred.2.term$se.fit upper.band - pred.2.term$fit + 2*pred.2.term$se.fit pred.2.term - data.frame(val.for.pred, pred.2.term, lower.band, upper.band) # it is easier to compare two plots instead of looking at these two data.frames plot(model.gam, residuals=T, pch=1, cex=0.7) abline(h=0) #To plot x2 against y plot(y~x2, col=grey(0.8), pch=19, cex=0.2) lines(fit~x2, col=blue, data=pred.2.resp) lines(lower.band~x2, col=red, lty=2, data=pred.2.resp) lines(upper.band~x2, col=red, lty=2, data=pred.2.resp) abline(h=coef(model.gam)[1],lty=5,col=grey(0.35)) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] vcd package, assoc()
Yes, he will :) Thanks, Uwe! David Uwe Ligges schrieb: Nicolas Mazziotta wrote: R version is R 2.2.1 (kubuntu dapper package) So update your outdated version of R at first! At least to R-2.4.0, even better to R-2.4.0 patched which will soon become R-2.4.1. Anyway, David, the vcd maintainer, is certainly going to fix the DESCRIPTION's Depends entry. Best, Uwe Ligges Le mercredi 06 décembre 2006 08:26, Uwe Ligges a écrit : Error in unit.c(mar[4], unit(1, null), mar[2], legend_width) : It is invalid to combine unit objects with other types Works for me. Which version of R is this? R-2.4.0, R-patched or R-devel? -- Dr. David Meyer Department of Information Systems and Operations Vienna University of Economics and Business Administration Augasse 2-6, A-1090 Wien, Austria, Europe Tel: +43-1-313 36 4393 Fax: +43-1-313 36 90 4393 HP: http://wi.wu-wien.ac.at/~meyer/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Questions about regression with time-series
Hi, I am using 2 times series and I want to carry out a regression of Seri1 by Serie2 using structured (autocorrelated) errors. (Equivalent to the autoreg function in SAS) I found the function gls (package nlme) and I made: gls_mens-gls(mening_s_des~dataATB, correlation = corAR1()) My problem is that I dont want a AR(1) structure but ARMA(n,p) but the execution fails : gls_mens-gls(mening_s_des~dataATB, correlation = corARMA(p=52)) Error in coef-.corARMA(`*tmp*`, value = c(11.2591629857661, 9.1821585359071, : Coefficient matrix not invertible This should be because most of the coefficients 52 are near to 0. I am looking for a way to be able : - To evaluate automatically my ARMA structure (if it exists) - To specify manually the not null lags for my ARMA structure (as a vector for example) Does anyone know about such functions? Thank you for your help [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] intercept value in lme
Dear Victor, this is a really difficult problem to intepret, let alone diagnose. Please provide commented, minimal, self-contained, reproducible code that will allow us to see what the problem is. Cheers Andrew On Wed, Dec 06, 2006 at 09:33:31AM +0100, victor wrote: Dear all, I've got a problem in fitting multilevel model in lme. I don't know to much about that but suspect that something is wrong with my model. I'm trying to fit: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z,~1|group,data=data,na.action=na.exclude,method=ML) where: X - dependent var. measured on a scale ranging from -25 to 0 Y - level 1 variable Z - level 1 variable In m1 the intercept value is equal -3, in m2 (that is after adding Lev 2 var.) is equal +16. What can be wrong with my variables? Is this possible that intercept value exceeds scale? Best regards, victor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can anyone read a S-PLUS .dmp file for me?
Anyone? John McHenry [EMAIL PROTECTED] wrote:Hi WizaRds, I tried reading the S-PLUS file ftp://ftp.research.att.com/dist/bayes-meta/hblm.dmp into R using data.restore(hblm.dmp) but I got an error: Error in attributes(value) - thelist[-match(c(.Data, .Dim, .Dimnames, : row names must be 'character' or 'integer', not 'double' In addition: Warning message: NAs introduced by coercion Does anyone know how to read this type of S-PLUS file into R? I am not familiar with it. On http://cran.r-project.org/doc/manuals/R-data.html it is suggested that it is usually more reliable to dump the object(s) in S-PLUS and source the dumpfile in R See also, http://tolstoy.newcastle.edu.au/R/help/05/12/18209.html I don't know how this file was created. Could someone with S-PLUS access please see if they can read it? Thanks! Jack. - - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] intercept value in lme
As Andrew noted, you need to provide more information. But, what I see is that your model assumes X is continuous but you say it is bounded, -25 X 0 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of victor Sent: Wednesday, December 06, 2006 3:34 AM To: r-help@stat.math.ethz.ch Subject: [R] intercept value in lme Dear all, I've got a problem in fitting multilevel model in lme. I don't know to much about that but suspect that something is wrong with my model. I'm trying to fit: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z,~1|group,data=data,na.action=na.exclude,method=ML) where: X - dependent var. measured on a scale ranging from -25 to 0 Y - level 1 variable Z - level 1 variable In m1 the intercept value is equal -3, in m2 (that is after adding Lev 2 var.) is equal +16. What can be wrong with my variables? Is this possible that intercept value exceeds scale? Best regards, victor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] test of spatial dependence?? - ask an ecologist?
I never used it, but I beleave that it is a job for mantel.rtest() available on ade4 package. In fact Farrar are right, you will neet the XY coordinates. Give a look at Legendre Legendre text book. HTH, Miltinho Brazil David Farrar [EMAIL PROTECTED] escreveu: In addition to the 25 numbers, I assume you have coordinates of each field. Otherwise, I don't understand what you are trying to do. I think ecologists like to use a test due to Mantel in this situation. The prefix auto means self, of course, the idea being that measurements of the same variable under different conditions are correlated. I guess this would be a case of autodependence. For correlation versus dependence, check your intro stats book. de nada, X'X Farrar Xu Yuan wrote: hello R-friends, I am a R beginner and try to ask a basic question: How to test the spatial dependence of a column of data? for example, I have 25 agricultural fields, and I measure the average slope (%) or pH for each field. All I have is 25 numbers. PS, could someone confirm that spatial dependence is equivalent to spatial correlation or spatial autocorrelation or not. Thank you very much. XY [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Summary shows wrong maximum
'Unfortunately' you give no credentials for your ex cathedra pronouncement. E.g. http://en.wikipedia.org/wiki/Significant_digits says The situation regarding trailing zero digits that fall to the left of the decimal place in a number with no digits provided that fall to the right of the decimal place is less clear, but these are typically not considered significant unless the decimal point is placed at the end of the number to indicate otherwise (e.g., 2000. versus 2000). To make things more clear, trailing zeros are only recognized as significant figures if the number they are a part of has a decimal point. For example, 450 only has two sig figs, but 450. has three. which directly contradicts you. So this is at best a matter of opinion, and credentials do matter for opinions. On Tue, 5 Dec 2006, Oliver Czoske wrote: On Mon, 4 Dec 2006, Uwe Ligges wrote: Sebastian Spaeth wrote: Hi all, I have a list with a numerical column cum_hardreuses. By coincidence I discovered this: max(libs[,cum_hardreuses]) [1] 1793 summary(libs[,cum_hardreuses]) Min. 1st Qu. MedianMean 3rd Qu.Max. 1 2 4 36 141790 (note the max value of 1790) Ouch this is bad! Anything I can do to remedy this? Known bug? No, it's a feature! See ?summary: printing is done up to 3 significant digits by default. Unfortunately, '1790' is printed with *four* significant digits, not three. The correct representation with three significant digits would have to employ scientific notation, 1.79e3. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can anyone read a S-PLUS .dmp file for me?
On Wed, 6 Dec 2006, John McHenry wrote: Anyone? Yes, I can read it, but what use is that to you? Given that it is someone else's copyright work, I am not at liberty to redistribute a different version: hblm and associated programs Copyright 1995 by William DuMouchel. Permission is given for not-for-profit redistribution of the hblm programs so long as this About.hblm variable is included unmodified. Please report problems, failures and successes of this program to [EMAIL PROTECTED] The reason for the error is that it appears to contain invalid S data frames. (They are in invalid in R and in current S-PLUS, but they seems also to have been invalid in S3. Restoring dumps used to be one way to create invalid objects, but many of the loopholes have been plugged in R.) John McHenry [EMAIL PROTECTED] wrote:Hi WizaRds, I tried reading the S-PLUS file ftp://ftp.research.att.com/dist/bayes-meta/hblm.dmp into R using data.restore(hblm.dmp) but I got an error: Error in attributes(value) - thelist[-match(c(.Data, .Dim, .Dimnames, : row names must be 'character' or 'integer', not 'double' In addition: Warning message: NAs introduced by coercion Does anyone know how to read this type of S-PLUS file into R? I am not familiar with it. On http://cran.r-project.org/doc/manuals/R-data.html it is suggested that it is usually more reliable to dump the object(s) in S-PLUS and source the dumpfile in R See also, http://tolstoy.newcastle.edu.au/R/help/05/12/18209.html I don't know how this file was created. Could someone with S-PLUS access please see if they can read it? Thanks! Jack. - - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] publicar tutorial en CRAN (translation)
Let me try help with a poor traslation: Mario Wrote Hi everyone, I would like to know how can I publish a tutorial at CRAN. In fact I wrote a tutorial in espanish about SWEAVE and would like share it with our community. Who I need contact to do so? Mario Alfonso Morales Rivera [EMAIL PROTECTED] escreveu: Hola, a todos los usuarios de R. Me gustaría saber que pasos hay que seguir para que un manual o tutorial acerca de R escrito por un usuario quede disponible en CRAN. Escribí un tutorial de Sweave en español y quiero colocarlo a disposición de los usuarios de R pero no se cuales son los pasos a seguir, a quien hay que dirigirlo y que requisitos se requieren para eso. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - Música para ver e ouvir: You're Beautiful, do James Blunt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Summary shows wrong maximum
Brian Ripley wrote: 'Unfortunately' you give no credentials for your ex cathedra pronouncement. E.g. http://en.wikipedia.org/wiki/Significant_digits says The situation regarding trailing zero digits that fall to the left of the decimal place in a number with no digits provided that fall to the right of the decimal place is less clear, but these are typically not considered significant unless the decimal point is placed at the end of the number to indicate otherwise (e.g., 2000. versus 2000). To make things more clear, trailing zeros are only recognized as significant figures if the number they are a part of has a decimal point. For example, 450 only has two sig figs, but 450. has three. which directly contradicts you. So this is at best a matter of opinion, and credentials do matter for opinions. In the elementary statistics text ``Statistics for the Life Sciences'' (Samuels and Witmer, Prentice-Hall, 3rd ed.; fairly respectable credentials) there is an appendix on Significant Digits which says, amongst other things: ``How many significant digits are in the number 23000? When the number is expressed in this way --- in ordinary rather than scientific notation --- it is not really possible to tell how many significant digits it has.'' ``Scientific notation removes the ambiguity.'' Determining the significance of digits from the presence of a decimal point is perhaps a ``reasonable'' convention, but it is certainly not one that is widely practiced or understood. Relying on an obscure convention is fraught with risk. cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Usage of apply
Dear R Users, Are there any documents on the usage of apply, tapply, sapply so that I avoid explicit loops. I found that these three functions were quite hard to be understood. Thank you in advance. -- Jin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Usage of apply
Jin Shusong wrote: Dear R Users, Are there any documents on the usage of apply, tapply, sapply so that I avoid explicit loops. I found that these three functions were quite hard to be understood. Thank you in advance. If you have read the help pages for each and possibly even consulted the reference on those help pages, you may need to elaborate on what parts of these functions you don't understand. You might also describe a loop you are contemplating and ask how it might be replaced by one of these functions. Here is a very simple example of a loop that could be avoided with one of these functions: for(i in 1:4){print(mean(iris[,i]))} [1] 5.84 [1] 3.057333 [1] 3.758 [1] 1.199333 Here is how you would do that with apply(): apply(iris[,1:4], 2, mean) Sepal.Length Sepal.Width Petal.Length Petal.Width 5.84 3.057333 3.758000 1.199333 Even better in this particular case would be: colMeans(iris[,1:4]) Sepal.Length Sepal.Width Petal.Length Petal.Width 5.84 3.057333 3.758000 1.199333 but you don't always want mean() or sum() as the function, so the functions you mention above are more general than colMeans() and similar functions. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Usage of apply
Google for contributed documentation CRAN and in the first hit look through the several dozen tutorials there until you find one that describes the apply functions in a way meaningful to you. There is also some tutorial information on the relevant portion of this page: http://zoonek2.free.fr/UNIX/48_R/02.html On 12/6/06, Jin Shusong [EMAIL PROTECTED] wrote: Dear R Users, Are there any documents on the usage of apply, tapply, sapply so that I avoid explicit loops. I found that these three functions were quite hard to be understood. Thank you in advance. -- Jin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R functions in Delphi
R(D)COM available from CRAN (section Other) gives you R as a COM server. If Delphi can act as a COM client (which I think is true), you can access R directly from within your program without the need to write files. Anna Belova wrote: Hello All, We would like to call quantile() function from the R-package STATS in a Delphi program. If this is possible, could anyone provide us with an example? -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Trellis Plot Labels
- Original Message From: Deepayan Sarkar [EMAIL PROTECTED] To: Turgut Durduran [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Saturday, November 18, 2006 4:28:03 PM Subject: Re: Re: [R] Trellis Plot Labels On 11/17/06, Deepayan Sarkar [EMAIL PROTECTED] wrote: On 11/17/06, Turgut Durduran [EMAIL PROTECTED] wrote: On 11/17/06, Turgut Durduran [EMAIL PROTECTED] wrote: Hello everyone, I am ploting a groupeddata object with formula: formula(mydatausegroup) BF ~ HO | ID/Infar/Day Using this command: plot(na.omit(mydatausegroup), displayLevel=2,layout=c(10,2),aspect=2) This trellis plot does almost what I want and produces a 10x2 trellis plot, each panel is labeled as ID/Infar where infarct is either 1 or 0. And in each panel, it plots BF vs HO for each Day. However, the days are labeled simply as 1,2,3,4 instead of their actual values (ranging from 1 to 8). This just mapped for each ID the 1 st measurement, 2nd measurement, 3rd measurement, 4th measurement. This seems to be intended behaviour, and the responsible function is collapse.groupedData (which is not very transparent to me). How can I get this trellis plot to use 8 different colors and label them correct? I don't see a documented way, so you'll probably need to modify collapse.groupedData I should have added: it's of course fairly easy if you use xyplot directly. Thank you very much for your detailed help. However, in xyplot, I am ending up a whole bunch of empty panels corresponding to missing days. For example if I did: xyplot(CBF~OB|Day*Inf*ID,data=na.omit(mydatausegroup)) I must be misunderstanding the xyplot again. Turgut __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Questions about regression with time-series
I think the function 'arima' can handle this, except for the automatic evaluation of the ARMA orders. Giovanni Date: Wed, 06 Dec 2006 12:06:46 +0100 From: Lulla OPATOWSKI [EMAIL PROTECTED] Sender: [EMAIL PROTECTED] Precedence: list --===0156932283== Content-Disposition: inline Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Content-length: 954 Hi, I am using 2 times series and I want to carry out a regression of Seri1=20 by Serie2 using structured (autocorrelated) errors. (Equivalent to the autoreg function in SAS) I found the function gls (package nlme) and I made: gls_mens-gls(mening_s_des~dataATB, correlation =3D corAR1()) My problem is that I don=92t want a AR(1) structure but ARMA(n,p) but the= =20 execution fails : gls_mens-gls(mening_s_des~dataATB, correlation =3D corARMA(p=3D52)) Error in coef-.corARMA(`*tmp*`, value =3D c(11.2591629857661,=20 9.1821585359071, : Coefficient matrix not invertible This should be because most of the coefficients 52 are near to 0. I am looking for a way to be able : - To evaluate automatically my ARMA structure (if it exists) - To specify manually the not null lags for my ARMA structure (as a=20 vector for example) Does anyone know about such functions? Thank you for your help [[alternative text/enriched version deleted]] --===0156932283== Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. --===0156932283==-- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Comparing posterior and likelihood estimates for proportions (off topic)
You are not comparing estimates of the population proportion. Giovanni Date: Tue, 05 Dec 2006 17:08:27 -0500 From: Doran, Harold [EMAIL PROTECTED] Sender: [EMAIL PROTECTED] Precedence: list Thread-topic: Comparing posterior and likelihood estimates for proportions (off topic) Thread-index: AccYuQPSLwIrLya5T4ivem8lVU99aQ== This question is slightly off topic, but I'll use R to try and make it as relevant as possible. I'm working on a problem where I want to compare estimates from a posterior distribution with a uniform prior with those obtained from a frequentist approach. Under these conditions the estimates should agree. Specifically, I am asking the question, What is the probability that the true proportion of students passing a test is 50% when the observed proportion for that school is only 38%? For my example, there are 100 students in the school and 38 of them passed an exam. For conjugacy, if we choose a beta prior, then posterior in this case is also a beta distribution. Now, I believe the a and b parameters for a beta with a uniform prior is a=1 and b=1, or 1/(1+1) Here is my R code for the posterior with a flat prior n - 100 # Total number of individuals y - 38 # Number of successes a - 1 # Parameter 1 for Beta prior b - 1 # Parameter 2 for Beta prior theta - .38 # Proportion passing pbeta(.50, a + y, b+n-y, lower.tail=FALSE) [1] 0.008253 Now, the binomial distribution gives dbinom(50, 100, .38) [1] 0.0040984 Obviously, the results don't agree. So, I'm wondering if I have A) made a computational error B) have an error in my assumption that the results should agree in this case Thanks for any reactions Harold Windows XP version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Giovanni Petris [EMAIL PROTECTED] Associate Professor Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) http://definetti.uark.edu/~gpetris/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] test of spatial dependence?? - ask an ecologist?
match-making is such fun. Farrar Milton Cezar Ribeiro [EMAIL PROTECTED] wrote: I never used it, but I beleave that it is a job for mantel.rtest() available on ade4 package. In fact Farrar are right, you will neet the XY coordinates. Give a look at Legendre Legendre text book. HTH, Miltinho Brazil David Farrar [EMAIL PROTECTED] escreveu: In addition to the 25 numbers, I assume you have coordinates of each field. Otherwise, I don't understand what you are trying to do. I think ecologists like to use a test due to Mantel in this situation. The prefix auto means self, of course, the idea being that measurements of the same variable under different conditions are correlated. I guess this would be a case of autodependence. For correlation versus dependence, check your intro stats book. de nada, X'X Farrar Xu Yuan wrote: hello R-friends, I am a R beginner and try to ask a basic question: How to test the spatial dependence of a column of data? for example, I have 25 agricultural fields, and I measure the average slope (%) or pH for each field. All I have is 25 numbers. PS, could someone confirm that spatial dependence is equivalent to spatial correlation or spatial autocorrelation or not. Thank you very much. XY [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - O Yahoo! está de cara nova. Venha conferir! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R functions in Delphi
Thanks for the great example, Tom. Tom Backer Johnsen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Anna Belova wrote: We would like to call quantile() function from the R-package STATS in a Delphi program. If this is possible, could anyone provide us with an example? It is possible, and in principle simple. The essentials: (1) Write a file containing the something like a script in R with whatever commands. (2) Start a process involving the execution of R with a command line containing two arguments, the name of the command file and the file where you want the output (results) to be. (3) wait for the process to stop. So, here is a function (returns true if everyhing worked OK) that does that: . . . CreateOK := CreateProcess(Nil, PChar('R.exe ' + CommandLine), nil, nil,False, CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS, nil, nil, StartInfo, proc_info); I had to give the full path to the R executable to get this to work: CreateOK := CreateProcess(Nil, PChar('C:\Program Files\R\R-2.4.0\bin\R.exe ' + CommandLine), nil, nil,False, CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS, nil, nil, StartInfo, proc_info); I used Delphi 7 to test StartRAndWait with this button press event: procedure TForm1.Button1Click(Sender: TObject); VAR Command: STRING; begin Screen.Cursor := crHourGlass; TRY Command := 'CMD BATCH Sample.R SampleOutput.txt'; StartRAndWait(Command); FINALLY Screen.Cursor := crDefault END end; Sample.R file = sink('quantile.txt') quantile(0:100) sink() = I used sink in the R script to isolate the output of the R quantile command to help any parsing of the output: SampleOutput.txt = R version 2.4.0 (2006-10-03) Copyright (C) 2006 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. sink('quantile.txt') quantile(0:100) sink() = quantile.txt = 0% 25% 50% 75% 100% 0 25 50 75 100 = Tinn-R is written in Delphi, so its source code should be a great example of a Delphi/R interface. I've never studied the source code -- that's been on my to do list for months --, but I'm guessing it uses RCOm, like Hans-Peter suggested. Nevertheless, Tom's example above may also be quite useful. efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] intercept value in lme
It is boundend, you're right. In fact it is -25=X=0 These are cross-national survey data (I was investigated 7 countries in each country there was 900-1700 cases). In fact, there was two level 2 variables, so: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z1+Z2,~1|group,data=data,na.action=na.exclude,method=ML) X is a life satisfaction factor combined from 2 other variables for each case separately, of course. Y - income per capita in household Z1 - unemployment rate in a country. Z2 - life expectancy in a country group - country I attach a similar model where after adding Lev2 predictors intercept value is even 22! I'm sure there is my mistake somwhere but... what is wrong? Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31140.77 31167.54 -15566.39 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.8698037 3.300206 Fixed effects: X ~ Y Value Std.Error DFt-value p-value (Intercept) -4.397051 0.3345368 5944 -13.143698 0 Y -0.000438 0.521 5944 -8.399448 0 Correlation: (Intr) Y -0.13 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.3855881 -0.5223116 0.2948941 0.6250717 2.6020180 Number of Observations: 5952 Number of Groups: 7 and for the second model: Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31133.08 31173.23 -15560.54 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.3631184 3.300201 Fixed effects: X ~ Y + Z1 + Z2 Value Std.Error DF t-value p-value (Intercept) 22.188828 4.912214 5944 4.517073 0. Y -0.000440 0.52 5944 -8.456196 0. Z1 -0.095532 0.0375204 -2.546161 0.0636 Z2 -0.333549 0.0620314 -5.377127 0.0058 Correlation: (Intr) FAMPEC UNEMP Y0.168 Z1 -0.429 0.080 Z2 -0.997 -0.188 0.366 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.377 -0.5291287 0.2963226 0.6260023 2.6226880 Number of Observations: 5952 Number of Groups: 7 Doran, Harold wrote: As Andrew noted, you need to provide more information. But, what I see is that your model assumes X is continuous but you say it is bounded, -25 X 0 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of victor Sent: Wednesday, December 06, 2006 3:34 AM To: r-help@stat.math.ethz.ch Subject: [R] intercept value in lme Dear all, I've got a problem in fitting multilevel model in lme. I don't know to much about that but suspect that something is wrong with my model. I'm trying to fit: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z,~1|group,data=data,na.action=na.exclude,method=ML) where: X - dependent var. measured on a scale ranging from -25 to 0 Y - level 1 variable Z - level 1 variable In m1 the intercept value is equal -3, in m2 (that is after adding Lev 2 var.) is equal +16. What can be wrong with my variables? Is this possible that intercept value exceeds scale? Best regards, victor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Summary shows wrong maximum
Folks: Is So this is at best a matter of opinion, and credentials do matter for opinions. -- Brian Ripley an R fortunes candidate? -- Bert Gunter On Tue, 5 Dec 2006, Oliver Czoske wrote: On Mon, 4 Dec 2006, Uwe Ligges wrote: Sebastian Spaeth wrote: Hi all, I have a list with a numerical column cum_hardreuses. By coincidence I discovered this: max(libs[,cum_hardreuses]) [1] 1793 summary(libs[,cum_hardreuses]) Min. 1st Qu. MedianMean 3rd Qu.Max. 1 2 4 36 141790 (note the max value of 1790) Ouch this is bad! Anything I can do to remedy this? Known bug? No, it's a feature! See ?summary: printing is done up to 3 significant digits by default. Unfortunately, '1790' is printed with *four* significant digits, not three. The correct representation with three significant digits would have to employ scientific notation, 1.79e3. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R-Help
Respected Sir I am a very new user of R. I want to ask a question about the nortest package. In this package how we can write the code of ad.test, cvm.test, ks.test for other distributions like GEV, GPA etc. I request you to please guide to me. Kind Regards AMNA -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Trellis Plot Labels
On 12/6/06, Turgut Durduran [EMAIL PROTECTED] wrote: - Original Message From: Deepayan Sarkar [EMAIL PROTECTED] To: Turgut Durduran [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Saturday, November 18, 2006 4:28:03 PM Subject: Re: Re: [R] Trellis Plot Labels On 11/17/06, Deepayan Sarkar [EMAIL PROTECTED] wrote: On 11/17/06, Turgut Durduran [EMAIL PROTECTED] wrote: On 11/17/06, Turgut Durduran [EMAIL PROTECTED] wrote: Hello everyone, I am ploting a groupeddata object with formula: formula(mydatausegroup) BF ~ HO | ID/Infar/Day Using this command: plot(na.omit(mydatausegroup), displayLevel=2,layout=c(10,2),aspect=2) This trellis plot does almost what I want and produces a 10x2 trellis plot, each panel is labeled as ID/Infar where infarct is either 1 or 0. And in each panel, it plots BF vs HO for each Day. However, the days are labeled simply as 1,2,3,4 instead of their actual values (ranging from 1 to 8). This just mapped for each ID the 1 st measurement, 2nd measurement, 3rd measurement, 4th measurement. This seems to be intended behaviour, and the responsible function is collapse.groupedData (which is not very transparent to me). How can I get this trellis plot to use 8 different colors and label them correct? I don't see a documented way, so you'll probably need to modify collapse.groupedData I should have added: it's of course fairly easy if you use xyplot directly. Thank you very much for your detailed help. However, in xyplot, I am ending up a whole bunch of empty panels corresponding to missing days. For example if I did: xyplot(CBF~OB|Day*Inf*ID,data=na.omit(mydatausegroup)) In this case, the plot will have one panel for every combination of non-empty levels of Day, Inf and ID (not every non-empty combination of levels). In your case, if you have a nested structure where the levels of Inf and ID don't mean anything individually. You should be using an interaction, e.g. xyplot(CBF~OB|Day:Inf:ID,data=na.omit(mydatausegroup)) To xyplot, the difference is that there is now one conditioning variable rather than 3, and it will omit any empty levels. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Usage of apply
But do note -- again! -- that the apply family of functions do their magic **internally through looping**, so that they are generally not much faster -- and sometimes a bit slower -- then explicit loops. Their chief advantage (IMO, of course) is in code clarity and correctness, which is why I prefer them. (They are also written to do their looping as efficiently as possible, which explicit looping in user code may not.) Of course, vectorized calculations (colMeans() in the example below) **are** much faster and usually clearer than explicit loops. Bert Gunter Genentech Nonclinical Statistics South San Francisco, CA 94404 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chuck Cleland Sent: Wednesday, December 06, 2006 6:54 AM To: R Help Subject: Re: [R] Usage of apply Jin Shusong wrote: Dear R Users, Are there any documents on the usage of apply, tapply, sapply so that I avoid explicit loops. I found that these three functions were quite hard to be understood. Thank you in advance. If you have read the help pages for each and possibly even consulted the reference on those help pages, you may need to elaborate on what parts of these functions you don't understand. You might also describe a loop you are contemplating and ask how it might be replaced by one of these functions. Here is a very simple example of a loop that could be avoided with one of these functions: for(i in 1:4){print(mean(iris[,i]))} [1] 5.84 [1] 3.057333 [1] 3.758 [1] 1.199333 Here is how you would do that with apply(): apply(iris[,1:4], 2, mean) Sepal.Length Sepal.Width Petal.Length Petal.Width 5.84 3.057333 3.758000 1.199333 Even better in this particular case would be: colMeans(iris[,1:4]) Sepal.Length Sepal.Width Petal.Length Petal.Width 5.84 3.057333 3.758000 1.199333 but you don't always want mean() or sum() as the function, so the functions you mention above are more general than colMeans() and similar functions. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] intercept value in lme
victor wrote: It is boundend, you're right. In fact it is -25=X=0 These are cross-national survey data (I was investigated 7 countries in each country there was 900-1700 cases). In fact, there was two level 2 variables, so: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z1+Z2,~1|group,data=data,na.action=na.exclude,method=ML) X is a life satisfaction factor combined from 2 other variables for each case separately, of course. Y - income per capita in household Z1 - unemployment rate in a country. Z2 - life expectancy in a country group - country Victor: What happens if you center Y, Z1, and Z2 so that 0 corresponds to the mean for each? As it is, zero is a very unusual value for each of these variables. Do you really want to estimate the value of X when income = 0, unemployment = 0, and life expectancy = 0? If I understand correctly, I think that's why the intercept value looks unusual to you. I attach a similar model where after adding Lev2 predictors intercept value is even 22! I'm sure there is my mistake somwhere but... what is wrong? Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31140.77 31167.54 -15566.39 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.8698037 3.300206 Fixed effects: X ~ Y Value Std.Error DFt-value p-value (Intercept) -4.397051 0.3345368 5944 -13.143698 0 Y -0.000438 0.521 5944 -8.399448 0 Correlation: (Intr) Y -0.13 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.3855881 -0.5223116 0.2948941 0.6250717 2.6020180 Number of Observations: 5952 Number of Groups: 7 and for the second model: Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31133.08 31173.23 -15560.54 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.3631184 3.300201 Fixed effects: X ~ Y + Z1 + Z2 Value Std.Error DF t-value p-value (Intercept) 22.188828 4.912214 5944 4.517073 0. Y -0.000440 0.52 5944 -8.456196 0. Z1 -0.095532 0.0375204 -2.546161 0.0636 Z2 -0.333549 0.0620314 -5.377127 0.0058 Correlation: (Intr) FAMPEC UNEMP Y0.168 Z1 -0.429 0.080 Z2 -0.997 -0.188 0.366 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.377 -0.5291287 0.2963226 0.6260023 2.6226880 Number of Observations: 5952 Number of Groups: 7 Doran, Harold wrote: As Andrew noted, you need to provide more information. But, what I see is that your model assumes X is continuous but you say it is bounded, -25 X 0 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of victor Sent: Wednesday, December 06, 2006 3:34 AM To: r-help@stat.math.ethz.ch Subject: [R] intercept value in lme Dear all, I've got a problem in fitting multilevel model in lme. I don't know to much about that but suspect that something is wrong with my model. I'm trying to fit: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z,~1|group,data=data,na.action=na.exclude,method=ML) where: X - dependent var. measured on a scale ranging from -25 to 0 Y - level 1 variable Z - level 1 variable In m1 the intercept value is equal -3, in m2 (that is after adding Lev 2 var.) is equal +16. What can be wrong with my variables? Is this possible that intercept value exceeds scale? Best regards, victor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] mFilter package
Dear useRs, Please find the new package mFilter version 0.1-2 on CRAN. The package implements several time series filters useful for smoothing and extracting trend and cyclical components of a time series. The routines are commonly used in economics and finance, however they should also be interest to other areas. Currently, Christiano-Fitzgerald, Baxter-King, Hodrick-Prescott, Butterworth, and trigonometric regression filters are included in the package. Cheers, -- Mehmet Balcilar, PhD Associate Professor of Econometrics Cukurova University College of Economics Administrative Sciences Department of Econometrics Balcali, Adana 01330 Turkey Tel: +90 (322) 338-7255 (6 lines) Ext. 170 Mobile: +90 532 396-0145 Fax: +90 (322) 338-7283 +90 (322) 338-7284 e-mail: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Homepage: http://www.mbalcilar.net ___ R-packages mailing list R-packages@stat.math.ethz.ch 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 and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] classifly 0.2.2
The classifly package uses rggobi to visualise classification boundaries in high-dimensions. Given p-dimensional training data containing d groups (the design space), a classification algorithm (classifier) predicts which group new data belongs to. Generally the input to these algorithms is high dimensional, and the boundaries between groups will be high dimensional and perhaps curvilinear or multi-facted. This R package provides methods for visualising the division of space between the groups. More information and a paper describing the ideas can be found at http://had.co.nz/classifly/. Regards, Hadley ___ R-packages mailing list R-packages@stat.math.ethz.ch 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 and provide commented, minimal, self-contained, reproducible code.
[R] POSIX and summer savings time
I have a time stamp in UTC (GMT) time: format(ISOdatetime(1970,1,1,0,0,0)+1165398135729/1000,%Y-%m-%d %H:%M:%OS3) 2006-12-06 09:42:18.823 (note millisecond accuracy, but not relevant to question here) Now, this time stamp actually happened at local (Swedish) time one hour later (10:42). Regarding summer/winter adjustments in time (spring forward, fall back): Is there a way of automatically recovering the local time adjustments for a given date? E.g., a date/time in springtime = GMT +2 , else GMT +1 Thanks, Derek Eder -- Derek N. Eder Gothenburg University VINKLA - Vigilance and Neurocognition laboratory SU/Sahlgrenska Utvecklingslab 1, Med Gröna stråket 8 SE 413 45 Göteborg (Gothenburg) Sverige (Sweden) +46 (031)* 342 8261 (28261 inom Sahlgrenska) +46 0704 915 714 (mobile) +46 (031) 25 97 07 (home) * omit the 0 when calling from outside Sweden __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R-Help
You might want to contact the nortest maintainer, Juergen Gross (CCing), who is not listening to the traffic on this list. Uwe Ligges amna khan wrote: Respected Sir I am a very new user of R. I want to ask a question about the nortest package. In this package how we can write the code of ad.test, cvm.test, ks.test for other distributions like GEV, GPA etc. I request you to please guide to me. Kind Regards AMNA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] test of spatial dependence?? - ask an ecologist?
Thanks David and Milton for replies. No, I don't have the coordiates. In other words, my data are not point data. But I think there is a way to test of spatial dependence for areal data or lattice data. In this case, the variable of interest is typically the average value of an area instead of a point. Do you how to do this? Thank you. Xu On 12/6/06, Milton Cezar Ribeiro [EMAIL PROTECTED] wrote: I never used it, but I beleave that it is a job for mantel.rtest() available on ade4 package. In fact Farrar are right, you will neet the XY coordinates. Give a look at Legendre Legendre text book. HTH, Miltinho Brazil David Farrar [EMAIL PROTECTED] escreveu: In addition to the 25 numbers, I assume you have coordinates of each field. Otherwise, I don't understand what you are trying to do. I think ecologists like to use a test due to Mantel in this situation. The prefix auto means self, of course, the idea being that measurements of the same variable under different conditions are correlated. I guess this would be a case of autodependence. For correlation versus dependence, check your intro stats book. de nada, X'X Farrar Xu Yuan wrote: hello R-friends, I am a R beginner and try to ask a basic question: How to test the spatial dependence of a column of data? for example, I have 25 agricultural fields, and I measure the average slope (%) or pH for each field. All I have is 25 numbers. PS, could someone confirm that spatial dependence is equivalent to spatial correlation or spatial autocorrelation or not. Thank you very much. XY [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. O Yahoo! está de cara nova. Venha conferir! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] intercept value in lme
Dear Victor: Firstly, why do you think something is wrong? Ignoring the fact that your DV is not continuous for a moment and your distributional assumptions assume it is, could it not be the case that conditional on your covariates the changes in the intercept are correct? I might be missing something, but to me it seems that you are concluding that something is wrong because of the vast changes in the intercept. As far as I can see in this thread so far we still do not know anything about the covariates that could help diagnose the issue. Syntactically, your lme model is correct (although you should switch to lmer which is more supported), but you might consider a transformation of you DV (e.g., log) to better coincide with your distributional assumptions. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of victor Sent: Wednesday, December 06, 2006 12:07 PM To: Doran, Harold Cc: r-help@stat.math.ethz.ch Subject: Re: [R] intercept value in lme It is boundend, you're right. In fact it is -25=X=0 These are cross-national survey data (I was investigated 7 countries in each country there was 900-1700 cases). In fact, there was two level 2 variables, so: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z1+Z2,~1|group,data=data,na.action=na.exclude,method=ML) X is a life satisfaction factor combined from 2 other variables for each case separately, of course. Y - income per capita in household Z1 - unemployment rate in a country. Z2 - life expectancy in a country group - country I attach a similar model where after adding Lev2 predictors intercept value is even 22! I'm sure there is my mistake somwhere but... what is wrong? Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31140.77 31167.54 -15566.39 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.8698037 3.300206 Fixed effects: X ~ Y Value Std.Error DFt-value p-value (Intercept) -4.397051 0.3345368 5944 -13.143698 0 Y -0.000438 0.521 5944 -8.399448 0 Correlation: (Intr) Y -0.13 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.3855881 -0.5223116 0.2948941 0.6250717 2.6020180 Number of Observations: 5952 Number of Groups: 7 and for the second model: Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31133.08 31173.23 -15560.54 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.3631184 3.300201 Fixed effects: X ~ Y + Z1 + Z2 Value Std.Error DF t-value p-value (Intercept) 22.188828 4.912214 5944 4.517073 0. Y -0.000440 0.52 5944 -8.456196 0. Z1 -0.095532 0.0375204 -2.546161 0.0636 Z2 -0.333549 0.0620314 -5.377127 0.0058 Correlation: (Intr) FAMPEC UNEMP Y0.168 Z1 -0.429 0.080 Z2 -0.997 -0.188 0.366 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.377 -0.5291287 0.2963226 0.6260023 2.6226880 Number of Observations: 5952 Number of Groups: 7 Doran, Harold wrote: As Andrew noted, you need to provide more information. But, what I see is that your model assumes X is continuous but you say it is bounded, -25 X 0 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of victor Sent: Wednesday, December 06, 2006 3:34 AM To: r-help@stat.math.ethz.ch Subject: [R] intercept value in lme Dear all, I've got a problem in fitting multilevel model in lme. I don't know to much about that but suspect that something is wrong with my model. I'm trying to fit: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z,~1|group,data=data,na.action=na.exclude,method=ML) where: X - dependent var. measured on a scale ranging from -25 to 0 Y - level 1 variable Z - level 1 variable In m1 the intercept value is equal -3, in m2 (that is after adding Lev 2 var.) is equal +16. What can be wrong with my variables? Is this possible that intercept value exceeds scale? Best regards, victor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] intercept value in lme
Hello Victor, I'm afraid that this still isn't what we're looking for, in terms of reproducible code, but we can guess. What is the range of the Z1 and Z2 variables? What is the range of the model predictions? If the Z1 and Z2 variables are large and positive then they will be compensating. Cheers Andrew On Wed, Dec 06, 2006 at 06:06:55PM +0100, victor wrote: It is boundend, you're right. In fact it is -25=X=0 These are cross-national survey data (I was investigated 7 countries in each country there was 900-1700 cases). In fact, there was two level 2 variables, so: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z1+Z2,~1|group,data=data,na.action=na.exclude,method=ML) X is a life satisfaction factor combined from 2 other variables for each case separately, of course. Y - income per capita in household Z1 - unemployment rate in a country. Z2 - life expectancy in a country group - country I attach a similar model where after adding Lev2 predictors intercept value is even 22! I'm sure there is my mistake somwhere but... what is wrong? Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31140.77 31167.54 -15566.39 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.8698037 3.300206 Fixed effects: X ~ Y Value Std.Error DFt-value p-value (Intercept) -4.397051 0.3345368 5944 -13.143698 0 Y -0.000438 0.521 5944 -8.399448 0 Correlation: (Intr) Y -0.13 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.3855881 -0.5223116 0.2948941 0.6250717 2.6020180 Number of Observations: 5952 Number of Groups: 7 and for the second model: Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31133.08 31173.23 -15560.54 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.3631184 3.300201 Fixed effects: X ~ Y + Z1 + Z2 Value Std.Error DF t-value p-value (Intercept) 22.188828 4.912214 5944 4.517073 0. Y -0.000440 0.52 5944 -8.456196 0. Z1 -0.095532 0.0375204 -2.546161 0.0636 Z2 -0.333549 0.0620314 -5.377127 0.0058 Correlation: (Intr) FAMPEC UNEMP Y0.168 Z1 -0.429 0.080 Z2 -0.997 -0.188 0.366 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.377 -0.5291287 0.2963226 0.6260023 2.6226880 Number of Observations: 5952 Number of Groups: 7 Doran, Harold wrote: As Andrew noted, you need to provide more information. But, what I see is that your model assumes X is continuous but you say it is bounded, -25 X 0 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of victor Sent: Wednesday, December 06, 2006 3:34 AM To: r-help@stat.math.ethz.ch Subject: [R] intercept value in lme Dear all, I've got a problem in fitting multilevel model in lme. I don't know to much about that but suspect that something is wrong with my model. I'm trying to fit: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z,~1|group,data=data,na.action=na.exclude,method=ML) where: X - dependent var. measured on a scale ranging from -25 to 0 Y - level 1 variable Z - level 1 variable In m1 the intercept value is equal -3, in m2 (that is after adding Lev 2 var.) is equal +16. What can be wrong with my variables? Is this possible that intercept value exceeds scale? Best regards, victor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] test of spatial dependence?? - ask an ecologist?
On Wed, 6 Dec 2006, Xu Yuan wrote: Thanks David and Milton for replies. No, I don't have the coordiates. In other words, my data are not point data. But I think there is a way to test of spatial dependence for areal data or lattice data. In this case, the variable of interest is typically the average value of an area instead of a point. Do you how to do this? But do you know where the areas are in relation to each other? Does the spatialCovariance package help? Roger Thank you. Xu On 12/6/06, Milton Cezar Ribeiro [EMAIL PROTECTED] wrote: I never used it, but I beleave that it is a job for mantel.rtest() available on ade4 package. In fact Farrar are right, you will neet the XY coordinates. Give a look at Legendre Legendre text book. HTH, Miltinho Brazil David Farrar [EMAIL PROTECTED] escreveu: In addition to the 25 numbers, I assume you have coordinates of each field. Otherwise, I don't understand what you are trying to do. I think ecologists like to use a test due to Mantel in this situation. The prefix auto means self, of course, the idea being that measurements of the same variable under different conditions are correlated. I guess this would be a case of autodependence. For correlation versus dependence, check your intro stats book. de nada, X'X Farrar Xu Yuan wrote: hello R-friends, I am a R beginner and try to ask a basic question: How to test the spatial dependence of a column of data? for example, I have 25 agricultural fields, and I measure the average slope (%) or pH for each field. All I have is 25 numbers. PS, could someone confirm that spatial dependence is equivalent to spatial correlation or spatial autocorrelation or not. Thank you very much. XY [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. O Yahoo! está de cara nova. Venha conferir! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Summary shows wrong maximum
Mike: I offered no opinion -- and really didn't have any -- about the worthiness of any of the comments that were made. I just liked Brian's little quotable aside. But since you bait me a bit ... In general, I believe that showing th 2-3 most important -- **not significant** -- digits **and no more** is desirable. By most important I mean the leftmost digits which are changing in the data (there are some caveats in the presence of extreme outliers). Printing more digits merely obfuscates the ability of the eye/brain to perceive the patterns of change in the data, the presumed intent of displaying it (not of storing it, of course). Displaying excessive digits to demonstrate (usually falsely) one's precision is evil. Clarity of communications is the standard we should aspire to. These views have been more eloquently expressed by A.S.C Ehrenburg and Howard Wainer among others... -- Bert Bert Gunter Nonclinical Statistics 7-7374 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Prager Sent: Wednesday, December 06, 2006 11:46 AM To: r-help@stat.math.ethz.ch Subject: Re: [R] Summary shows wrong maximum I don't know about candidacy, and I'm not going to argue about correctness, but it seems to me that the only valid reasons to limit precision of printing in a statistics program are (1) to save space and (2) to allow for machine limitations. This is neither. To chop off information and replace it with zeroes is just plain nasty. Bert Gunter [EMAIL PROTECTED] wrote: Folks: Is So this is at best a matter of opinion, and credentials do matter for opinions. -- Brian Ripley an R fortunes candidate? -- Bert Gunter On Tue, 5 Dec 2006, Oliver Czoske wrote: On Mon, 4 Dec 2006, Uwe Ligges wrote: Sebastian Spaeth wrote: Hi all, I have a list with a numerical column cum_hardreuses. By coincidence I discovered this: max(libs[,cum_hardreuses]) [1] 1793 summary(libs[,cum_hardreuses]) Min. 1st Qu. MedianMean 3rd Qu.Max. 1 2 4 36 141790 (note the max value of 1790) Ouch this is bad! Anything I can do to remedy this? Known bug? No, it's a feature! See ?summary: printing is done up to 3 significant digits by default. Unfortunately, '1790' is printed with *four* significant digits, not three. The correct representation with three significant digits would have to employ scientific notation, 1.79e3. -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Standar errors arma models
Why the standadard errors of the coefficientes of the arma models fited by using the arima procedure in the stats package doesnt coincide with that of S+, minitab or SAS? -- Este mensaje ha sido analizado por MailScanner en busca de virus y otros contenidos peligrosos, y se considera que está limpio. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Canonical method for S engine selection?
Assuming script 'common.q' contains code that needed different processing depending on interpreter (either S-PLUS or R), what should the condition be? if (condition) { # Do S-PLUS code } else { # Do R code } Looking for something akin to the C preprocessor directive USING_R, but for S. -- SIGSIG -- signature too long (core dumped) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] require(simecol) error
Hi there, I´m trying to use simecol package but I got the error showed below. I´m runnig R version 2.4.0 (2006-10-03). Kind regards, miltinho Brazil --- require(simecol) Loading required package: simecol Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : in 'simecol' methods specified for export, but none defined: fixInit, fixParms, fixTimes, plot, print, solver, solver-, out, inputs, inputs-, main, main-, equations, equations-, sim, parms, parms-, init, init-, times, times- [1] FALSE - __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Canonical method for S engine selection?
On 12/6/2006 5:02 PM, Paul Roebuck wrote: Assuming script 'common.q' contains code that needed different processing depending on interpreter (either S-PLUS or R), what should the condition be? if (condition) { # Do S-PLUS code } else { # Do R code } Looking for something akin to the C preprocessor directive USING_R, but for S. See ?is.R. This function is defined in both R and current versions of S-PLUS; there are instructions for how to put together a test that works in older S-PLUS versions too. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] require(simecol) error
The output of sessionInfo() will be helpful here. But I can't reproduce that on R 2.4.0 Patched r40106 + simecol (0.3-11). Maybe you should upgrade the package? b On Dec 6, 2006, at 5:06 PM, Milton Cezar Ribeiro wrote: Hi there, I´m trying to use simecol package but I got the error showed below. I´m runnig R version 2.4.0 (2006-10-03). Kind regards, miltinho Brazil --- require(simecol) Loading required package: simecol Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : in 'simecol' methods specified for export, but none defined: fixInit, fixParms, fixTimes, plot, print, solver, solver-, out, inputs, inputs-, main, main-, equations, equations-, sim, parms, parms-, init, init-, times, times- [1] FALSE - __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Canonical method for S engine selection?
On Wed, 6 Dec 2006, Paul Roebuck wrote: Assuming script 'common.q' contains code that needed different processing depending on interpreter (either S-PLUS or R), what should the condition be? I believe exists(is.R) is.R() is a reliable condition. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R functions in Delphi
Earl F. Glynn wrote: Thanks for the great example, Tom. Tom Backer Johnsen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Anna Belova wrote: We would like to call quantile() function from the R-package STATS in a Delphi program. If this is possible, could anyone provide us with an example? It is possible, and in principle simple. The essentials: (1) Write a file containing the something like a script in R with whatever commands. (2) Start a process involving the execution of R with a command line containing two arguments, the name of the command file and the file where you want the output (results) to be. (3) wait for the process to stop. So, here is a function (returns true if everyhing worked OK) that does that: . . . CreateOK := CreateProcess(Nil, PChar('R.exe ' + CommandLine), nil, nil,False, CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS, nil, nil, StartInfo, proc_info); I had to give the full path to the R executable to get this to work: CreateOK := CreateProcess(Nil, PChar('C:\Program Files\R\R-2.4.0\bin\R.exe ' + CommandLine), nil, nil,False, CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS, nil, nil, StartInfo, proc_info); That (I think) would depend on whether the directory to the R.exe is in the path for the Windows system you use (which I seem to remember I added in my environment). In any case, I was looking for some kind of an interface to R late last spring, and this was what I arrived at. Which worked. I used Delphi 7 to test StartRAndWait with this button press event: procedure TForm1.Button1Click(Sender: TObject); VAR Command: STRING; begin Screen.Cursor := crHourGlass; TRY Command := 'CMD BATCH Sample.R SampleOutput.txt'; StartRAndWait(Command); FINALLY Screen.Cursor := crDefault END end; Looks sensible to me. Sample.R file = sink('quantile.txt') quantile(0:100) sink() = I used sink in the R script to isolate the output of the R quantile command to help any parsing of the output: SampleOutput.txt = R version 2.4.0 (2006-10-03) Copyright (C) 2006 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. sink('quantile.txt') quantile(0:100) sink() = quantile.txt = 0% 25% 50% 75% 100% 0 25 50 75 100 = Tinn-R is written in Delphi, so its source code should be a great example of a Delphi/R interface. I've never studied the source code -- that's been on my to do list for months --, but I'm guessing it uses RCOm, like Hans-Peter suggested. Nevertheless, Tom's example above may also be quite useful. That is a good suggestion. I'll have to have a look at that. Thank you! Tom efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Adding terms to a function
Hi all, I am running R version 2.4.0 on Windows XP. I am new and have the following question: I have a dataset of columns named x1, x2, x3...xn. I would like to write a linear regression using lm that looks like this: lm(y~x1+x2+x3+...+xn) If I try to use the following code, I only get the model for y~x1+xn: n-ncol(dataset) model-lm(y~x1) for(i in 1:n) { model.new-update(model, .~.+dataset[,i]) } The purpose of this is so I can use stepAIC with model.new as the upper scope and model as the lower. I know there must be a simple way to do this, but I am not yet familiar with much syntax. Any help appreciated! -- Brooke LaFlamme Cornell 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Adding terms to a function
How about this: form - formula(paste(y ~, paste(x, 1:n, sep=, collapse= + ))) model - lm(form) HTH, Simon. Brooke LaFlamme wrote: Hi all, I am running R version 2.4.0 on Windows XP. I am new and have the following question: I have a dataset of columns named x1, x2, x3...xn. I would like to write a linear regression using lm that looks like this: lm(y~x1+x2+x3+...+xn) If I try to use the following code, I only get the model for y~x1+xn: n-ncol(dataset) model-lm(y~x1) for(i in 1:n) { model.new-update(model, .~.+dataset[,i]) } The purpose of this is so I can use stepAIC with model.new as the upper scope and model as the lower. I know there must be a simple way to do this, but I am not yet familiar with much syntax. Any help appreciated! -- Brooke LaFlamme Cornell 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 and provide commented, minimal, self-contained, reproducible code. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] AIC for heckit
Thanks for the hint, Jay! But somehow it seems like the included $probit object is not of class glm and I couldn't find an AIC property on it. I tried it your way. Any other suggestions regarding how I can evaluate the fit of the first-step selection model included in heckit()? Best, Werner From: Jay Emerson [EMAIL PROTECTED] Subject: Re: [R] AIC for heckit To: r-help@stat.math.ethz.ch Message-ID: [EMAIL PROTECTED] Content-Type: text/plain I have used the heckit function in micEcon. ... How can I then get the AIC for this model? It appears that the heckit $probit object is of class 'glm' and so, for example: main.result - heckit(whateveryouaredoing)# Do your heckit()... probit.result - main.result$probit # The glm object produced by heckit() probit.aic - probit.result$aic # The AIC, see ?glm should have what you need, ready to go. I used these tedious names and three lines of code just to be clear about what is what (I wouldn't really do it this way). !) Jay -- John W. Emerson (Jay) Assistant Professor of Statistics Director of Graduate Studies Department of Statistics Yale University http://www.stat.yale.edu/~jay __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Simulation in R
Hello! I have the following problem. My code: --snip-- ergebnisse - rep(0, each=2) stichproben - rep(0, each=2) for (i in seq(1:2)) { n - dim(daten)[1] ix - sample(n,200) # producing samples samp_i - daten[ix,] stichproben[i] - samp_i # doesn’t works # Calculation of the model: posterior_i - MCMClogit(y ~ fbl.ind + fekq3 + febitda4 + fuvs + fkru + fzd + fur3, data=samp_i, b0=prior, B0=precision, tune=0.5) # calculation ergebnisse[i] - summary(posterior_i) # saving the results (works) } --snip-- I have a data set called daten. I produce samples of the size 200. The samples are saved in samp_i. Question: How is the easiest way to save this samples. My code doesn't work, only the first column of the sample samp_i is in stichproben[i]. I understand why. My idea is to define a array stichproben and then save a matrix in the particular fields of the array. But things like y - matrix(c(samp_1),nrow=200, ncol=8) and then saving y in the array stichproben doesn't work. How is it possible to define a matrix with the content of my samples (samp_i) and but them into an array stichproben? Or is there an easier way? With kind regards Alex -- Alexander Geisler * Kaltenbach 151 * A-6272 Kaltenbach email: [EMAIL PROTECTED] | [EMAIL PROTECTED] phone: +43 650 / 811 61 90 | skpye: al1405ex __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] barplot - how to force vertical axis to cover entire plot area
I'm using barplot with the following call: barplot(stat_data[[5]][,],axes=TRUE,axisnames=TRUE,axis.lty=1,xlab=xlab,ylab=ylab,beside=TRUE,las=1,font.lab=2,font.axis=1,legend.text=TRUE) On some data, the vertical axis does not cover the whole plot area and the last tick mark is smaller than the maximum value. I tried setting the ylim values but even with that, some plots are still not OK, it just shrinks the length of the bars. Attached is a png example of the problem. I hope it gets through. Thanks, Etienne __ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Adding terms to a function
Using the builtin anscombe data set try this where we note that the first 4 columns are x1, ..., x4 and the fifth column is y1. for(i in 1:4) print(coef(lm(y1 ~., anscombe[c(1:i, 5)]))) On 12/6/06, Brooke LaFlamme [EMAIL PROTECTED] wrote: Hi all, I am running R version 2.4.0 on Windows XP. I am new and have the following question: I have a dataset of columns named x1, x2, x3...xn. I would like to write a linear regression using lm that looks like this: lm(y~x1+x2+x3+...+xn) If I try to use the following code, I only get the model for y~x1+xn: n-ncol(dataset) model-lm(y~x1) for(i in 1:n) { model.new-update(model, .~.+dataset[,i]) } The purpose of this is so I can use stepAIC with model.new as the upper scope and model as the lower. I know there must be a simple way to do this, but I am not yet familiar with much syntax. Any help appreciated! -- Brooke LaFlamme Cornell 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 and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Heteroscedasticity consistent standard errors for Spatial error models
Hello, Could anyone please tell me how to estimate Heteroscedasticity Consistent standard errors for a Spatial error model? All the functions I have looked at only works for lm objects. Thank you very much! - Oshadhi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] change factor level 1,2,3 to red,blue,dark
I am new to R. Maybe this is very simple question. I have a dataframe, there is column that is factor. This factor has three level that 1,2,3. Now I want to change these level(1,2,3) to level(red,blue,dark). Does anybody how to do this job? Thank you very much Aimin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Chi-Square Goodness-of-Fit test
By looking at R thread, it seems that the approach is: (1) cut the data into bins (you can use hist() to do this); (2) calculate the expected numbers in each bin using the differences of the CDF (pnorm, pexp, etc.); (3) calculate sum((exp-obs)^2/exp); (4) find the tail probability of the chi-square distribution (pchisq). I am a newbie in R. Your help will be greatly appreciated. Thx ej On 12/5/06, Don McKenzie [EMAIL PROTECTED] wrote: Ethan Johnsons wrote: If we use this data as an example, does ks.test still valid? E.Coli GroupObservedExpected A5777.9 B330547.1 C21322126.7 D45844283.3 E46044478.5 F21192431.1 G659684.1 H251107.2 You can use the test with any numeric data I believe. Whether it is valid is more a question for a statistician than for R. :-) Don -- ___ Don McKenzie, Research Ecologist Pacific Wildland Fire Sciences Lab USDA Forest Service 400 N 34th St. #201 Seattle, WA 98103, USA (206) 732-7824 [EMAIL PROTECTED] Affiliate Assistant Professor College of Forest Resources CSES Climate Impacts Group University of Washington [EMAIL PROTECTED] __ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] errors when setting up R2.4.0-win32.exe
Dear Ruser, Today, i download R2.4.0-win32.exe, but can't set it up successfully. The error informaiton is : *0x38e4memory quoted by ox6c7f22b3 can't be readonly.* My operating system in WindowXP. Where goes wrong? Thanks. -- With Kind Regards, oooO: (..): :\.(:::Oooo:: ::\_)::(..):: :::)./::: ::(_/ : [***] Zhi Jie,Zhang ,PHD Tel:86-21-54237149 [EMAIL PROTECTED] Dept. of Epidemiology,school of public health,Fudan University Address:No. 138 Yi Xue Yuan Road,Shanghai,China Postcode:200032 [***] oooO: (..): :\.(:::Oooo:: ::\_)::(..):: :::)./::: ::(_/ : [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fwd: R-Help
-- Forwarded message -- From: amna khan [EMAIL PROTECTED] Date: Dec 6, 2006 10:28 PM Subject: R-Help To: [EMAIL PROTECTED] Respected Sir I am a very new user of R. I want to ask a question about the nortest package. In this package how we can write the code of ad.test, cvm.test, ks.test for other distributions like GEV, GPA etc. I request you to please guide to me. Kind Regards AMNA -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] intercept value in lme
Thanks to all of you! Yes, you're right - I didn't take into consideration the ranges of predicors which are quite large. I think the matter over and realize that my assumption that something have to be wrong doesn't have in fact any reason except strange look of the value. Centering helped (as suggested by Chuck) especially in interpretation and helped me to understand what is really going on in the model. Thank you once again - these are my first experiences with R as like as with multilevel models, so... thank you for your patience! Best regards, victor Chuck Cleland wrote: victor wrote: It is boundend, you're right. In fact it is -25=X=0 These are cross-national survey data (I was investigated 7 countries in each country there was 900-1700 cases). In fact, there was two level 2 variables, so: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z1+Z2,~1|group,data=data,na.action=na.exclude,method=ML) X is a life satisfaction factor combined from 2 other variables for each case separately, of course. Y - income per capita in household Z1 - unemployment rate in a country. Z2 - life expectancy in a country group - country Victor: What happens if you center Y, Z1, and Z2 so that 0 corresponds to the mean for each? As it is, zero is a very unusual value for each of these variables. Do you really want to estimate the value of X when income = 0, unemployment = 0, and life expectancy = 0? If I understand correctly, I think that's why the intercept value looks unusual to you. I attach a similar model where after adding Lev2 predictors intercept value is even 22! I'm sure there is my mistake somwhere but... what is wrong? Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31140.77 31167.54 -15566.39 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.8698037 3.300206 Fixed effects: X ~ Y Value Std.Error DFt-value p-value (Intercept) -4.397051 0.3345368 5944 -13.143698 0 Y -0.000438 0.521 5944 -8.399448 0 Correlation: (Intr) Y -0.13 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.3855881 -0.5223116 0.2948941 0.6250717 2.6020180 Number of Observations: 5952 Number of Groups: 7 and for the second model: Linear mixed-effects model fit by maximum likelihood Data: data AIC BIClogLik 31133.08 31173.23 -15560.54 Random effects: Formula: ~1 | country (Intercept) Residual StdDev: 0.3631184 3.300201 Fixed effects: X ~ Y + Z1 + Z2 Value Std.Error DF t-value p-value (Intercept) 22.188828 4.912214 5944 4.517073 0. Y -0.000440 0.52 5944 -8.456196 0. Z1 -0.095532 0.0375204 -2.546161 0.0636 Z2 -0.333549 0.0620314 -5.377127 0.0058 Correlation: (Intr) FAMPEC UNEMP Y0.168 Z1 -0.429 0.080 Z2 -0.997 -0.188 0.366 Standardized Within-Group Residuals: Min Q1Med Q3Max -6.377 -0.5291287 0.2963226 0.6260023 2.6226880 Number of Observations: 5952 Number of Groups: 7 Doran, Harold wrote: As Andrew noted, you need to provide more information. But, what I see is that your model assumes X is continuous but you say it is bounded, -25 X 0 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of victor Sent: Wednesday, December 06, 2006 3:34 AM To: r-help@stat.math.ethz.ch Subject: [R] intercept value in lme Dear all, I've got a problem in fitting multilevel model in lme. I don't know to much about that but suspect that something is wrong with my model. I'm trying to fit: m1-lme(X~Y,~1|group,data=data,na.action=na.exclude,method=ML) m2-lme(X~Y+Z,~1|group,data=data,na.action=na.exclude,method=ML) where: X - dependent var. measured on a scale ranging from -25 to 0 Y - level 1 variable Z - level 1 variable In m1 the intercept value is equal -3, in m2 (that is after adding Lev 2 var.) is equal +16. What can be wrong with my variables? Is this possible that intercept value exceeds scale? Best regards, victor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list
Re: [R] POSIX and summer savings time
On Wed, 6 Dec 2006, Derek Eder wrote: I have a time stamp in UTC (GMT) time: format(ISOdatetime(1970,1,1,0,0,0)+1165398135729/1000,%Y-%m-%d %H:%M:%OS3) 2006-12-06 09:42:18.823 (note millisecond accuracy, but not relevant to question here) But it is the wrong answer, and not what my system gives. Now, this time stamp actually happened at local (Swedish) time one hour later (10:42). So you need to tell R that it was in UTC, which is what the 'tz' argument is for: (z - ISOdatetime(1970,1,1,0,0,0, tz=UTC)+1165398135729/1000) [1] 2006-12-06 09:42:15 UTC format(z, %Y-%m-%d %H:%M:%OS3, tz=CET) [1] 2006-12-06 10:42:15.729 Regarding summer/winter adjustments in time (spring forward, fall back): Is there a way of automatically recovering the local time adjustments for a given date? E.g., a date/time in springtime = GMT +2 , else GMT +1 Is the above not enough? You can unpick it if you want to get the shift. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Standar errors arma models
On Wed, 6 Dec 2006, Paulino Perez Rodriguez wrote: Why the standadard errors of the coefficientes of the arma models fited by using the arima procedure in the stats package doesnt coincide with that of S+, minitab or SAS? Possibly because R is using superior methodology (full ML fitting). Note that the help page says: The results are likely to be different from S-PLUS's 'arima.mle', which computes a conditional likelihood and does not include a mean in the model. Further, the convention used by 'arima.mle' reverses the signs of the MA coefficients. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simulation in R
Hi On 7 Dec 2006 at 1:20, Alexander Geisler wrote: Date sent: Thu, 07 Dec 2006 01:20:49 +0100 From: Alexander Geisler [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] Simulation in R Hello! I have the following problem. My code: --snip-- ergebnisse - rep(0, each=2) stichproben - rep(0, each=2) for (i in seq(1:2)) { n - dim(daten)[1] ix - sample(n,200) # producing samples samp_i - daten[ix,] stichproben[i] - samp_i # doesnât works If I understand your code correctly, you could use list. stichproben -vector(list,2) and stichproben[[i]] - samp_i # Calculation of the model: posterior_i - MCMClogit(y ~ fbl.ind + fekq3 + febitda4 + fuvs + fkru + fzd + fur3, data=samp_i, b0=prior, B0=precision, tune=0.5) # calculation ergebnisse[i] - summary(posterior_i) # saving the results (works) } --snip-- I have a data set called daten. I produce samples of the size 200. The samples are saved in samp_i. Question: How is the easiest way to save this samples. My code doesn't work, only the first column of the sample samp_i is in stichproben[i]. I understand why. My idea is to define a array stichproben and then save a matrix in the particular fields of the array. But things like y - matrix(c(samp_1),nrow=200, ncol=8) and then saving y in the array stichproben doesn't work. How is it possible to define a matrix with the content of my samples (samp_i) and but them into an array stichproben? Or is there an easier way? Try to look into some documentation to matrix and array. These have limitations that values have to be the same type, but are usually faster to manipulate than data frame. The behavior of objects and assignments depends on nature of objects. The complexity of objects increases in a row vector matrix array data.frame list and similarly changes possible ways of indexing and susetting HTH Petr With kind regards Alex -- Alexander Geisler * Kaltenbach 151 * A-6272 Kaltenbach email: [EMAIL PROTECTED] | [EMAIL PROTECTED] phone: +43 650 / 811 61 90 | skpye: al1405ex __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Heteroscedasticity consistent standard errors for Spatial error models
On Thu, 7 Dec 2006, Samarasinghe, Oshadhi Erandika wrote: Hello, Could anyone please tell me how to estimate Heteroscedasticity Consistent standard errors for a Spatial error model? All the functions I have looked at only works for lm objects. I assume that you looked also at the sandwich package: The methods there do not only work for lm objects but are object-oriented, appropriate methods are already provided for a range of different object classes. So, in principle, you can plug in other models as well, potentially including spatial models if appropriate methods are provided. See vignette(sandwich-OOP, package = sandwich) Disclaimer: I'm not sure whether the spatial structure of spatial models will be appropriately captured by the class of estimators implemented in sandwich. But someone who knows spatial models and their HC covariances should be able to figure that out from the vignette above. I'm also not sure what specialized methods exist... Best, Z Thank you very much! - Oshadhi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Splitting a dataframe at the results of tapply
I have got a dataframe containing measurement of aircraft noise like this: Id - c(1,4,5,2,3,6,4,1,2,5,6,3) Noise - c(88,94,97,98,92,56,103,102,87,95,92,97) Height - c(190, 150, 120, 115, 188, 104, 101, 189, 146, 111, 124, 126) df - data.frame(Id, Noise, Height) Now I would like to split this in two new dataframes. The first one containing the rows with the maximum Noise for each Id and in the second the other rows. I manage to find that maximum Noise levels... m - tapply(df$Noise, Id.factor, max) m 1 2 3 4 5 6 102 98 97 103 97 92 But how do I split my dataframe? -- Ed Gordijn Adviseur geluidscapaciteit Amsterdam Airport Schiphol Business Area Aviation (A/CAP/EC) Postbus 7501, 1118 ZG Schiphol Bezoekadres: Evert v/d Beekstraat 202, 1118 CP Schiphol tel 020 601 32 22 fax 020 601 21 34 e-mail [EMAIL PROTECTED] meer informatie is te vinden op www.schiphol.nl -- --- This e-mail may contain confidential and privileged material...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.