Re: [R] plot()
First, it is usual to make plots with generic scales rather than label each of the x values used, especially when they are irregularly spaced (as here). But if you want to do that, use axis() to create your own axis. Here's a test y <- data.frame(year=c(1970, 1974, 1976, 1978, 1980), V=rnorm(5)) attach(y) plot(year, V, type = "b", xaxt="n") axis(1, year, year) detach() On Mon, 6 Jan 2003, Nirmala Ravishankar wrote: > I am an R novice trying to figure out plot(). > Specifically, I am trying to plot the values of a > numeric variable V for a set of years (1970, 1974, > 1976, 1978, 1980). How do I get R to label the years > I am plotting on the x-axis rather then some general > levels (1970, 1975, 1980.) Using as.character(year) > doesn't seem to help, and using as.factor(year) > generates steps insteads of dots. > > Help will be most appreciated. I have listed the code > I have been using below: > > > plot(y$year, y$V, type = "b") > > plot(as.character(y$year), y$V, type = "b") > > plot(as.character(y$year), y$V, type = "b") -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] plot()
try text(c("1970", "1978", "1990"), x=1:3, y=1:3) after you first call plot(c(1, 3), c(1, 3), axes=F, type="n", xlab="", ylab="") to set the plotting area. Yuelin. -- From: Nirmala Ravishankar <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: [R] plot() Date: Mon, 6 Jan 2003 20:19:58 -0800 (PST) I am an R novice trying to figure out plot(). Specifically, I am trying to plot the values of a numeric variable V for a set of years (1970, 1974, 1976, 1978, 1980). How do I get R to label the years I am plotting on the x-axis rather then some general levels (1970, 1975, 1980.) Using as.character(year) doesn't seem to help, and using as.factor(year) generates steps insteads of dots. Help will be most appreciated. I have listed the code I have been using below: > plot(y$year, y$V, type = "b") > plot(as.character(y$year), y$V, type = "b") > plot(as.character(y$year), y$V, type = "b") Thanks, NR __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] plot()
I am an R novice trying to figure out plot(). Specifically, I am trying to plot the values of a numeric variable V for a set of years (1970, 1974, 1976, 1978, 1980). How do I get R to label the years I am plotting on the x-axis rather then some general levels (1970, 1975, 1980.) Using as.character(year) doesn't seem to help, and using as.factor(year) generates steps insteads of dots. Help will be most appreciated. I have listed the code I have been using below: > plot(y$year, y$V, type = "b") > plot(as.character(y$year), y$V, type = "b") > plot(as.character(y$year), y$V, type = "b") Thanks, NR __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] help interpreting output?
Dear R experts, I'm hoping someone can help me to interpret the results of building gam's with mgcv in R. Below are summaries of two gam's based on the same dataset. The first gam (named "gam.mod") has six predictor variables. The second gam (named "gam.mod2") is exactly the same except it is missing one of the predictor variables. What is confusing me is the estimated defrees of freedom for each of the splines in the second model > summary.gam(mod.gam) Family: gaussian Link function: identity Formula: INT ~ s(IGS) + s(L2E) + s(TED) + s(PSD) + s(OPD) + s(GED) Parametric coefficients: Estimate std. err.t ratioPr(>|t|) constant 302.32 5.192 58.23< 2.22e-16 Approximate significance of smooth terms: edf chi.sq p-value s(IGS) 4.254 58.308 9.5524e-12 s(L2E) 1 8.7673 0.0030668 s(TED) 1 8.3915 0.0037697 s(PSD) 1 6.0234 0.014118 s(OPD) 2.289 12.745 0.0024349 s(GED) 3.791 152.68 < 2.22e-16 R-sq.(adj) = 0.885 Deviance explained = 91.1% GCV score = 2124.9 Scale est. = 1617.3n = 60 >summary.gam(mod.gam2) Family: gaussian Link function: identity Formula: INT ~ s(IGS) + s(L2E) + s(TED) + s(PSD) + s(OPD) Parametric coefficients: Estimate std. err.t ratioPr(>|t|) constant 302.32 4.736e-14 6.384e+15< 2.22e-16 Approximate significance of smooth terms: edf chi.sq p-value s(IGS) 1.757e-05 1.3524e+09 < 2.22e-16 s(L2E) 0.009991 0.21394 0.6437 s(TED) 2.945e-05 1.4913e+07 < 2.22e-16 s(PSD) 2.566e-05 6.5495e+06 < 2.22e-16 s(OPD) 5.023e-05 3.2332e+07 < 2.22e-16 R-sq.(adj) = 0.645 Deviance explained = 64.5% GCV score = 7489.7 Scale est. = 6069.7n = 60 Any suggestions about either (1) what went wrong with the second model? or (2) how the heck do I interpet these results? Thanks, Mike. __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R and file size
I will be involved with an analysis based on a file that will be roughly 25 meg. Assuming I have enough memory, is their any limitations to using R on a file this large. Thank you, Gregory L. Blevins Vice President, Partner The Market Solutions Group, Inc. [EMAIL PROTECTED] Office phone: 612 392-3163 Cell phone: 612 251-0232 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] how to save envir. when batch is halted
?dump.frames has a worked example. On Mon, 6 Jan 2003, Vadim Ogranovich wrote: > Dear R-users, > > If for whatever reason a batch execution of my script halts I want R to save > my current environment, along with .Traceback var, in the .RData file (in > other words I need something like core dump). > > It seems however that if execution is halted via stop() no .RData file is > dumped. So my question is how do produce the "core dump" or something to > that effect? -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] how to save envir. when batch is halted
Dear R-users, If for whatever reason a batch execution of my script halts I want R to save my current environment, along with .Traceback var, in the .RData file (in other words I need something like core dump). It seems however that if execution is halted via stop() no .RData file is dumped. So my question is how do produce the "core dump" or something to that effect? Thank you, Vadim -- DISCLAIMER \ This e-mail, and any attachments thereto, is intend ... [[dropped]] __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] info please
I am sorry but I do not think it is the right place for question about g77 GNU Fortran Compiler I wait for your kind reply sincerely yours alessandro agresti [[alternate HTML version deleted]] __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Long memory ts answer
fracdiff has its own package called fracdiff. thank you for your great forbearance. Sincerely, Erin __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Removing autocorrelations
Dear Andrew, I'm not sure whether this is what you're looking for, but the gls function in the nlme package will fit *linear* models with a variety of correlated-error structures. I hope that this helps, John At 09:17 AM 1/6/2003 +, Dr Andrew Wilson wrote: Could anyone tell me whether there is an R function for removing autocorrelations from a series of observations before performing a linear or nonlinear regression analysis on them? - John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: [EMAIL PROTECTED] phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox - __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Re - segments within a lattice graph
On Mon, 6 Jan 2003 [EMAIL PROTECTED] wrote: > The solution to my problem is to use > 'lsegments' instead of 'segments' within lattice commands. > > (Although I wont forget again, > a comment in the segments help file referring to 'lsegments' > might help others not to make the same mistake in the future.) *But* the segments help file is part of base R graphics, and xyplot and lsegments are part of the recommended addon package lattice. To be consistent you would want us to document in base R all the places where there are limitations of usage with addons (or recommended addons). There would be an awful lot of those (including on all of the graphics-related help pages). Surely the answer is to read the documentation of the package you are using to see *its* restrictions. In your case you were using a panel function in xyplot, and ?xyplot's panel argument does explicitly tell you There are also some grid-compatible replacements of base R graphics functions useful for this purpose, such as `llines'. (Note that the corresponding base R graphics functions like `lines' would not work.) These are usually sufficient to convert existing custom panel functions written for S-Plus. -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Re - segments within a lattice graph
Hi, The solution to my problem is to use 'lsegments' instead of 'segments' within lattice commands. (Although I wont forget again, a comment in the segments help file referring to 'lsegments' might help others not to make the same mistake in the future.) My thanks to Renaud Lancelot. Regards, John. John Gavin <[EMAIL PROTECTED]>, Quantitative Risk Models and Statistics, UBS Warburg, 6th floor, 100 Liverpool St., London EC2M 2RH, UK. Phone +44 (0) 207 567 4289 Fax +44 (0) 207 568 5352 From: [EMAIL PROTECTED] Date: Mon, 6 Jan 2003 09:08:28 - To: <[EMAIL PROTECTED]> Subject: [R] segments within a lattice graph Hi, I would like to use the segments command within a lattice graph. Is this allowed in R in the same way as in SPlus? If not, what is the alternative? For example, the following produces vertical line segments between points in SPlus but in R the line segments are not shown. (I want to replicate in R what I see in SPlus.) What is my mistake? library(lattice) set.seed(123) dat <- data.frame( aa = runif(10), bb = runif(10), cc = runif(10) ) dat <- dat[order(dat$aa),] dat xyplot(cc ~ aa, data = dat, panel = function(x, y, ...) { # no line segements and no error is printed. segments(dat$aa, dat$bb, dat$aa, dat$cc) panel.xyplot(dat$aa, dat$cc, col = 1, pch = 1, type = "b") panel.xyplot(dat$aa, dat$bb, col = 2, pch = 2, type = "b") # no arrows but errors are printed. # arrows(dat$aa, dat$bb, dat$aa, dat$cc) }, ylim = range(dat$bb, dat$cc) ) Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] as.POSIXct problem -- summary
A summary on this: 1) RedHat 8.0 contains an unreleased version of glibc between the released versions 2.2.5 and 2.3. That version (and >=2.3) have been modified to make dates prior to 1970-01-01 invalid in some cases but not others. We've put a workaround for this in R 1.6.2 (due on Friday), and that checks at run-time for the broken version of glibc. Because of the internal inconsistencies in glibc, you will see inconsistencies in the reporting of DST prior to 1970 (but as POSIXct times they are always valid). This makes it important for users of RH8.0 and other recent Linux distros to update to 1.6.2 when released (or even R-patched now). We used a run-time test to allow for installations which are updated to a `better' glibc. 2) The immediate workaround is as.POSIXct(x, tz="GMT") which avoids the OS's routines altogether. On Thu, 2 Jan 2003, Frank E Harrell Jr wrote: > > x <- strptime(c('10/10/1969','12/31/2002'),format='%m/%d/%Y') > > x > [1] "1969-10-10" "2002-12-31" > > as.POSIXct(x) > [1] NA "2002-12-31 EST" > > Why the NA? If this is not the preferred way to convert a character string to >POSIXct what is? On a more minor note why the EST if no time is printed? -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Removing autocorrelations
This makes no statistical sense. If you are going to perform a regression on a time series (and if it has any point so there is a significant regression) then if the regressor is autocorrelated the response will be too even with independent errors. You need to do the regression and the modelling of the autocorrelation simultaneously (function arima in package ts for linear regression) or at least alternately (the Corchane-Orcutt procedure, DIY). As is often the case, please tell us what you want really to do (in your substantive application) rather than for a vague statistical procedure, and we may be able to point you to appropriate tools. On Mon, 6 Jan 2003, Dr Andrew Wilson wrote: > Could anyone tell me whether there is an R function for removing > autocorrelations from a series of observations before performing a linear > or nonlinear regression analysis on them? (This would seem to suggest fitting an AR process and looking at the residuals, a procedure sometimes known as `pre-whitening'. But it needs to be applied to residuals from a regression, not the original series.) -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Greek Letters for labeling persp-axis
salvatore barbaro wrote: Hi everybody, on ?plotmath it can be seen that mathematical expressions like a greek letter could not be used for x- and y-axis labels in 'persp' plots. Unfortunately, this is exactly what I want to do: I need an expression(rho) to label the y-axes. Does anybody know a way to solve the problem. From ?persp: "xlab, ylab, zlab titles for the axes. N.B. These must be character strings; expressions are not accepted. Numbers will be coerced to character strings." What you can do is to work around with text() (or mtext()) and the trans3d() function given in the examples in persp(). > Further, Latex works very well by using the command tilde{y}^{[dip]} but I have some troubles in R (for instance, as a 'main' argument in a simple plot), probably due to the square brackets. The command expression(tilde(y)^(dip)) works, but what I want to get are indeed the square brackets. See ?plotmath and look for "group" and "bgroup": plot(1:10, main=expression(tilde(y)^group("[",dip,"]"))) Uwe Ligges __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Greek Letters for labeling persp-axis
Hi everybody, on ?plotmath it can be seen that mathematical expressions like a greek letter could not be used for x- and y-axis labels in 'persp' plots. Unfortunately, this is exactly what I want to do: I need an expression(rho) to label the y-axes. Does anybody know a way to solve the problem. Further, Latex works very well by using the command tilde{y}^{[dip]} but I have some troubles in R (for instance, as a 'main' argument in a simple plot), probably due to the square brackets. The command expression(tilde(y)^(dip)) works, but what I want to get are indeed the square brackets. Thanks in advance. Yours Salvatore Barbaro salvatore barbaro department of public economics platz der göttinger sieben 3 37073 göttingen tel.: +49 551 3919704 fax: +49 551 39 7353 http://www.gwdg.de/~sbarbar __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Removing autocorrelations
Could anyone tell me whether there is an R function for removing autocorrelations from a series of observations before performing a linear or nonlinear regression analysis on them? Many thanks, Andrew Wilson __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] segments within a lattice graph
Hi, I would like to use the segments command within a lattice graph. Is this allowed in R in the same way as in SPlus? If not, what is the alternative? For example, the following produces vertical line segments between points in SPlus but in R the line segments are not shown. (I want to replicate in R what I see in SPlus.) What is my mistake? library(lattice) set.seed(123) dat <- data.frame( aa = runif(10), bb = runif(10), cc = runif(10) ) dat <- dat[order(dat$aa),] dat xyplot(cc ~ aa, data = dat, panel = function(x, y, ...) { # no line segements and no error is printed. segments(dat$aa, dat$bb, dat$aa, dat$cc) panel.xyplot(dat$aa, dat$cc, col = 1, pch = 1, type = "b") panel.xyplot(dat$aa, dat$bb, col = 2, pch = 2, type = "b") # no arrows but errors are printed. # arrows(dat$aa, dat$bb, dat$aa, dat$cc) }, ylim = range(dat$bb, dat$cc) ) SPlus 6.0.5 R4 for MS Windows NT4 SP5 R platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor6.1 year 2002 month11 day 01 language R Regards, John. John Gavin <[EMAIL PROTECTED]>, Quantitative Risk Models and Statistics, UBS Warburg, 6th floor, 100 Liverpool St., London EC2M 2RH, UK. Phone +44 (0) 207 567 4289 Fax +44 (0) 207 568 5352 Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] On nlm
On Mon, 6 Jan 2003, E. D. Isaia wrote: > Dear all, I have to minimize a (real) function in a loop (say i in > (1:1000)) and store its ``$estimate'', via > > l2estim<-nlm(f.minimo,c(-.01,0.1))$estimate > > into a vector for further analisys. > Since the function's behaviour is quite peculiar (in the sense that in > the simulation study it may not have a minumum), sometimes I get the the > warning > > Error in nlm(minimo, c(-0.01, 0.1), check.analyticals = FALSE) : > non-finite value supplied by nlm In addition: There were 50 or > more warnings (use warnings() to see the first 50) > > and the cicle stops. How can I avoid this and tell R that if so then > l2estim<-0, for example. > > Thanks to all, isaia. > try() will probably be the best way to handle this - see ?try Roger -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Long memory ts
> "Erin" == Erin Hodgess <[EMAIL PROTECTED]> > on Sat, 4 Jan 2003 18:45:43 -0600 (CST) writes: Erin> Dear R People: Erin> Where is the command for long memory time series, please? Erin> In S, it's arima.fracdiff Erin> Is there something like that in R? If so, which Erin> library has it, please? it's "package" not "library" --- and guess what! --- the package is called fracdiff... :-) Martin __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help