[R] Complex to polar?

2008-07-27 Thread rkevinburton
I am using fft(x) to compute the fft of a real-valued sequence. This returns (as expected an array of complex numbers. Is ther an R function to transform these complex numbers into two arrays for the magnitude and phase? Basically polar notation? Thank you. Kevin

Re: [R] Complex to polar?

2008-07-27 Thread Prof Brian Ripley
Please read ?complex. On Sun, 27 Jul 2008, [EMAIL PROTECTED] wrote: I am using fft(x) to compute the fft of a real-valued sequence. This returns (as expected an array of complex numbers. Is ther an R function to transform these complex numbers into two arrays for the magnitude and phase?

Re: [R] S4 : setGeneric for classical methods

2008-07-27 Thread cgenolin
Martin Maechler [EMAIL PROTECTED] a écrit : CG == Christophe Genolini [EMAIL PROTECTED] on Sat, 26 Jul 2008 12:12:12 +0200 writes: CG Martin Maechler [EMAIL PROTECTED] a écrit : CG == Christophe Genolini [EMAIL PROTECTED] on Tue, 22 Jul 2008 19:04:37 +0200

[R] Retain plot?

2008-07-27 Thread rkevinburton
Every time I issue a plot command it removes the current plot and replaces it with the plot that I just issued. I would like to keep both plots. I looked in the documentation and found plot.new but was unable to get it to work. I think I want that functionality. Any suggestions? Thank you.

[R] A easy way to write formula

2008-07-27 Thread Jinsong Zhao
Hi I have a data frame, including x1, x2, x3, and y. I use lm() to fit second-order linear model, like the following: ft - lm(y ~ x1 + x2 + x3 + I(x1 * x1) + I(x1 * x2) + I(x1 * x3) + I(x2 * x2) + I(x2 * x3) + I(x3 * x3), mydata) if the independent variable number is large, the formula will be

Re: [R] Color of box frame in Legend (Was: Matrix barplot)

2008-07-27 Thread Andreas Tille
On Sun, 27 Jul 2008, S Ellison wrote: Looking at the legend() source the filled box line colour is hardcoded : if (mfill) { if (plot) { fill - rep(fill, length.out = n.leg) rect2(left = xt, top = yt + ybox/2, dx = xbox, dy = ybox, col = fill,

Re: [R] Weighted variance function?

2008-07-27 Thread Arun Kumar Saha
ur prog gives following result: weighted.var(c(1,-1), c(0.5,0.5)) [1] 2 is it ok? On Thu, Jul 24, 2008 at 7:57 PM, Gavin Simpson [EMAIL PROTECTED]wrote: On Thu, 2008-07-24 at 02:25 +0530, Arun Kumar Saha wrote: There is a R function to calculate weighted mean : weighted.mean() under stats

Re: [R] Transfer Function Modeling

2008-07-27 Thread Ashish Kumar
Hi, I would like to know how to build the transfer function modeling for bivariate time series data. I tried searching for relevant threads, but could not find much help with it. Thanks Ashish [[alternative HTML version deleted]] __

Re: [R] Lattice wireframe: How to avoid drawing lines around polygons when using shade=TRUE

2008-07-27 Thread Oliver M. Haynold
On Sun, 27 Jul 2008 05:00:48 +, Oliver M. Haynold wrote: I am using wireframe from the lattice package, with the shade option set to TRUE. When I output to PDF or Postscript, a line gets drawn around each polygon of my surface which causes ugly Moiré effects and doesn't make sense in my

Re: [R] A easy way to write formula

2008-07-27 Thread ONKELINX, Thierry
(x1 + x2 + x3) ^2 will give you the main effects and the interactions. So this will shorten your equation to ft - lm(y ~ (x1 + x2 + x3) ^2 + I(x1 * x1)+ I(x2 * x2) + I(x3 * x3), mydata) HTH, Thierry ir. Thierry

Re: [R] Retain plot?

2008-07-27 Thread ONKELINX, Thierry
Kevin, Open a new plot window before plotting the second plot. plot(rnorm(10), runif(10)) X11() plot(rnorm(10), runif(10)) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research

Re: [R] A easy way to write formula

2008-07-27 Thread Mark Difford
Hi Jinsong and Thierry, (x1 + x2 + x3) ^2 will give you the main effects and the interactions. Although it wasn't specifically requested it is perhaps important to note that (...)^2 doesn't expand to give _all_ interaction terms, only interactions to the second order, so the interaction term

Re: [R] Weighted variance function?

2008-07-27 Thread Arun Kumar Saha
I feel there is something wrong in definition in weighted variance. Say for a fair dice the variance of outcome should be : 2.92 ( http://en.wikipedia.org/wiki/Variance) However if I use cov.wt() or weighted.var() by Gavin, I get : cov.wt(as.data.frame(1:6), rep(0.6, 6)) $cov 1:6 1:6 3.5

Re: [R] Weighted variance function?

2008-07-27 Thread Arun Kumar Saha
oh now I got, R is taking unbiased estimator, anyways thanks On Sun, Jul 27, 2008 at 2:54 PM, Arun Kumar Saha [EMAIL PROTECTED]wrote: I feel there is something wrong in definition in weighted variance. Say for a fair dice the variance of outcome should be : 2.92 (

Re: [R] GLS no terms component error

2008-07-27 Thread mm745
Thank you, Bill. I think I misread some text in my statistics handbook. This has helped to clear it up. Sorry for taking up your time and thank you for replying. M. Grace Quoting [EMAIL PROTECTED]: The help file for dwtest says formula: a symbolic description for the model to be tested (or a

Re: [R] re sponse surface analysis

2008-07-27 Thread Tom La Bone
There appears to be a very promising response surface package being discussed at useR-2008, but I have been unable to find the package on CRAN or contact the authors. www.statistik.uni-dortmund.de/useR-2008/abstracts/Sztendur+Diamond.pdf Tom Jinsong Zhao wrote: Hi, Is there a package

[R] Object-oriented programming in R for Java programmers?

2008-07-27 Thread Werner Wernersen
Hi, I was wondering if anybody might have a reference for me: My R code is growing and getting more and more confusing. Thus, I figure it's time to switch to object-oriented again. I have done oo programming in C++ and Java before but the first few tutorial on R oo were a bit confusing for me.

Re: [R] response surface analysis

2008-07-27 Thread Jinsong Zhao
Tom La Bone wrote: There appears to be a very promising response surface package being discussed at useR-2008, but I have been unable to find the package on CRAN or contact the authors. www.statistik.uni-dortmund.de/useR-2008/abstracts/Sztendur+Diamond.pdf Tom Thanks for pointing me to

[R] equivalent R functions for Numerical Recipes fitxy and fitexy ?

2008-07-27 Thread Marc Fischer
Dear Folks, We need to fit the model y~x assuming there are random errors in both x and y. Numerical Recipes (Press et al.) have two useful functions, fitxy and fitexy, which handle cases of unspecified and specified errors respectively. Are there equivalent functions in base R or a

[R] Link functions in SEM

2008-07-27 Thread Jeroen Ooms
Is it possible to fit a structural equation model with link functions in R? I am trying to build a logistic-regression-like model in sem, because incorporating the dichotomous variables linearly seems inappropriate. Mplus can do something similar by specifying a 'link' parameter, but I would like

[R] Colors in Sweave

2008-07-27 Thread Stephen Tucker
Hi list, I was using Sweave and was wondering if anyone has had any luck changing the font colors of the code chunks. For instance, in my .Rnw preample I tried including: === \usepackage[usenames]{colors} \definecolor{darkred}{rgb}{0.545,0,0} \definecolor{midnightblue}{rgb}{0.098,0.098,0.439}

Re: [R] Object-oriented programming in R for Java programmers?

2008-07-27 Thread Johannes Huesing
Werner Wernersen [EMAIL PROTECTED] [Sun, Jul 27, 2008 at 01:55:26PM CEST]: [...] Is there any brief tutorial on oo programming in R especially for people who have done oo in Java or C++ before? That would be really helpful. How S4 methods work highlights the differences between R's

Re: [R] melting a list: basic question

2008-07-27 Thread hadley wickham
Is it possible to install your development version of reshape? I could not find it alongside of ggplot2 on github. Not yet, but I'm working on it. If not, I've added ... in the method for the current version and it seems to work for me. Yes, that's the exact change I made. Thanks! Hadley

Re: [R] A easy way to write formula

2008-07-27 Thread hadley wickham
On Sun, Jul 27, 2008 at 4:19 AM, Mark Difford [EMAIL PROTECTED] wrote: Hi Jinsong and Thierry, (x1 + x2 + x3) ^2 will give you the main effects and the interactions. Although it wasn't specifically requested it is perhaps important to note that (...)^2 doesn't expand to give _all_

Re: [R] 64-bit R on Mac OS X 10.5.4

2008-07-27 Thread joseph
Hi Matt Your method is the easiest way for me to install the 64-bit R. I followed the directions on your web site and then did the following: R --arch=x86_64 source(http://bioconductor.org/biocLite.R;) biocLite(type = source,lib =

Re: [R] Object-oriented programming in R for Java programmers?

2008-07-27 Thread Jeroen Ooms
Werner Wernersen wrote: I have done oo programming in C++ and Java before but the first few tutorial on R oo were a bit confusing for me. My personal experience is that the type of OO programming that makes for example Java code nice and easy to structure is not possible in R. The biggest

Re: [R] Object-oriented programming in R for Java programmers?

2008-07-27 Thread Stephen Tucker
I've never used it myself but I recall reading about this R.oo package a while ago - might be worth considering? http://www1.maths.lth.se/help/R/R.oo/ - Original Message From: Werner Wernersen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 27, 2008 4:55:26 AM Subject: [R]

[R] Fitting a Bivariate Poisson log-normal distribution

2008-07-27 Thread Famoye, Felix
I wrote an R program to fit a bivariate Poisson log-normal model. The model is first proposed by Aitchison and Ho (1989) in Biometrika, Volume 76 pages 643-653. The model involves using a double integration. The following is the program and the data that I used. My major problem was that R was

Re: [R] Object-oriented programming in R for Java programmers?

2008-07-27 Thread Stephen Tucker
This page is also a brief introduction to the S3 classes: http://www.ibm.com/developerworks/linux/library/l-r3.html (see section on 'Object-oriented R') and for S4, in addition to How S4 methods work: http://developer.r-project.org/methodDefinition.html - Original Message From:

[R] help with durbin.watson

2008-07-27 Thread tom soyer
Hi, I have two time series, y and x. Diff(y) and Diff(x) both show no autocorrelation. But durbin.watson(lm(Diff(y)~lag(Diff(x),k=-4)) gives a DW value of zero. How come the residule is autocorrelated while Diff(y) and Diff(x) are not? Does anyone know if in my case a DW of zero indicates serial

Re: [R] graphing regression coefficients and standard errors

2008-07-27 Thread Ritwik Sinha
Hi Murali, The plot function works on an lm object. The example from the help page of lm. Ritwik ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) anova(lm.D9 -

Re: [R] Maximization under constraits

2008-07-27 Thread Ritwik Sinha
Hi Daniela, Will the optim function with the method L-BFGS-B work for you? Look for the lower argument in the function. Ritwik On Fri, Jul 25, 2008 at 9:07 AM, Daniela Garavaglia [EMAIL PROTECTED] wrote: I'm looking for a R function which can maximise this logliklihood function, under the

[R] equivalent R functions for Numerical Recipes fitxy and fitexy ?

2008-07-27 Thread Marc Fischer
Dear Folks, We need to fit the model y~x assuming there are random errors in both x and y. Numerical Recipes (Press et al.) have two useful functions, fitxy and fitexy, which handle cases of unspecified and specified errors respectively. Are there equivalent functions in base R or a

[R] Interpolating a line and then summing there values for a diurnal oxygen curve (zoo object)

2008-07-27 Thread stephen sefick
#I would like to interpolate a straight line between 06/08/06 04:16:00 - 06/08/06 20:31:00 with values and then sum them. This is an estimate of ecosystem #respiration and I will be using this in a larger context(48 days of these diurnal curves), but for right now I am just trying to figure out

Re: [R] Interpolating a line and then summing there values for a diurnal oxygen curve (zoo object)

2008-07-27 Thread Gabor Grothendieck
Try this using your z and library(zoo): # extract section of interest w - window(z, start=chron(6/8/6, 4:16:0), end=chron(6/8/6, 20:31:0)) # zap all interior points with NA's and then fill back in using linear interpolation lin - na.approx(replace(w, time(w) start(w) time(w) end(w), NA)) #

[R] Mixed model question.

2008-07-27 Thread Rolf Turner
I continue to struggle with mixed models. The square zero version of the problem that I am trying to deal with is as follows: A number (240) of students are measured (tested; for reading comprehension) on 6 separate occasions. Initially (square zero) I want to treat the test time as a

Re: [R] Coefficients of Logistic Regression from bootstrap - how to get them?

2008-07-27 Thread Tim Hesterberg
I'll address the question of whether you can use the bootstrap to improve estimates, and whether you can use the bootstrap to virtually increase the size of the sample. Short answer - no, with some exceptions (bumping / Random Forests). Longer answer: Suppose you have data (x1, ..., xn) and a

[R] product of successive rows

2008-07-27 Thread rcoder
Hi everyone, I want to perform an operation on a matrx that outputs the product of successive pairs of rows. For example: calculating the product between rows 1 2; 3 4; 5 6...etc. Does anyone know of any readily available functions that can do this? Thanks, rcoder -- View this message

[R] Converting english words to numeric equivalents

2008-07-27 Thread oscar Linares
Hello, I am trying to convert english words to numeric equivalents, e.g., abc to 123. Is there a function or library or package for doing this in R? If not, can it be done easily in R? Thanks, Oscar [[alternative HTML version deleted]]

[R] Rolling regression - o/p selected coefficients

2008-07-27 Thread rcoder
Hi everyone, Using the rolling regression function - rollingRegression(formula, data, width, ...) - is there a way to output only selected coefficients to a results matrix. For e.g. if I only wanted the slope coefficients to be recorded, how would I go about doing this? Thanks, Michael --

Re: [R] Converting english words to numeric equivalents

2008-07-27 Thread Rolf Turner
On 28/07/2008, at 12:32 PM, oscar Linares wrote: Hello, I am trying to convert english words to numeric equivalents, e.g., abc to 123. Is there a function or library or package for doing this in R? If not, can it be done easily in R? Your question is very ill-posed. What ``english

[R] read.table question

2008-07-27 Thread Edna Bell
Dear R list: I have a data set that I would like to bring it. The fourth column shows as numeric, but I want it to be a factor. Is there a way to do this from the read.table statement, or should I just wait and use the factor function please? thanks, Edna Bell

Re: [R] read.table question

2008-07-27 Thread Rolf Turner
On 28/07/2008, at 3:26 PM, Edna Bell wrote: Dear R list: I have a data set that I would like to bring it. The fourth column shows as numeric, but I want it to be a factor. Is there a way to do this from the read.table statement, or should I just wait and use the factor function please?

[R] Help with a loop

2008-07-27 Thread Sofia Martinez
HI: I need ideas on how to make this code shorter (maybe with a second loop?). The code as it is works, but in this case I only have 14 samples, but it will become insane with more, so I need a way to make it more automatic. The problem is that the output from ts1, ts2, and so on is a vector with

[R] Are there any packages that can process images other than pixelmap (i.e. pnm)?

2008-07-27 Thread Arthur Roberts
Hi, all, I am having trouble getting R to take pnm images via mogrify i.e. mogrify -resize 320x217 -format pnm *.png However R via pixmap says that it can't read the file. If you have any ideas like a package that can read jpeg files, etc., I would appreciate it. Best wishes, Art

Re: [R] Are there any packages that can process images other than pixelmap (i.e. pnm)?

2008-07-27 Thread Henrik Bengtsson
See EBImage on Bioconductor.org. /Henrik On Sun, Jul 27, 2008 at 10:21 PM, Arthur Roberts [EMAIL PROTECTED] wrote: Hi, all, I am having trouble getting R to take pnm images via mogrify i.e. mogrify -resize 320x217 -format pnm *.png However R via pixmap says that it can't read the file.