[R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2013-06-01 Thread Tiago V. Pereira
Hello, R users! I am struggling with the following problem: I need to compute a P-value for a mixture of two chi-squared distributions. My P-value is given by: P = 0.5*prob(sqrt(chi2(1)) = x) + 0.5*prob(sqrt(chi2(2)) = x) In words, I need to compute the p-value for 50–50 mixture of the square

[R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2013-06-01 Thread Tiago V. Pereira
Hello, R users! I am struggling with the following problem: I need to compute a P-value for a mixture of two chi-squared distributions. My P-value is given by: P = 0.5*prob(sqrt(chi2(1)) = x) + 0.5*prob(sqrt(chi2(2)) = x) In words, I need to compute the p-value for 50–50 mixture of the square

[R] R CMD check package mypkg-Ex.R failed

2013-06-01 Thread Justin
I build a test package in order to publish my own package to bioconductor. I am using package.skeleton Step 1. create test package mypkg   f - function(x,y) x+y   package.skeleton(list=c(f), name=mypkg) Step 2. build tar.gz file {mars:/local/workspace01/zhangju/R_autopackage_Elbow}../bin/R

Re: [R] wilcox_test function in coin package

2013-06-01 Thread Janh Anni
Hello peter, Thanks for the comment. wilcox.exact is simpler as you pointed out but the fact that it is no longer being developed is somewhat concerning. Regards Janh On Fri, May 31, 2013 at 6:50 PM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2013-05-30 20:20, Janh Anni wrote: Hello Greg,

Re: [R] GLMM in R

2013-06-01 Thread Bert Gunter
You should seek local statistical help. This list is not the right place to seek what appears to be statistical consulting and, indeed, basic statistical instruction. -- Bert On Fri, May 31, 2013 at 6:27 PM, Luis Fernando García Hernández luysgar...@gmail.com wrote: Dear Friends, I am new on

Re: [R] R CMD check package mypkg-Ex.R failed

2013-06-01 Thread Berend Hasselman
On 01-06-2013, at 02:56, Justin dly...@yahoo.com wrote: I build a test package in order to publish my own package to bioconductor. I am using package.skeleton Step 1. create test package mypkg f - function(x,y) x+y package.skeleton(list=c(f), name=mypkg) Step 2. build tar.gz file

[R] How to read a file including strings and numbers.

2013-06-01 Thread Jie Tang
hi R-users, I have a file as shown below,and the first column is time information. 2012-08-07 00:00:00,4174830,5,8.1,34.5,9.5,32,14 2012-08-07 00:00:01,4174831,4.7,8.6,34.5,9.9,29,14 2012-08-07 00:00:02,4174832,4.7,8.6,34.5,9.9,29,14 2012-08-07 00:00:03,4174833,5,8.5,34.5,9.8,30,14 2012-08-07

Re: [R] How to read a file including strings and numbers.

2013-06-01 Thread Jinsong Zhao
On 2013/6/1 15:54, Jie Tang wrote: hi R-users, I have a file as shown below,and the first column is time information. 2012-08-07 00:00:00,4174830,5,8.1,34.5,9.5,32,14 2012-08-07 00:00:01,4174831,4.7,8.6,34.5,9.9,29,14 2012-08-07 00:00:02,4174832,4.7,8.6,34.5,9.9,29,14 2012-08-07

Re: [R] How to read a file including strings and numbers.

2013-06-01 Thread Rui Barradas
Hello, Just use ?read.csv with argument header = FALSE. wnd_data - read.csv(text = ' 2012-08-07 00:00:00,4174830,5,8.1,34.5,9.5,32,14 2012-08-07 00:00:01,4174831,4.7,8.6,34.5,9.9,29,14 2012-08-07 00:00:02,4174832,4.7,8.6,34.5,9.9,29,14 2012-08-07 00:00:03,4174833,5,8.5,34.5,9.8,30,14

Re: [R] GLMM in R

2013-06-01 Thread Milan Bouchet-Valat
Le vendredi 31 mai 2013 à 22:27 -0300, Luis Fernando García Hernández a écrit : Dear Friends, I am new on R so I ask you to excuse me if this question sounds fool. I want to see if there is a significativa relationship between the mating (response variable) and several explanatory variables

Re: [R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2013-06-01 Thread Rui Barradas
Hello, Try the following. dmix - function(x){ dens - function(x, df) dchisq(x^2, df = df)*2*x 0.5*dens(x, df = 1) + 0.5*dens(x, df = 2) } pmix - function(x, lower.tail = TRUE){ p - integrate(dmix, lower = 0, upper = x) if(lower.tail) p$value else 1 - p$value }

[R] Loading an .RData file and assigning the loaded objects within a loop

2013-06-01 Thread Jeremy Ng
Hi all, I tried to look this up online, but am still feeling a little stuck. I have a bunch of Rdata files in side my directory, and I would like to load all of them in a loop. Each time the next is read in, it would over-write the previously read in object because they will be assigned the same

Re: [R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2013-06-01 Thread Rui Barradas
Hello, Or, if you want to pass a vector of quantiles to pmix, pmix - function(x, lower.tail = TRUE){ p - sapply(x, function(.x) integrate(dmix, lower = 0, upper = .x)$value) if(lower.tail) p else 1 - p } Rui Barradas Em 01-06-2013 11:13, Rui Barradas escreveu: Hello, Try

Re: [R] Loading an .RData file and assigning the loaded objects within a loop

2013-06-01 Thread Jim Holtman
use 'lapply' to read in the .RData file. Therefore each file is stored as an element of a list thatb you can access and change as necessary. Sent from my iPad On Jun 1, 2013, at 6:18, Jeremy Ng jeremy.ng.wk1...@gmail.com wrote: Hi all, I tried to look this up online, but am still feeling

Re: [R] order panels in xyplot by increasing slope

2013-06-01 Thread Henric Winell
Ethan, Jim Lemon skrev 2013-05-24 00:09: On 05/24/2013 06:21 AM, Belair, Ethan D wrote: example.plot = xyplot(ht ~ time|tree, data=data, type = c(r, g, p), par.settings=simpleTheme(col=blue), main=abc, ) example.plot ... If you

Re: [R] how to install R 3.0.1

2013-06-01 Thread Uwe Ligges
On 01.06.2013 02:02, Ranjan Maitra wrote: On Fri, 31 May 2013 18:10:19 -0500 Robert Baer rb...@atsu.edu wrote: On 5/31/2013 11:59 AM, Ranjan Maitra wrote: Hi John, I suspect you may be missing a c()? On Fri, 31 May 2013 06:05:45 -0800 John Kane jrkrid...@inbox.com wrote: paks -

Re: [R] how to install R 3.0.1

2013-06-01 Thread Uwe Ligges
On 01.06.2013 14:58, Uwe Ligges wrote: On 01.06.2013 02:02, Ranjan Maitra wrote: On Fri, 31 May 2013 18:10:19 -0500 Robert Baer rb...@atsu.edu wrote: On 5/31/2013 11:59 AM, Ranjan Maitra wrote: Hi John, I suspect you may be missing a c()? On Fri, 31 May 2013 06:05:45 -0800 John Kane

Re: [R] R CMD check package mypkg-Ex.R failed

2013-06-01 Thread Uwe Ligges
On 01.06.2013 08:26, Berend Hasselman wrote: On 01-06-2013, at 02:56, Justin dly...@yahoo.com wrote: I build a test package in order to publish my own package to bioconductor. I am using package.skeleton Step 1. create test package mypkg f - function(x,y) x+y

Re: [R] how to install R 3.0.1

2013-06-01 Thread John Kane
Thanks Uwe. installed.packages() is definitely faster and better. I don't think I even knew installed.packages() existed. I think I gave up looking for something like it a year or so ago. John Kane Kingston ON Canada -Original Message- From: lig...@statistik.tu-dortmund.de Sent:

Re: [R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2013-06-01 Thread peter dalgaard
On Jun 1, 2013, at 06:32 , Tiago V. Pereira wrote: Hello, R users! I am struggling with the following problem: I need to compute a P-value for a mixture of two chi-squared distributions. My P-value is given by: P = 0.5*prob(sqrt(chi2(1)) = x) + 0.5*prob(sqrt(chi2(2)) = x) In words,

Re: [R] how to install R 3.0.1

2013-06-01 Thread Ranjan Maitra
On Sat, 1 Jun 2013 14:58:22 +0200 Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 01.06.2013 02:02, Ranjan Maitra wrote: On Fri, 31 May 2013 18:10:19 -0500 Robert Baer rb...@atsu.edu wrote: On 5/31/2013 11:59 AM, Ranjan Maitra wrote: Hi John, I suspect you may be missing a

Re: [R] More discussion on R usage statistics

2013-06-01 Thread Johnny Zhang
Dear Ista, Thanks for the suggestion. I've changed the comment function to feedback.  Best, Johnny From: Ista Zahn istaz...@gmail.com Cc: r-help@r-project.org r-help@r-project.org Sent: Friday, May 31, 2013 5:56 PM Subject: Re: [R] More discussion on R usage

Re: [R] how to install R 3.0.1

2013-06-01 Thread Uwe Ligges
On 01.06.2013 15:58, Ranjan Maitra wrote: On Sat, 1 Jun 2013 14:58:22 +0200 Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 01.06.2013 02:02, Ranjan Maitra wrote: On Fri, 31 May 2013 18:10:19 -0500 Robert Baer rb...@atsu.edu wrote: On 5/31/2013 11:59 AM, Ranjan Maitra wrote: Hi

Re: [R] how to install R 3.0.1

2013-06-01 Thread Ranjan Maitra
On Sat, 1 Jun 2013 16:51:19 +0200 Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 01.06.2013 15:58, Ranjan Maitra wrote: On Sat, 1 Jun 2013 14:58:22 +0200 Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 01.06.2013 02:02, Ranjan Maitra wrote: On Fri, 31 May 2013

Re: [R] Loading an .RData file and assigning the loaded objects within a loop

2013-06-01 Thread Barry Rowlingson
Within lapply load the file and return the value of the thing or things in the file you want. Something like this: files [1] x1.RData x2.RData x3.RData x4.RData lapply(files,function(z){load(z);x}) [[1]] [1] 1 [[2]] [1] 22 [[3]] [1] 333 [[4]] [1] Each of my files contains a single

Re: [R] measuring distances between colours?

2013-06-01 Thread Michael Friendly
Just a quick note: The following two versions of your function don't give the same results. I'm not sure why, and also not sure why the criterion for 'near' should be expressed in squared distance. # version 1 rgb2col - local({ hex2dec - function(hexnums) { # suggestion of Eik

Re: [R] measuring distances between colours?

2013-06-01 Thread John Fox
Hi Michael, Thanks for the Wikipedia tip -- I'd looked there but didn't find this article. The article explains that the Lab colour space was formulated to provide uniform perceptual differences between colours, with a JND of approximately of 2.3. Ken Knoblauch made a similar point. The article

Re: [R] Loading an .RData file and assigning the loaded objects within a loop

2013-06-01 Thread Gabor Grothendieck
On Sat, Jun 1, 2013 at 6:18 AM, Jeremy Ng jeremy.ng.wk1...@gmail.com wrote: Hi all, I tried to look this up online, but am still feeling a little stuck. I have a bunch of Rdata files in side my directory, and I would like to load all of them in a loop. Each time the next is read in, it would

Re: [R] measuring distances between colours?

2013-06-01 Thread Ken Knoblauch
Hi John, Out of curiosity and if it is not much trouble, I would be curious if Luv worked any better than Lab. I think that Luv is supposed to be preferred for monitors and Lab for surfaces but they are generally pretty similar. Best, Ken Sent from my iPhone ___ Ken Knoblauch Inserm U846

Re: [R] GLMM in R

2013-06-01 Thread Ben Bolker
Milan Bouchet-Valat nalimilan at club.fr writes: Le vendredi 31 mai 2013 à 22:27 -0300, Luis Fernando García Hernández a écrit : Dear Friends, I am new on R so I ask you to excuse me if this question sounds fool. I want to see if there is a significativa relationship between the

Re: [R] measuring distances between colours?

2013-06-01 Thread John Fox
Hi Michael, This has become a bit of a comedy of errors. The bug is in Kevin Wright's code, which I adapted, and you too in your version, which uses local() rather than function() to produce the closure. The matrix which.col contains character data, as a consequence of binding the minimum

Re: [R] measuring distances between colours?

2013-06-01 Thread John Fox
Hi Ken, I just tried that, and with a distance of 15 as the criterion, which seemed to work well for Lav distances, I get fewer matches for the following example that we've been using: cols - c(#010101, #EE, #AA, #00AA00, #AA, #00, #AA00AA, #00) (nms - rgb2col(cols,

Re: [R] measuring distances between colours?

2013-06-01 Thread Michael Friendly
Hi John I agree that the Lab representation is the best so far for the goal of perceptually similar colors, and the approximate JND of 2.3 on the distance scale in this space is a useful, non-arbitrary criterion. FWIW, your demo might better show the hex and color names adjacently, for

Re: [R] measuring distances between colours?

2013-06-01 Thread Ken Knoblauch
I'd have to look it up and I'm not home at the moment. Can see later on. I would have thought that it would be normalized to have a jnd equal to 1 but I'm not sure. Ken Sent from my iPhone ___ Ken Knoblauch Inserm U846 Stem-Cell and Brain Research Institute 18 av du Doyen Lépine 69500 Bron

[R] Fwd: Your message to R-help awaits moderator approval

2013-06-01 Thread Janh Anni
Hello, I don't understand why my mails are being held up. What could be the problem? Thanks Janh -- Forwarded message -- From: r-help-boun...@r-project.org Date: Sat, Jun 1, 2013 at 1:48 PM Subject: Your message to R-help awaits moderator approval To: annij...@gmail.com Your

Re: [R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2013-06-01 Thread Rui Barradas
Hello, No, nothing wrong. (I feel silly for not having noticed it.) In fact not only it's much simpler but it's also more accurate than the use of accurate with the default rel.tol. It should be better, however, to use lower.tail = FALSE, since the op wants p-values. 0.5 * pchisq(x^2, 1,

Re: [R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2013-06-01 Thread Tiago V. Pereira
Thank you very much, Rui and Peter, for you detailed and helpful tips! It worked like a charm! I would spend more two weeks (or more) to figure out that by myself. Cheers! Tiago Hello, No, nothing wrong. (I feel silly for not having noticed it.) In fact not only it's much simpler but it's

Re: [R] Fwd: Your message to R-help awaits moderator approval

2013-06-01 Thread Ted Harding
[See at end] On 01-Jun-2013 17:52:01 Janh Anni wrote: Hello, I don't understand why my mails are being held up. What could be the problem? Thanks Janh -- Forwarded message -- From: r-help-boun...@r-project.org Date: Sat, Jun 1, 2013 at 1:48 PM Subject: Your message

[R] Official way to set/retrieve options in packages?

2013-06-01 Thread Jonathan Greenberg
R-helpers: Say I'm developing a package that has a set of user-definable options that I would like to be persistent across R-invocations (they are saved someplace). Of course, I can create a little text file to be written/read, but I was wondering if there is an officially sanctioned way to do

[R] Need to download data from internet

2013-06-01 Thread Ron Michael
Hi,   I need to dowload a time series with arbitray start date and end date, from this site:   http://www.mcxindia.com/sitepages/SpotMarketHistory.aspx?sLinkPage=Y   While I can download my required data manually, I would like R to do that for me. I have tried 'quandl' package, however could not

Re: [R] Need to download data from internet

2013-06-01 Thread Bert Gunter
Google is your friend! A google search on download internet data in R brought up this: http://www.slideshare.net/schamber/web-data-from-r -- Bert On Sat, Jun 1, 2013 at 1:14 PM, Ron Michael ron_michae...@yahoo.com wrote: Hi, I need to dowload a time series with arbitray start date and end

Re: [R] Fwd: Your message to R-help awaits moderator approval

2013-06-01 Thread Janh Anni
Okay. Thanks! Janh On Sat, Jun 1, 2013 at 3:11 PM, Ted Harding ted.hard...@wlandres.netwrote: [See at end] On 01-Jun-2013 17:52:01 Janh Anni wrote: Hello, I don't understand why my mails are being held up. What could be the problem? Thanks Janh -- Forwarded message

Re: [R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2013-06-01 Thread Rui Barradas
Inline. Em 01-06-2013 19:41, Rui Barradas escreveu: Hello, No, nothing wrong. (I feel silly for not having noticed it.) In fact not only it's much simpler but it's also more accurate than the use of accurate with the default rel.tol. Correction: ...than the use of _integrate()_ with the

Re: [R] Official way to set/retrieve options in packages?

2013-06-01 Thread Anthony Damico
hope this helps.. :) # define an object `x` x - list( any value here , 10 ) # set `myoption` to that object options( myoption = x ) # retrieve it later (perhaps within a function elsewhere in the package) ( y - getOption( myoption ) ) it's nice to name your options

Re: [R] Official way to set/retrieve options in packages?

2013-06-01 Thread Prof Brian Ripley
On 01/06/2013 22:44, Anthony Damico wrote: hope this helps.. :) # define an object `x` x - list( any value here , 10 ) # set `myoption` to that object options( myoption = x ) # retrieve it later (perhaps within a function elsewhere in the package) ( y -

[R] object not found

2013-06-01 Thread Jannetta Steyn
Hi All I am trying to implement a neural model in R from a paper but I have run into a bit of a problem. The model is getting so complex that I can't really test it in bits any more. At the moment I get this error: Error in eval(expr, envir, enclos) : object 'mCaT_soma_AB' not found I think I

Re: [R] object not found

2013-06-01 Thread jim holtman
I just did a search through the source and never did find a place that 'mCaT_soma_AB' was defined. How can you expect to use it if it has not been defined. On Sat, Jun 1, 2013 at 8:50 PM, Jannetta Steyn janne...@henning.org wrote: Hi All I am trying to implement a neural model in R from a

[R] metafor mixed-effect models: testing different predictor combinations for lowest AIC

2013-06-01 Thread emhanlon
Good afternoon, I am trying to use a mixed-effect model to find the best predictors of wildlife response (fledgling success, offspring growth rate, etc...) to human disturbance. I am using a Log Response Ratio as my measure of effect size along with study variance, and testing to see how:

Re: [R] wilcox_test function in coin package

2013-06-01 Thread Henric Winell
Janh, Janh Anni skrev 2013-06-01 04:27: Hello peter, Thanks for the comment. wilcox.exact is simpler as you pointed out but the fact that it is no longer being developed is somewhat concerning. Admittedly, 'coin' is being actively developed and has a lot more bells and whistles. But for

Re: [R] wilcox_test function in coin package

2013-06-01 Thread Janh Anni
Hello All, Thanks a lot for the helpful suggestions. I wonder how ties are handled for the rank sum test by wilcox_test and wilcox.exact? For instance, other software such as Minitab correct for ties by adjusting the variance of the test statistic, and actually provide the p values before and

[R] error about MCA

2013-06-01 Thread meng
Hi,all: I want to perform multiple correspondance analysis via MCA{FactoMineR}. The data is in the attachment. My code: dat-read.delim(e:\\mydata.txt,header=T) MCA(dat,quanti.sup=7,quali.sup=1:6) Error in `[.data.frame`(tab, , i) : undefined columns selected My question: Why does the error

[R] Frequency count of Boolean pattern in 4 vectors.

2013-06-01 Thread Sridhar Iyer
I need to do this on very large datasets ( a few million data points). So seeking help in figuring out an implementation of the task. Input 4 vectors which contain values as 0 or 1. (as integers, not boolean bits) vec_A = ( 0, 1, 0, 0, .. 1, 0, 1, 0) etc vec_B = (0,0,1,1.) vec_C, vec_D

[R] Windows Vista computer will not use changes I made to R console file

2013-06-01 Thread Julie Royster
My newer laptop died so I installed R on an older Vista laptop. I did follow the online instructions about giving myself full control under the R properties security tab. I made changes in the R console file under the etc folder to use bold type in color Black, but it is not doing what I ask. I am

[R] Regularized Discriminant Analysis scores, anyone?

2013-06-01 Thread Matthew Fagan
Hi all, I am attempting to do Regularized Discriminant Analysis (RDA) on a large dataset, and I want to extract the RDA discriminant score matrix. But the predict function in the klaR package, unlike the predict function for LDA in the MASS package, doesn't seem to give me an option to

[R] plot.gam

2013-06-01 Thread Aishwarya S. Bagchi
Hi, I would like to plot the gam function for the following: GAM1-gam(Sources~lo(Depth, span=0.5, degree=1) + Station, family=gaussian()) plot.gam(GAM1,residuals=TRUE, rugplot=FALSE, se=TRUE). I could do this fine when Station wasn't a variable. But now that I am

Re: [R] Frequency count of Boolean pattern in 4 vectors.

2013-06-01 Thread William Dunlap
For 10 million data points table(interaction(vec_D, vec_C, vec_B, vec_A)) took my laptop 11.45 seconds and the following function required 0.18 seconds f0 - function (vec_A, vec_B, vec_C, vec_D) { x - 1 + vec_A + 2 * (vec_B + 2 * (vec_C + 2 * vec_D)) tab - tabulate(x, nbins =