Re: [R] How can I fixe convergence=1 in optim

2010-09-04 Thread Ben Bolker
Peng, C gmail.com> writes: > > > To change the default maximum number of iterations (mxit =100 for derivative > based algorithm), add mxit = whatever number you want. > that's "maxit" i.e. optim(...,control=list(maxit=...)) __ R-help@r-project.

Re: [R] simple ts() object question

2010-09-04 Thread Joshua Wiley
Hi, There is probably an easier way, but this will work: ta[time(ta)==1965] With your data, I get: > ta[time(ta)==1965] [1] 6 HTH, Josh On Sat, Sep 4, 2010 at 9:08 PM, StatWM wrote: > > Dear Community, > > say, I have an annual ts() object sampled from 1960 to 1969 like: > > ta<-ts(1:10, s

Re: [R] simple ts() object question

2010-09-04 Thread Gabor Grothendieck
On Sun, Sep 5, 2010 at 12:08 AM, StatWM wrote: > > Dear Community, > > say, I have an annual ts() object sampled from 1960 to 1969 like: > > ta<-ts(1:10, start=1960, frequency=1) > > How can I extract the value from the year 1965? > > I mean, not by: > > ta[6] > > but by something like: > > ta[196

[R] simple ts() object question

2010-09-04 Thread StatWM
Dear Community, say, I have an annual ts() object sampled from 1960 to 1969 like: ta<-ts(1:10, start=1960, frequency=1) How can I extract the value from the year 1965? I mean, not by: ta[6] but by something like: ta[1965] where I'm directly referring to the year of the observation? Thank

Re: [R] How can I fixe convergence=1 in optim

2010-09-04 Thread Peng, C
To change the default maximum number of iterations (mxit =100 for derivative based algorithm), add mxit = whatever number you want. In most cases, you need a very good initial value! This is a real challenge in using optim(). Quite often, if the initial values is not well selected, optim() can gi

Re: [R] Please explain "do.call" in this context, or critique to "stack this list faster"

2010-09-04 Thread Hadley Wickham
> One common way around this is to pre-allocate memory and then to > populate the object using a loop, but a somewhat easier solution here > turns out to be ldply() in the plyr package. The following is the same > idea as do.call(rbind, l), only faster: > >> system.time(u3 <- ldply(l, rbind)) >   u

Re: [R] how to free memory? (gc() doesn't work for me)

2010-09-04 Thread Hyunchul Kim
Hi, all Thank you for your comments. I think that I misunderstood what gc() does because gc() is working as you posted. I posted my question because gc() doesn't reduce memory in use in a few system memory monitoring tools that I tested. Regards, Hyunchul On Sat, Sep 4, 2010 at 8:50 PM, jim ho

Re: [R] How can I fixe convergence=1 in optim

2010-09-04 Thread David Winsemius
On Sep 4, 2010, at 4:18 PM, Sally Luo wrote: Hi R users, I am using the optim funciton to maximize a log likelihood function. My code is as follows: p<-optim(c(-0.2392925,0.4653128,-0.8332286, 0.0657, -0.0031, -0.00245, 3.366, 0.5885, -0.8, 0.0786,-0.00292,-0.00081, 3

Re: [R] Query regarding Windows based statistical software development using R as programming language

2010-09-04 Thread C.H.
Have a look at deducer. http://www.deducer.org/manual.html On Sat, Sep 4, 2010 at 12:20 PM, Soumen Pal wrote: > Hi, > > I am a beginner in R. I have a query as below: > > Is it possible to develop a Windows based statistical software > (user-friendly) like SPSS using R as a programming languag

Re: [R] Function Gini or Ineq

2010-09-04 Thread Karen Kotschy
Hi Marcio You might like to look at some equivalents from the field of ecology, for which there are existing functions. Have a look at the function "diversity" in the package "vegan". This provides the Simpson diversity index, which is the complement of the Gini coefficient (Gini = 1 - Simpson

[R] How can I fixe convergence=1 in optim

2010-09-04 Thread Sally Luo
Hi R users, I am using the optim funciton to maximize a log likelihood function. My code is as follows: p<-optim(c(-0.2392925,0.4653128,-0.8332286, 0.0657, -0.0031, -0.00245, 3.366, 0.5885, -0.8, 0.0786,-0.00292,-0.00081, 3.266, -0.3632, -0.49,0.1856, 0.00394, -0.00193

[R] How to use prediction

2010-09-04 Thread James
Hi, I have a question regarding the usage of prediction in R: I have an input data set X, and an output data set Y, I can build up the correlation between them using kcca() of kernlab, but after I have that correlation, how can I predict the output Y1 of a new input X1? I read about the gausspr(

Re: [R] Linear Logistic Regression - Understanding the output (and possibly the test to use!)

2010-09-04 Thread David Winsemius
On Sep 4, 2010, at 6:53 PM, st...@wittongilbert.free-online.co.uk wrote: Hi I know asking which test to use is frowned upon on this list... so please do read on for at least a couple on sentences... I have some multivariate data slit as follows Tumour Site (one of 5 categories) # Chemo Sche

Re: [R] Levels in returned data.frame after subset

2010-09-04 Thread Greg Snow
The advantage of computers is that they do exactly what they are told. The disadvantage of computers is that they do exactly what they are told. R is a set of instructions to the computer, those instructions are a combinations from the original programmers and from you. Who should make importan

Re: [R] Query regarding Windows based statistical software development using R as programming language

2010-09-04 Thread Greg Snow
I am not sure how best to answer your question since the phrases "user-friendly" and "like SPSS" do not belong in the same sentence in my mind (unless separated by a word along the lines of "unlike"). And "Windows Based Programming Language" feels a bit like an oxymoron. But since the R Comman

[R] Linear Logistic Regression - Understanding the output (and possibly the test to use!)

2010-09-04 Thread stats
Hi I know asking which test to use is frowned upon on this list... so please do read on for at least a couple on sentences... I have some multivariate data slit as follows Tumour Site (one of 5 categories) # Chemo Schedule (one of 3 cats) ## Cycle (one of 3 cats*) ## Dose (one of 3 cats*) # *T

Re: [R] non-zero exit status error when install GenomeGraphs

2010-09-04 Thread Martin Morgan
On 09/04/2010 01:38 PM, David Winsemius wrote: > (Caveat: I am not a bioc user.) The error messages suggest that you > are missing dependencies. I looked at the documentation for > GenomeGraphs and it does not list any dependencies, but I have no way > of knowing how careful > packageDescription("

Re: [R] Please explain "do.call" in this context, or critique to "stack this list faster"

2010-09-04 Thread Dennis Murphy
Hi: Here's my test: l <- vector('list', 1000) for(i in seq_along(l)) l[[i]] <- data.frame(x=rnorm(100),y=rnorm(100)) system.time(u1 <- do.call(rbind, l)) user system elapsed 0.490.060.60 resultDF <- data.frame() system.time(for (i in 1:1000) resultDF <- rbind(resultDF, l[[i]]))

Re: [R] Please explain "do.call" in this context, or critique to "stack this list faster"

2010-09-04 Thread Gabor Grothendieck
On Sat, Sep 4, 2010 at 2:37 PM, Paul Johnson wrote: > I've been doing some consulting with students who seem to come to R > from SAS.  They are usually pre-occupied with do loops and it is tough > to persuade them to trust R lists rather than keeping 100s of named > matrices floating around. > > O

Re: [R] Please explain "do.call" in this context, or critique to "stack this list faster"

2010-09-04 Thread David Winsemius
Paul; There is another group of functions that are similar to do.call in their action of serial applications of a function to a list or vector. They are somewhat more tolerant in that dyadic operators can be used as the function argument, whereas do.call is really just expanding the secon

Re: [R] Decision Tree in Python or C++?

2010-09-04 Thread Wensui Liu
for python, please check http://onlamp.com/pub/a/python/2006/02/09/ai_decision_trees.html On Sat, Sep 4, 2010 at 11:21 AM, noclue_ wrote: > > > Have anybody used Decision Tree in Python or C++?  (or written their own > decision tree implementation in Python or C++)?  My goal is to run decision >

Re: [R] How to generate integers from uniform distribution with

2010-09-04 Thread Ted Harding
On 04-Sep-10 19:27:54, Yi wrote: > Enh, I see. > It totally makes sense. > Thank you for your perfect explanation. > Enjoy the long weekend~ > Yi You're welcome! Earlier I tried an experiment with rejection sampling, which seems to work well for the case where you want mean of the sampled values t

Re: [R] Please explain "do.call" in this context, or critique to "stack this list faster"

2010-09-04 Thread Joshua Wiley
To echo what Erik said, the second argument of do.call(), arg, takes a list of arguments that it passes to the specified function. Since rbind() can bind any number of data frames, each dataframe in mylist is rbind()ed at once. These two calls should take about the same time (except for time save

Re: [R] non-zero exit status error when install GenomeGraphs

2010-09-04 Thread David Winsemius
(Caveat: I am not a bioc user.) The error messages suggest that you are missing dependencies. I looked at the documentation for GenomeGraphs and it does not list any dependencies, but I have no way of knowing how careful or knowledgeable the authors may or may not have bben when they compos

[R] non-zero exit status error when install GenomeGraphs

2010-09-04 Thread chen chao
Hi, I am trying to install GenomeGraphs package from bioconductor, but failed by a non-zero exit error. From the error message, it seems that there is a shared library problem. Any suggestion on fixing it? Thanks so much. > sessionInfo() R version 2.10.1 (2009-12-14) x86_64-unknown-linux-gnu loc

Re: [R] What solve() does?

2010-09-04 Thread David Winsemius
On Sep 4, 2010, at 2:29 PM, Petar Milin wrote: Thank you so much! This is very useful! Any thoughts about how to run Gaussian elimination? Do some searching? RSiteSearch("gaussian elimination", restrict = c("Rhelp10", "Rhelp08", "Rhelp02", "functions" ) ) returns (among other thing

Re: [R] Save data as .pdf or .JPG

2010-09-04 Thread lanczos
On Sat, 2010-09-04 at 13:57 -0500, Paul Johnson wrote: On Wed, Sep 1, 2010 at 7:56 AM, khush wrote: > > Hi all , > > > > I have following script to plot some data. > > > > plot( c(1,1100), c(0,15), type='n', xlab='', ylab='', ylim=c(0.1,25) , > > las=2) > > axis (1, at = seq(0,1100,50), l

Re: [R] Save data as .pdf or .JPG

2010-09-04 Thread Paul Johnson
On Wed, Sep 1, 2010 at 7:56 AM, khush wrote: > Hi all , > > I have following script to plot some data. > > plot( c(1,1100), c(0,15), type='n', xlab='', ylab='', ylim=c(0.1,25) , > las=2) > axis (1, at = seq(0,1100,50), las =2) > axis (2, at = seq(0,25,1), las =2) >> > When I source("scrip

Re: [R] Please explain "do.call" in this context, or critique to "stack this list faster"

2010-09-04 Thread Erik Iverson
On 09/04/2010 01:37 PM, Paul Johnson wrote: I've been doing some consulting with students who seem to come to R from SAS. They are usually pre-occupied with do loops and it is tough to persuade them to trust R lists rather than keeping 100s of named matrices floating around. Often it happens th

[R] Please explain "do.call" in this context, or critique to "stack this list faster"

2010-09-04 Thread Paul Johnson
I've been doing some consulting with students who seem to come to R from SAS. They are usually pre-occupied with do loops and it is tough to persuade them to trust R lists rather than keeping 100s of named matrices floating around. Often it happens that there is a list with lots of matrices or da

Re: [R] What solve() does?

2010-09-04 Thread Petar Milin
Thank you so much! This is very useful! Any thoughts about how to run Gaussian elimination? Best, PM On 04/09/10 20:23, Paul Johnson wrote: On Wed, Sep 1, 2010 at 5:36 AM, Petar Milin wrote: Hello! Can anyone explain me what solve() function does: Gaussian elimination or iterative, numeri

Re: [R] What solve() does?

2010-09-04 Thread Paul Johnson
On Wed, Sep 1, 2010 at 5:36 AM, Petar Milin wrote: > Hello! > Can anyone explain me what solve() function does: Gaussian elimination or > iterative, numeric solve? In addition, I would need both the Gaussian > elimination and iterative solution for the course. Are the two built in R? > > Thanks!

Re: [R] Function try and Results of a program

2010-09-04 Thread David Winsemius
On Sep 4, 2010, at 12:41 PM, Evgenia wrote: David, your suggestion about try works perfect for me. I still have a problem with sink. Could you explain me better your suggestion? When you sink to a file, you will continue sending console output to that file until you issue sink(). And e

Re: [R] Function try and Results of a program

2010-09-04 Thread Evgenia
David, your suggestion about try works perfect for me. I still have a problem with sink. Could you explain me better your suggestion? Thanks alot Evgenia -- View this message in context: http://r.789695.n4.nabble.com/Function-try-and-Results-of-a-program-tp2526621p2526822.html Sent from th

[R] Decision Tree in Python or C++?

2010-09-04 Thread noclue_
Have anybody used Decision Tree in Python or C++? (or written their own decision tree implementation in Python or C++)? My goal is to run decision tree on 8 million obs as training set and score 7 million in test set. I am testing 'rpart' package on a 64-bit-Linux + 64-bit-R environment. But

Re: [R] Function try and Results of a program

2010-09-04 Thread David Winsemius
On Sep 4, 2010, at 6:10 AM, Evgenia wrote: Hello, users. Dear users, ***I have a function f to simulate data from a model (example below used only to show my problems) f<-function(n,mean1){ a<-matrix(rnorm(n, mean1 , sd = 1),ncol=5) b<-matrix(runif(n),ncol=5) data<-rbind(a,b) out<-da

[R] A basic question in model/formula specification

2010-09-04 Thread telm8
Hi, I am currently trying to fit a multinomial logit model on my data. I have tried to search for some example, and this is the one that I followed and worked. http://www.ats.ucla.edu/stat/r/dae/mlogit.htm However, I am having difficulties finding out the meaning of the model specified in the

[R] Luis Miguel Delgado Gomez/BBK está ausente d e la oficina.

2010-09-04 Thread Luis Miguel Delgado Gomez
Estaré ausente de la oficina desde el 03/09/2010 y no volveré hasta el 11/10/2010. Responderé a su mensaje cuando regrese. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] tail.matrix returns matrix, while tail.mts return vector

2010-09-04 Thread Ista Zahn
Hi Mat, You might be able to use the matrix method to get what you want. head.matrix(EuStockMarkets) -Ista On Sat, Sep 4, 2010 at 1:15 PM, mat wrote: > Hi > > I have a few problems with tail/head when applied to multiple time series. > I'm not sure as whether I did not understand the function o

Re: [R] Levels in returned data.frame after subset

2010-09-04 Thread Ista Zahn
Hi Ulrik On Sat, Sep 4, 2010 at 12:52 PM, Ulrik Stervbo wrote: > Dear List, > > When I subset a data.frame, the levels are not re-adjusted (see > example). Why is this? Am I missing out on some basic stuff here? Only that this issue has come up many times before, and that this list is archived a

[R] tail.matrix returns matrix, while tail.mts return vector

2010-09-04 Thread mat
Hi I have a few problems with tail/head when applied to multiple time series. I'm not sure as whether I did not understand the function or whether it correspond to an unexpected behavior. When head(a,n) is applied on data.frame or matrix, it returns a data-frame or matrix with first n obs of

Re: [R] return from .Call()

2010-09-04 Thread Barry Rowlingson
On Sat, Sep 4, 2010 at 10:17 AM, raje...@cse.iitm.ac.in wrote: > > Hi, > > I have a .Call in my R function in a loop that repeats a certain number of > times. Each time, the .Call returns a list. So, when I say something like, > > y<-func() > > would y be a list of lists?(as many as the number of

[R] Levels in returned data.frame after subset

2010-09-04 Thread Ulrik Stervbo
Dear List, When I subset a data.frame, the levels are not re-adjusted (see example). Why is this? Am I missing out on some basic stuff here? Thanks Ulrik > m <- data.frame(gender = c("M", "M","F"), ht = c(172, 186.5, 165), wt = > c(91,99, 74)) > dim(m) [1] 3 3 > levels(m$gender) [1] "F" "M"

Re: [R] how to free memory? (gc() doesn't work for me)

2010-09-04 Thread jim holtman
Seems to work for me: > x <- matrix(0,1,1) > object.size(x) 80112 bytes > gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells174104 4.7 741108 19.8741108 19.8 Vcells 101761938 776.4 113632405 867.0 102762450 784.1 > rm(x) > gc() used (Mb) gc t

[R] limit on read.socket?

2010-09-04 Thread raje...@cse.iitm.ac.in
Hi, I have the following piece of code, repeat{ ss<-read.socket(sockfd); if(ss=="") break output<-paste(output,ss) } but somehow, output is not receiving all the data that is coming through the socket.My suspicion is on the if statement. what happens if a white space occurs in between the st

[R] return from .Call()

2010-09-04 Thread raje...@cse.iitm.ac.in
Hi, I have a .Call in my R function in a loop that repeats a certain number of times. Each time, the .Call returns a list. So, when I say something like, y<-func() would y be a list of lists?(as many as the number of loops?) [[alternative HTML version deleted]] ___

Re: [R] R program google search

2010-09-04 Thread Duncan Temple Lang
Hi there One way to use Google's search service from R is libary(RCurl) library(RJSONIO) # or library(rjson) val = getForm("http://ajax.googleapis.com/ajax/services/search/web";, q = "Google search AJAX ", v = "1.0") results = fromJSONIO(val) Google requests that you provide your GoogleAPI ke

[R] Function try and Results of a program

2010-09-04 Thread Evgenia
Hello, users. Dear users, ***I have a function f to simulate data from a model (example below used only to show my problems) f<-function(n,mean1){ a<-matrix(rnorm(n, mean1 , sd = 1),ncol=5) b<-matrix(runif(n),ncol=5) data<-rbind(a,b) out<-data out} *I want to simulate 1000 datasets

Re: [R] How to generate integers from uniform distribution with

2010-09-04 Thread Ted Harding
There is still ambiguity (and I think some misunderstanding) in your query! First, Barry's code does yield integers as the values in the sample. As a smaller illustrative example: x <- sample(17:23,20,TRUE) will give results like x # [1] 21 17 23 21 17 17 19 18 17 17 17 22 20 23 20 20 18 2

Re: [R] How to generate integers from uniform distribution with fixed mean

2010-09-04 Thread Barry Rowlingson
On Sat, Sep 4, 2010 at 8:07 AM, Yi wrote: > Sorry I forgot to talk about the range. > > But as an example, range (17,23) works. > > In your codes, mean is not exactly 20 and the samples are not integer. The samples *are* integers. sample(17:23,1,TRUE) returns integers. > However, what I wan

Re: [R] How to generate integers from uniform distribution with fixed mean

2010-09-04 Thread Yi
Sorry I forgot to talk about the range. But as an example, range (17,23) works. In your codes, mean is not exactly 20 and the samples are not integer. However, what I want is integers with mean 20 exactly. Any tips? Thanks On Thu, Sep 2, 2010 at 12:16 AM, Barry Rowlingson < b.rowling...@lancas