[R] Fitting 3 beta distributions

2011-10-02 Thread Nitin Bhardwaj
Hi, I want to fit 3 beta distributions to my data which ranges between 0 and 1. What are the functions that I can easily call and specify that 3 beta distributions should be fitted? I have already looked at normalmixEM and fitdistr but they dont seem to be applicable (normalmixEM is only for

[R] deSolve - Function daspk on DAE system - Error

2011-10-02 Thread Vince
I'm getting this error on the attached code and breaking my head but can't figure it out. Any help is much appreciated. Thanks, Vince CODE: library(deSolve) Res_DAE=function(t, y, dy, pars) { with(as.list(c(y, dy, pars)), { res1 = -dS -dES-k2*ES res2 = -dP + k2*ES eq1 = Eo-E -ES

Re: [R] Entering data into a multi-way array?

2011-10-02 Thread Victoria_Stuart
I am trying to replicate the script, appended below. My data is in OOCalc files. The script (below) synthesizes a dataset (it serves as a tutorial), but I will need to get my data from OOCalc into R for use in that script (which uses arrays). I've worked my way through the script, and

Re: [R] Poor performance of Optim

2011-10-02 Thread yehengxin
Thank you for your response! But the problem is when I estimate a model without knowing the true coefficients, how can I know which reltol is good enough? 1e-8 or 1e-10? Why can commercial packages automatically determine the right reltol but R cannot? -- View this message in context:

Re: [R] Poor performance of Optim

2011-10-02 Thread yehengxin
What I tried is just a simple binary probit model. Create a random data and use optim to maximize the log-likelihood function to estimate the coefficients. (e.g. u = 0.1+0.2*x + e, e is standard normal. And y = (u 0), y indicating a binary choice variable) If I estimate coefficient of x, I

[R] Multivariate Laplace density

2011-10-02 Thread zerfetzen
Can anyone show how to calculate a multivariate Laplace density? Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Multivariate-Laplace-density-tp3864072p3864072.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Poor performance of Optim

2011-10-02 Thread yehengxin
Oh, I think I got it. Commercial packages limit the number of decimals shown. -- View this message in context: http://r.789695.n4.nabble.com/Poor-performance-of-Optim-tp3862229p3864271.html Sent from the R help mailing list archive at Nabble.com.

[R] plot: how to fix the ratio of the plot box?

2011-10-02 Thread Hofert Jan Marius
Dear all, this should be trivial, but I couldn't figure out how to solve it... I would like to have a plot with fixed aspect ratio of 1. Whenever I resize the Quartz window, the axes are extended so that the plot fills the whole window. However, if you have different extensions for the

Re: [R] Poor performance of Optim

2011-10-02 Thread Daniel Malter
Ben Bolker sent me a private email rightfully correcting me that was factually wrong when I wrote that ML /is/ a numerical method (I had written sloppily and under time pressure). He is of course right to point out that not all maximum likelihood estimators require numerical methods to solve.

Re: [R] Poor performance of Optim

2011-10-02 Thread Daniel Malter
And there I caught myself with the next blooper: it wasn't Ben Bolker, it was Bert Gunter who pointed that out. :) Daniel Malter wrote: Ben Bolker sent me a private email rightfully correcting me that was factually wrong when I wrote that ML /is/ a numerical method (I had written sloppily

[R] Ipad on R

2011-10-02 Thread Oscar Ramírez
It is possible to install R on Ipad 2? -- Oscar Ramírez A. Universidad Nacional, Escuela de Ciencias Biológicas. M.Sc. en Conservación y Manejo de Vida Silvestre osorami...@gmail.com [[alternative HTML version deleted]] __

Re: [R] plot: how to fix the ratio of the plot box?

2011-10-02 Thread Jim Lemon
On 10/02/2011 07:20 PM, Hofert Jan Marius wrote: Dear all, this should be trivial, but I couldn't figure out how to solve it... I would like to have a plot with fixed aspect ratio of 1. Whenever I resize the Quartz window, the axes are extended so that the plot fills the whole window.

Re: [R] plot: how to fix the ratio of the plot box?

2011-10-02 Thread Hofert Jan Marius
ahh, perfect, thanks. Cheers, Marius On 2011-10-02, at 13:08 , Jim Lemon wrote: On 10/02/2011 07:20 PM, Hofert Jan Marius wrote: Dear all, this should be trivial, but I couldn't figure out how to solve it... I would like to have a plot with fixed aspect ratio of 1. Whenever I resize the

Re: [R] Ipad on R

2011-10-02 Thread Sarah Goslee
2011/10/2 Oscar Ramírez osorami...@gmail.com: It is possible to install R on Ipad 2? This discussion predates the iPad 2, but the licensing restrictions likely still apply: http://www.r-statistics.com/2010/06/could-we-run-a-statistical-analysis-on-iphoneipad-using-r/ One-word answer: no.

[R] subset in dataframes

2011-10-02 Thread Cecilia Carmo
I need help in subseting a dataframe: data1-data.frame(year=c(2001,2002,2003,2004,2001,2002,2003,2004, 2001,2002,2003,2004,2001,2002,2003,2004), firm=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4),x=c(11,22,-32,25,-26,47,85,98, 101,14,87,56,12,43,67,54),

Re: [R] subset in dataframes

2011-10-02 Thread Sarah Goslee
Hi, On Sun, Oct 2, 2011 at 7:48 AM, Cecilia Carmo cecilia.ca...@ua.pt wrote: I need help in subseting a dataframe: data1-data.frame(year=c(2001,2002,2003,2004,2001,2002,2003,2004, 2001,2002,2003,2004,2001,2002,2003,2004),

[R] Difference between ~lp() or simply ~ in R's locfit?

2011-10-02 Thread László Sándor
As I think it is not spam but helpful, let me repeat my stats.stackexchange.com question here, from http://stats.stackexchange.com/questions/16346/difference-between-lp-or-simply-in-rs-locfit I am not sure I see the difference between different examples for local logistic regression in the

Re: [R] Fitting 3 beta distributions

2011-10-02 Thread Achim Zeileis
On Sat, 1 Oct 2011, Nitin Bhardwaj wrote: Hi, I want to fit 3 beta distributions to my data which ranges between 0 and 1. What are the functions that I can easily call and specify that 3 beta distributions should be fitted? I have already looked at normalmixEM and fitdistr but they dont seem to

Re: [R] subset in dataframes

2011-10-02 Thread Cecilia Carmo
Thank you very much. My dataframe has thousands of firms, how can I delete all of those with x0 and keep another dataframe with firms where all x0? Thank you again. Cecília Carmo (Universidade de Aveiro - Portugal) -Mensagem original- De: Sarah Goslee [mailto:sarah.gos...@gmail.com]

Re: [R] subset in dataframes

2011-10-02 Thread Sarah Goslee
Hi, On Sun, Oct 2, 2011 at 9:08 AM, Cecilia Carmo cecilia.ca...@ua.pt wrote: Thank you very much. My dataframe has thousands of firms, how can I delete all of those with x0 and keep another dataframe with firms where all x0? How does that differ from your original question? What doesn't work

Re: [R] subset in dataframes

2011-10-02 Thread Cecilia Carmo
Sarah, Sorry for being ignorant. I was doing something wrong. It works perfectly. Thank you. Cecília Carmo -Mensagem original- De: Sarah Goslee [mailto:sarah.gos...@gmail.com] Enviada: domingo, 2 de Outubro de 2011 14:21 Para: Cecilia Carmo Cc: r-help@r-project.org Assunto: Re: [R]

Re: [R] Overlapping plot in lattice

2011-10-02 Thread Kang Min
Thanks Gabor, that was exactly what I needed. On Sep 30, 9:00 pm, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Fri, Sep 30, 2011 at 3:01 AM, Kang Min ngokang...@gmail.com wrote: Hi all, I was wondering if there's an equivalent to par(new=T) of the plot function in lattice. I'm

[R] Arimax First-Order Transfer Function

2011-10-02 Thread David Humphreys
Dear list members, I am a (very) recent convert to R and I am hoping you can help me with a problem I'm having. I'm trying to fit a first-order transfer function to an ARIMA intervention analysis using the arimax function. The data was obtained from McCleary Hay (1980) (via Rob Hyndman's Time

[R] Find all duplicate records

2011-10-02 Thread Erik Svensson
Hello, In a data frame I want to identify ALL duplicate IDs in the example to be able to examine OS and time. (df-data.frame(ID=c(userA, userB, userA, userC), OS=c(Win,OSX,Win, Win64), time=c(12:22,23:22,04:44,12:28))) IDOS time 1 userA Win 12:22 2 userB OSX 23:22 3 userA Win

Re: [R] Find all duplicate records

2011-10-02 Thread Uwe Ligges
On 02.10.2011 16:05, Erik Svensson wrote: Hello, In a data frame I want to identify ALL duplicate IDs in the example to be able to examine OS and time. (df-data.frame(ID=c(userA, userB, userA, userC), OS=c(Win,OSX,Win, Win64), time=c(12:22,23:22,04:44,12:28))) IDOS time 1

Re: [R] Poor performance of Optim

2011-10-02 Thread Ravi Varadhan
Hi, You really need to study the documentation of optim carefully before you make broad generalizations. There are several algorithms available in optim. The default is a simplex-type algorithm called Nelder-Mead. I think this is an unfortunate choice as the default algorithm. Nelder-Mead

[R] generating Venn diagram with 6 sets

2011-10-02 Thread Mao Jianfeng
Dear r-helpers, Here I would like to have your kind helps on generating Venn diagram. There are some packages within R on this task, like venneuler, VennDiagram, vennerable. But, vennerable can not be installed on my Mac book. It seems VennDiagram can not work on my data. And, venneuler may have

[R] regarding specifying criteria for Cointegration

2011-10-02 Thread upananda pani
Dear All, I am learning R and Time Series Econometrics for the first time. I have doubt regarding cointegration specification criteria. The problem follows: test1 - ca.jo(data1,ecdet=const,type=trace,K=2,spec=transitory)---When to specify transitory test1 -

Re: [R] error while using shapiro.test()

2011-10-02 Thread Peter Ehlers
On 2011-10-01 09:24, spicymchaggis101 wrote: Thank you very much! your response solved my issue. I needed to determine the probability of normality for word types per page. You may want to review just what the test does. It certainly does not give you the 'probability of normality'. A

Re: [R] On-line machine learning packages?

2011-10-02 Thread Jason Edgecombe
Hello Jay, Did you find the answer to your question on incremental machine learning? If not, I found some links that might help: It appears that might be able to do streaming/incremental machine learning in Weka: http://moa.cs.waikato.ac.nz/details/classification/using-weka/ On the above

Re: [R] On-line machine learning packages?

2011-10-02 Thread Steve Lianoglou
Hi Jay, I see this thread is a bit (ok, quite) old at this point, but I see you never really got an answer to your question that was satisfactory. I figured you might be interested to know that Dirk has started to wrap vowpal wabbit[1,2] into an R package, RVowpalWabbit[3,4] The package itself

Re: [R] Keep ALL duplicate records

2011-10-02 Thread Pete Brecknock
Erik Svensson wrote: Hello, In a data frame I want to identify ALL duplicate IDs in the example to be able to examine OS and time. (df-data.frame(ID=c(userA, userB, userA, userC), OS=c(Win,OSX,Win, Win64), time=c(12:22,23:22,04:44,12:28))) IDOS time 1 userA Win 12:22

[R] difference between createPartition and createfold functions

2011-10-02 Thread bby2103
Hello, I'm trying to separate my dataset into 4 parts with the 4th one as the test dataset, and the other three to fit a model. I've been searching for the difference between these 2 functions in Caret package, but the most I can get is this-- A series of test/training partitions are

Re: [R] Is the output of survfit.coxph survival or baseline survival?

2011-10-02 Thread Thomas Lumley
On Sat, Oct 1, 2011 at 2:31 PM, koshihaku koshih...@gmail.com wrote: Dear all, I am confused with the output of survfit.coxph. Someone said that the survival given by summary(survfit.coxph) is the baseline survival S_0, but some said that is the survival S=S_0^exp{beta*x}. Which one is

Re: [R] Advice on approach to weighting survey

2011-10-02 Thread Thomas Lumley
On Sat, Oct 1, 2011 at 4:59 AM, Farley, Robert farl...@metro.net wrote: I'm about to add weights to a bus on-board survey dataset with ~150 variables and ~28,000 records.  My intention is to weight (for each bus run) by boarding stop and alighting stop.  I've seen the Rake function of the

Re: [R] difference between createPartition and createfold functions

2011-10-02 Thread Steve Lianoglou
Hi, On Sun, Oct 2, 2011 at 2:47 PM, bby2...@columbia.edu wrote: Hello, I'm trying to separate my dataset into 4 parts with the 4th one as the test dataset, and the other three to fit a model. I've been searching for the difference between these 2 functions in Caret package, but the most I

[R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Kerry
I have 3 columns of data and want to plot each row as a point in a scatter plot and want one column to be represented as a color gradient (e.g. larger values being more red). Anyone know the command or package for this? Thanks, KB __

Re: [R] is member

2011-10-02 Thread Alaios
Dear all, I would like to thank you for you answers This worked for me Browse[1] match(Test,seq(1,C,FrN),nomatch=FALSE)   [1]   1   0   2   3   0   0   4   0   0   5   0   0   6   7   0   0   8   0  [19]   0   9   0  10  11   0   0  12   0   0  13  14   0  15   0  16   0   0  [37]  17  18  19   0 

Re: [R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Tal Galili
Here is one: http://cran.r-project.org/web/packages/scatterplot3d/index.html In the future, consider first searching: http://finzi.psych.upenn.edu/search.html http://rseek.org/ etc... Contact Details:--- Contact me:

Re: [R] difference between createPartition and createfold functions

2011-10-02 Thread bby2103
Hi Steve, Thanks for the note. I did try the example and the result didn't make sense to me. For splitting a vector, what you describe is a big difference btw them. For splitting a dataframe, I now wonder if these 2 functions are the wrong choices. They seem to split the columns, at

Re: [R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Duncan Murdoch
On 11-10-02 1:11 PM, Kerry wrote: I have 3 columns of data and want to plot each row as a point in a scatter plot and want one column to be represented as a color gradient (e.g. larger values being more red). Anyone know the command or package for this? It's not a particularly effective

Re: [R] R Studio and Rcmdr/RcmdrPlugins

2011-10-02 Thread Tal Galili
Hi Erin, The last I checked - it was not possible. However, the place to ask this is here: http://support.rstudio.org/help/discussions Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me:

Re: [R] difference between createPartition and createfold functions

2011-10-02 Thread Steve Lianoglou
Hi, On Sun, Oct 2, 2011 at 3:54 PM, bby2...@columbia.edu wrote: Hi Steve, Thanks for the note. I did try the example and the result didn't make sense to me. For splitting a vector, what you describe is a big difference btw them. For splitting a dataframe, I now wonder if these 2 functions

Re: [R] error while using shapiro.test()

2011-10-02 Thread csrabak
Em 1/10/2011 13:24, spicymchaggis101 escreveu: Thank you very much! your response solved my issue. I needed to determine the probability of normality for word types per page. You need to insure this assumption is reasonable for your problem domain as words types per page seems like count data

Re: [R] Keep ALL duplicate records

2011-10-02 Thread jim holtman
Here is a function I use to find all duplicate records allDup - function (value) { duplicated(value) | duplicated(value, fromLast = TRUE) } x IDOS time 1 userA Win 12:22 2 userB OSX 23:22 3 userA Win 04:44 4 userC Win64 12:28 x[allDup(x$ID),] ID OS time 1 userA Win

Re: [R] Find all duplicate records

2011-10-02 Thread Gabor Grothendieck
On Sun, Oct 2, 2011 at 10:05 AM, Erik Svensson erik.b.svens...@gmail.com wrote: Hello, In a data frame I want to identify ALL duplicate IDs in the example to be able to examine OS and time. (df-data.frame(ID=c(userA, userB, userA, userC),  OS=c(Win,OSX,Win, Win64),  

Re: [R] difference between createPartition and createfold functions

2011-10-02 Thread Max Kuhn
Basically, createDataPartition is used when you need to make one or more simple two-way splits of your data. For example, if you want to make a training and test set and keep your classes balanced, this is what you could use. It can also make multiple splits of this kind (or leave-group-out CV aka

Re: [R] Is the output of survfit.coxph survival or baseline survival?

2011-10-02 Thread Terry Therneau
Dear all, I am confused with the output of survfit.coxph. Someone said that the survival given by summary(survfit.coxph) is the baseline survival S_0, but some said that is the survival S=S_0^exp{beta*x}. Which one is correct? The ³baseline survival², which is the survival for a

[R] about the array transpose

2011-10-02 Thread venerealdisease
Hi, all, I am a newbie for [R] Would anyone help me how to transpose a 3x3x3 array for 1:27 Eg. A-array(1:27, c(3,3,3) What is the logic to transpose it to B-aperm(A, c(3,2,1)) Because I found I could not imagine how it transposes, anyone could solve my problem? And most important I could get

Re: [R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Kerry
Yes, perfect! This I can work with. Thanks, KB On Oct 2, 3:55 pm, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 11-10-02 1:11 PM, Kerry wrote: I have 3 columns of data and want to plot each row as a point in a scatter plot and want one column to be represented as a color gradient

[R] patients.txt data

2011-10-02 Thread Nadine Melhem
please send me the patients.txt data. thanks. __ R-help@r-project.org 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,

[R] patients.txt data

2011-10-02 Thread Melhem, Nadine
I'm new to learning R. I'm taking a course and will need access to the patients.txt data to be able to do the exercises required using this dataset. thanks. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Scatterplot with the 3rd dimension = color?

2011-10-02 Thread Ben Bolker
Duncan Murdoch murdoch.duncan at gmail.com writes: On 11-10-02 1:11 PM, Kerry wrote: I have 3 columns of data and want to plot each row as a point in a scatter plot and want one column to be represented as a color gradient (e.g. larger values being more red). Anyone know the command or

[R] rolling regression

2011-10-02 Thread Darius H
Dear all, I have spent the last few days on a seemingly simple and previously documented rolling regression. I have a 60 year data set organized in a ts matrix. The matrix has 5 columns; cash_ret, epy1, ism1, spread1, unemp1 I have been able to come up with the following based on previous

Re: [R] patients.txt data

2011-10-02 Thread Steve Lianoglou
Hi, On Sun, Oct 2, 2011 at 4:31 PM, Melhem, Nadine mel...@upmc.edu wrote: I'm new to learning R. I'm taking a course and will need access to the patients.txt data to be able to do the exercises required using this dataset. Without more context, I'm doubtful that anybody will be able to help

[R] How to format R superscript 2 followed by = value

2011-10-02 Thread Nevil Amos
I am trying to put an R2 value with R2 formatted with a superscript 2 followed by = and the value : the first mtext prints the R2 correctly formatted but follows it with =round(summary(mylm)$r.squared,3))) as text the second prints R^2 = followed by the value of

[R] function recode within sapply

2011-10-02 Thread Lara Poplarski
Dear List, I am using function recode, from package car, within sapply, as follows: L3 - LETTERS[1:3] (d - data.frame(cbind(x = 1, y = 1:10), fac1 = sample(L3, 10, replace=TRUE), fac2 = sample(L3, 10, replace=TRUE), fac3 = sample(L3, 10, replace=TRUE))) str(d) d[, c(fac1, fac2)] - sapply(d[,

Re: [R] How to format R superscript 2 followed by = value

2011-10-02 Thread Joshua Wiley
Hi Nevil, Here is one option: ## function definition r2format - function(object, digits = 3, output, sub, expression = TRUE, ...) { if (inherits(object, lm)) { x - summary(object) } else if (inherits(object, summary.lm)) { x - object } else

Re: [R] function recode within sapply

2011-10-02 Thread Joshua Wiley
Hi Lara, Use lapply here instead of sapply or specify simplify = FALSE. See ?sapply for details. d[, c(fac1, fac2)] - lapply(d[, c(fac1, fac2)], recode, c('A', 'B') = 'XX', as.factor.result = TRUE) d[, fac3] - recode(d[, fac3], c('A', 'B') = 'XX') str(d) Cheers, Josh On Sun, Oct 2, 2011 at