Re: [R] logistic growth model

2011-06-06 Thread Rubén Roa
Write the growth formula in an R script. Define initial par values. Input the size and age data. Plot the size and age data as points. Plot the growth model with the initial par values as a line. Play with the initial par values until you see a good agreement between the model (the line) and the

Re: [R] Can R do zero inflated gamma regression?

2011-06-06 Thread Ben Bolker
siriustar live.cn> writes: > > Hi, Dear R-help > I know there are some R package to deal with zero-inflated count data. But I > am now looking for R package to deal with zero-inflated continuous data. > > The response variable (Y) in my dataset contains a larger mount of zero and > the Non-zero

Re: [R] Question about curve function

2011-06-06 Thread Prof Brian Ripley
As a further example of the trickiness, the "function" method of plot() relies on curve(x, ...) being a request to plot the function x(x) against x. I've added a comment to that effect to the help page. On Mon, 6 Jun 2011, Prof Brian Ripley wrote: On Sun, 5 Jun 2011, Abhilash Balakrishnan wr

Re: [R] Error with BRugs 0.53 and 0.71, on Win7 with R 2.12.2 and 2.13.0 (crashes R GUI)

2011-06-06 Thread Uwe Ligges
On 05.06.2011 23:42, Chris Chapman wrote: Thanks again. FWIW, I tried an even older R version (2.11) + BRugs 0.53 and 0.70 ... but got the same errors as with the iterations reported below. So I'm giving up on trying to solve the issue. My workaround is that I'm using the R2WinBUGS package ins

Re: [R] logistic growth model

2011-06-06 Thread Walmes Zeviani
If you use RStudio (www.rstudio.org) you can find good initial start values by interactive plot using manipulate() function. Look the simple code below. age <- 1:20 k <- 3; b0 <- -5; b1 <- .5 y <- k*exp(b0+b1*age)/(1+exp(b0+b1*age))+rnorm(age,0,0.1) plot(y~age) start <- list() require(manipulate

[R] How to assess the accuracy of fitted logistic regression using glm

2011-06-06 Thread Xiaobo Gu
Hi, I am trying glm with family = binomial to do binary logistic regression, but how can I assess the accuracy of the fitted model, the summary method can print a lot of information about the returned object, such as coefficients, because statistics is not my speciality, so can you share some rule

[R] simulation

2011-06-06 Thread Stat Consult
Dear ALL I want to simulate data from Multivariate normal distribution. GE.N<-mvrnorm(25,mu,S) S <-matrix(rep(0,1),nrow=100) for( i in 1:100){sigma<-runif(100,0.1,10);S [i,i]=sigma[i];mu<-runif(100,0,10)} for (i in 1:20){for (j in 1:20){if (i != j){S [i,j]=0.3*sigma[i]*sigma[j]}}} for (i in 21:

[R] qplot fill and colour not working as expected

2011-06-06 Thread wwreith
I am just learning to use qplot and can't get the fill/colour to work. Below is the R code for a scatter plot and bar graph. library(ggplot2) x<-c(1,2,3,4,5,6,7) y<-c(1,2,3,2,5,6,3) qplot(x,y, main="Scatter Plot Test", xlab="X Label Test", ylab="Y Label Test", colour="blue")z<-c("van", "van", "van

[R] Wireframe, custom x-axis values

2011-06-06 Thread Rbjørn Nicolaisen
Hi, Im plotting some data with wireframe() like so: wireframe(result ~ u * r, myData, scales=list(arrows=FALSE)) However, I would really like to display something different for the displayed values of "u" rather than the actual values. This is because my u-values are a sequence of quantiles of

[R] Not missing at random

2011-06-06 Thread Blaz Simcic
Hello!   I would like to sample 30 % of cases (with at least 1 value lower than 3 - in the row) and among them I want to set all values lower than 3 (within selected cases) as NA (NMAR- Not missing at random). I managed to sample cases, but I don’t know how to set values (lower than 3) as N

[R] Problem in R documentation

2011-06-06 Thread siddharth arun
I am not able to run Dickey-Fuller test. adf.test() function is not working. It is showing 'Error: could not find function "adf.test" Can any tell how to call "time series" library? -- Siddharth Arun, 4th Year Undergraduate student Industrial Engineering and Management, IIT Kharagpur [

Re: [R] Negating two identical characters with regular expressions

2011-06-06 Thread matto in cor
Hello Michael, try strsplit("aa-bb-cc dd", "-{2,}") . This function returns an array with all the strings separated by multiple dashes (at least two). Alternatively if you want the first string only try this: sub("(.*?)--.*", "\\1", "aa-bbcc dd") (note the reluctant quantifier *? ) Hope t

Re: [R] How to assess the accuracy of fitted logistic regression using glm

2011-06-06 Thread Prof Brian Ripley
On Mon, 6 Jun 2011, Xiaobo Gu wrote: Hi, I am trying glm with family = binomial to do binary logistic regression, but how can I assess the accuracy of the fitted model, the summary method can print a lot of information about the returned object, such as coefficients, because statistics is not m

[R] RCurl and kerberos

2011-06-06 Thread TAPO (Thomas Agersten Poulsen)
Dear list, I would like to call a Kerberos-authenticated web-service from within R. Curl can do it: $ curl --negotiate -u : "http://my.web.service/"; so I would expect that RCurl also has the capability, but I have not been able to find the correct options to set. listCurlOptions() does not re

Re: [R] Problem in R documentation

2011-06-06 Thread Sarah Goslee
What operating system are you using? What version of R are you using? How did you install the package in question? Did the installation process give any error messages? Did you load the package before trying to use it? What package are you trying to load - there is no "time series" package. Do you

[R] adding an ellipse to a PCA plot

2011-06-06 Thread Lukas Baitsch
Hi, I created a principal component plot using the first two principal components. I used the function princomp() to calculate the scores. now, I would like to superimpose an ellipse representing the center and the 95% confidence interval of a series of points in my plot (as to illustrate the grou

Re: [R] Problem in R documentation

2011-06-06 Thread Jorge Ivan Velez
Hi Siddharth, adf.test() is part of the "tseries" package, so you need to download and install it before using that function. Try the following and let us now what you get: install.packages('tseries') require(tseries) ?adf.test HTH, Jorge On Mon, Jun 6, 2011 at 2:41 AM, siddharth arun <> wrote

Re: [R] Lasso for k-subset regression

2011-06-06 Thread Steve Lianoglou
Hi, On Sun, Jun 5, 2011 at 9:12 PM, Dae-Jin Lee wrote: > Dear R-users > > I'm trying to use lasso in lars package for subset regression,  I have a > large matrix of size 1000x100 and my aim is to select a subset k of the 100 > variables. > > Is there any way in lars to fix the number k (i.e. to s

Re: [R] qplot fill and colour not working as expected

2011-06-06 Thread Ista Zahn
Hi, On Mon, Jun 6, 2011 at 9:49 AM, wwreith wrote: > I am just learning to use qplot and can't get the fill/colour to work. Below > is the R code for a scatter plot and bar graph. > > library(ggplot2) > x<-c(1,2,3,4,5,6,7) > y<-c(1,2,3,2,5,6,3) > qplot(x,y, main="Scatter Plot Test", xlab="X Label

Re: [R] qplot fill and colour not working as expected

2011-06-06 Thread Jonathan Daily
One difference between colour and fill can be demonstrated by specifying both with different values. In cases where a polygon is filled, colour specifies border line color. On Mon, Jun 6, 2011 at 9:49 AM, wwreith wrote: > I am just learning to use qplot and can't get the fill/colour to work. Belo

Re: [R] shading in overlap between two ranges

2011-06-06 Thread Graves, Gregory
This worked perfectly. An example graphic is located here: ftp://ftp.sfwmd.gov/pub/ggraves/ribbon.bmp -Original Message- From: Dennis Murphy [mailto:djmu...@gmail.com] Sent: Thursday, June 02, 2011 12:11 PM To: Graves, Gregory Cc: r-help@r-project.org; Kemp, Susan K SAJ; patrick_pi...@f

Re: [R] adding an ellipse to a PCA plot

2011-06-06 Thread John Fox
Dear Lukas, You might try the dataEllipse() function in the car package. I hope this helps, John > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Lukas Baitsch > Sent: June-06-11 10:33 AM > To: r-help@r-project.org > Subject:

[R] test cases (data) for data based modeling

2011-06-06 Thread Immanuel B
Hello all, I'm working mostly with machine learning code in R and looking for a structured way to check if my code is working properly. For example if I train a classifier on some data. How do I know if the good / bad results are related to the data are not just an programming error that I introd

[R] How can I write methods for 'as()'?

2011-06-06 Thread Janko Thyson
Dear list, I wonder how to write methods for the function 'as' in the sense that I can call 'as(object, Class, strict=TRUE, ext)' and let method dispatch figure out the correct method. AFAIU, there is a difference between, e.g. 'as.data.frame' and the methods of 'as()' as stated above since th

Re: [R] adding an ellipse to a PCA plot

2011-06-06 Thread Lukas Baitsch
Dear John, Thanks, this actually works just fine! much easier than the ellipse-package! Lukas On Monday, June 6, 2011, John Fox wrote: > Dear Lukas, > > You might try the dataEllipse() function in the car package. > > I hope this helps, >  John > >> -Original Message- >> From: r-help-bo

Re: [R] How can I write methods for 'as()'?

2011-06-06 Thread Janko Thyson
Somehow I don't see my own postings in the list, so sorry for replying to my own message and not the one that went out to the list. I got a little further and I think I found exactly the thing that is bothering me: how to get "extended" method dispatch going in 'setAs()': setRefClass("A", field

Re: [R] simulation

2011-06-06 Thread Petr Savicky
On Mon, Jun 06, 2011 at 04:50:57PM +1000, Stat Consult wrote: > Dear ALL > I want to simulate data from Multivariate normal distribution. > GE.N<-mvrnorm(25,mu,S) > S <-matrix(rep(0,1),nrow=100) > for( i in 1:100){sigma<-runif(100,0.1,10);S > [i,i]=sigma[i];mu<-runif(100,0,10)} > for (i in 1:20

Re: [R] How can I write methods for 'as()'?

2011-06-06 Thread Janko Thyson
Okay, I found something that is working, but it looks and feels pretty awkward as the method def and method lookup takes place in one function ;-) setRefClass("A", fields=list(X="numeric")) setRefClass("B", contains="A", fields=list(Y="character")) mySetAs <- function( from, to ){

Re: [R] Wireframe, custom x-axis values

2011-06-06 Thread Peter Ehlers
On 2011-06-06 06:33, Rbjørn Nicolaisen wrote: Hi, Im plotting some data with wireframe() like so: wireframe(result ~ u * r, myData, scales=list(arrows=FALSE)) However, I would really like to display something different for the displayed values of "u" rather than the actual values. This is be

[R] Seeking help to define method for show() for an S4 object

2011-06-06 Thread Bogaso Christofer
Dear all, I have created a new S4 class with name "MyClass". Please see below for it's definition. Now I want to create a method for the show() function for this class. In defining this method, what I want is, once user would like see an object of this class some values will be displayed. Then R wi

Re: [R] Seeking help to define method for show() for an S4 object

2011-06-06 Thread Joshua Wiley
Hi, Take a look at ?readLines Also, you should use function(object) not function(x) because of how the generic is defined. Below is an example. Cheers, Josh setClass("MyClass", sealed = FALSE, representation( Slot1 = "vector", Slot2 = "vector")) setMethod(f = "show", signature = "MyClass

[R] Question with RExcel

2011-06-06 Thread Maria Helena Mourino Silva Nunes
Dear all, I’m doing some simulation studies in order to compare the estimates (and estimated standard deviations) from the ARMA(2,1) Model with an estimator that I’ve constructed. For carrying out the simulations I created a VBA project within Excel. Now, I’m using the RExcel tool for running th

Re: [R] generating random covariance matrices (with a uniform distribution of correlations)

2011-06-06 Thread Ned Dochtermann
Thank you very much, this does help quite a bit. Ned From: Petr Savicky Date: Sat, 04 Jun 2011 11:44:52 +0200 On Fri, Jun 03, 2011 at 01:54:33PM -0700, Ned Dochtermann wrote: > Petr, > This is the code I used for your suggestion: > > k<-6;kk<-(k*(k-1))/2 > x<-matrix(0,5000,kk) > for(i in 1:5000

Re: [R] Question with RExcel

2011-06-06 Thread Ethan Brown
It's hard to see where the problem is from this information. I would suggest subscribing to and asking this question of the RExcel mailing list (accessible from http://rcom.univie.ac.at/) and providing more detail of what you're trying to do, what is going wrong, error messages (is it R or Excel g

[R] Plot many x and y

2011-06-06 Thread Alaios
Dear all could you please plot many x's and y's with one legend per plot? I would like to thank you in advance for your help Best Regards Alex. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the postin

Re: [R] Plot many x and y

2011-06-06 Thread Joshua Wiley
Hi Alex, You have not given enough details for us to answer your question. Is this something like what you mean? par(mfcol = c(2, 2)) plot(1:10, 1:10, pch = 16) legend(x = 2, y = 8, legend = "Test 1", pch = 16) plot(1:10, 1:10, pch = 15) legend(x = 2, y = 8, legend = "Test 2", pch = 15) plot(1:1

Re: [R] Plot many x and y

2011-06-06 Thread Stephan Kolassa
Hi Alex, could you be a little more specific as to what exactly you mean by "plotting many x's and y's with one legend per plot"? Please note what appears at the bottom of every R-help mail: > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commente

[R] Merge two columns of a data frame

2011-06-06 Thread Abraham Mathew
I have the following data: prefix <- c("cheap", "budget") roots <- c("car insurance", "auto insurance") suffix <- c("quote", "quotes") prefix2 <- c("cheap", "budget") roots2 <- c("car insurance", "auto insurance") roots3 <- c("car insurance", "auto insurance") suffix3 <- c("quote", "quotes") df

Re: [R] Problem in R documentation

2011-06-06 Thread siddharth arun
Thanks Jorge it worked On Mon, Jun 6, 2011 at 8:02 PM, Jorge Ivan Velez wrote: > Hi Siddharth, > > adf.test() is part of the "tseries" package, so you need to download and > install it before using that function. Try the following and let us now what > you get: > > install.packages('tseries') > r

[R] Denton benchmarking method

2011-06-06 Thread Pascal Grandeau
Good morning, Does it exist R code to do Denton benchmarking for time series ? Thank you. P. Grandeau __ 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-g

[R] Problem plotting in R under linux (centos)

2011-06-06 Thread Roger Gill
Dear All, I am running into a slightly odd issue when attempting to produce a png/pdf file in R under centos. The version of Centos is 5.6 with an old version of R 2.12.0 (2010-10-15). My script is roughly: mydata <- read.csv(myfile) png(outfile) plot(0,0,type='n',ylim=c(-500,500),xlim=c(0

Re: [R] Wireframe, custom x-axis values

2011-06-06 Thread David Winsemius
Im plotting some data with wireframe() like so: wireframe(result ~ u * r, myData, scales=list(arrows=FALSE)) However, I would really like to display something different for the displayed values of "u" rather than the actual values. This is because my u-values are a sequence of quantiles of myDa

Re: [R] adding an ellipse to a PCA plot

2011-06-06 Thread Alain Guillet
Hi, I think the easiest way is to use the function plotellipses of the FactoMineR package (but you have to do your PCA with the PCA function included in this package). Alain On 06-Jun-11 16:32, Lukas Baitsch wrote: Hi, I created a principal component plot using the first two principal comp

[R] Taking Integral and Optimization using Integrate, Optim and maxNR

2011-06-06 Thread MARYAM ZOLGHADR
Dear All, Hello! I have some questoins in R programming as follows: Question 1- How to take the integral of this function with respect to y, such that x would appear in the output after taking integral. f(x,y)=(0.1766*exp(-exp(y+lnx))*-exp(y+lnx))/(1-exp(-exp(y+lnx))) y in (-6.907,-1.246) It

[R] draw text outside plot boundaries

2011-06-06 Thread Erik Aronesty
i'd like to use the text() function to annotate some points, but the labels get cropped, if the point is on the right is there a way to prevent this, and tell the text() function to allow writing outside the boundaries of the current plot? i don't mind if it looks "messy" and steps on the margin

[R] RPostgreSQL && snowfall

2011-06-06 Thread Florian Endel
Dear expeRts, I'm currently trying to get data from a PostgreSQL database _in parallel_. I tried two methods: * passing the DBI Connection object to the cluster nodes * connecting the the DB on each node (1) The execution of the first method looks like this: > result = sfClusterApplyLB(input, fun

[R] lme, stepAIC, predict: scope and visibility

2011-06-06 Thread Boris Hayete
Hello all, I've run into a problem where I can't run predict.lme on an object simplified via a stepAIC. A similar post has been recorded on this list: https://stat.ethz.ch/pipermail/r-help/2008-May/162047.html but in my case, I'm going to great lengths to not repeat that poster's error and stil

[R] list demographics

2011-06-06 Thread Sarah Goslee
Hi all, I got curious about something, so in proper scientific fashion I obtained some data and analyzed it. Question: what is the female participation in the R-help email list? Data: the most recent list postings, obtained from the website. I took my best shot at classifying the names given in

Re: [R] Not missing at random

2011-06-06 Thread Joshua Wiley
Hi Blaz, See below. x <- matrix(c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,3,3,3,4), nrow = 7, ncol=7, byrow=TRUE) matrix pMiss <- 30 percent of missing values N <- dim(x)[1] number of cases candidate <- which(x[,1]<3 | x[,2]<

Re: [R] Merge two columns of a data frame

2011-06-06 Thread Ista Zahn
Hi Abraham, Just take it step by step. Paste the values together, combine them, and assign them to a data.frame column. Like this perhaps: df.1.2.3 <- data.frame(Var1 = c(with(df1, paste(Var1, Var2, Var3)), with(df2, paste(Var1, Var2)), with(df3, paste(Var1, Var2 B

Re: [R] Merge two columns of a data frame

2011-06-06 Thread Ethan Brown
Another possibility: dfs <- list(df1, df2, df3) df.1.2.3 <- as.data.frame(unlist(sapply(dfs, function(x) do.call(paste, x On Mon, Jun 6, 2011 at 2:37 PM, Ista Zahn wrote: > Hi Abraham, > Just take it step by step. Paste the values together, combine them, > and assign them to a data.frame col

Re: [R] RPostgreSQL && snowfall

2011-06-06 Thread Whit Armstrong
I don't think you can share dbi connections across different instances of R. just have each of your helper functions open a local connection. or alternatively, load a package on each instance which keeps a dbi connection open. and make sure you bump up your allowed number of connections in pg_co

Re: [R] draw text outside plot boundaries

2011-06-06 Thread Peter Ehlers
On 2011-06-06 08:44, Erik Aronesty wrote: i'd like to use the text() function to annotate some points, but the labels get cropped, if the point is on the right is there a way to prevent this, and tell the text() function to allow writing outside the boundaries of the current plot? Go to ?par a

[R] A Calculation on list object

2011-06-06 Thread Ron Michael
Hello, I am into some calculation on a list object, therefore requesting the peers if there is any short cut way to so the same calculation. Let say I have following list object: > List <- vector('list', length = 3) > set.seed(1) > List[[1]] <- rnorm(5) > List[[2]] <- rnorm(2) > List[[3]] <- rno

Re: [R] A Calculation on list object

2011-06-06 Thread Joshua Wiley
Hi Ron, Seems like there might be a really elegant way, but I would use lapply(). For instance: lapply(seq_along(List), function(x) List[[x]] + Vector[x]) If you do this regularly and want something that reads more intuitively, consider defining an operator that does this. %+% is undefined (at

Re: [R] A Calculation on list object

2011-06-06 Thread Gabor Grothendieck
On Mon, Jun 6, 2011 at 6:10 PM, Ron Michael wrote: > Hello, I am into some calculation on a list object, therefore requesting the > peers if there is any short cut way to so the same calculation. > > Let say I have following list object: > >> List <- vector('list', length = 3) >> set.seed(1) >> L

Re: [R] draw text outside plot boundaries

2011-06-06 Thread Tyler Rinker
Erik, To add to what epter said... I created this little function for clicking text anywhere on the plot (I probably stole the idea from a list serve or Dalgaard's book or someplace like that). Anyway it is helpful to me and may be of use to you too. Very basic but I use it a ton. You modi

[R] extract data from a data frame field

2011-06-06 Thread ads pit
Hi all, I am given the a data frame in which one of the columns has more information together- see column 4, peak_loc: chr startend peak_loc cluster_TC strand peak_TC 1 chr1 564620 564649 chr1:564644..564645,+ 94 + 10 2 chr1 565369 565404 chr1:565371..565372,+

Re: [R] extract data from a data frame field

2011-06-06 Thread jim holtman
Here is a start; you can change the column names: > x chr startend peak_loc cluster_TC strand peak_TC 1 chr1 564620 564649 chr1:564644..564645,+ 94 + 10 2 chr1 565369 565404 chr1:565371..565372,+217 + 8 3 chr1 565463 565541 chr1:565480..565

[R] Custom Sort on a Table object

2011-06-06 Thread Galen Moore
Greetings - I've got the following table (the result of a two-way table operation): f m 0 to 5 11.328000 6.900901 15 to 24 6.100570 5.190058 25 to 34 9.428707 6.567280 35 to 4410.462158 7.513270 45 to 54 7.621988 5.6929

Re: [R] Custom Sort on a Table object

2011-06-06 Thread Bill.Venables
Here is a one way. > tab fm 0 to 5 11.328000 6.900901 15 to 24 6.100570 5.190058 25 to 34 9.428707 6.567280 35 to 4410.462158 7.513270 45 to 54 7.621988 5.692905 5 to 14 6.502741 6.119663 55 to 64 5.884737 4.319905 65 to 74 5.075606 4.2

Re: [R] Line Graphs

2011-06-06 Thread Jim Silverton
Hello, I want to plot 6 line graphs. I have 10 points 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 and 1.0. At each point say 0.1, I have 6 variables A, B, C, D, E and F. The variables all have values between 0 and 1 (and including 0 and 1). I also want to label the x axis from 0.1 to 1.0 and the y

[R] error with geomap in googleVis

2011-06-06 Thread SNV Krishna
Hi All, I am unable to get the plot geomap in googleVis package. data is as follows > head(index.ret) countryytd 1 Argentina -10.18 2 Australia -3.42 3 Austria -2.70 4 Belgium 1.94 5Brazil -7.16 6Canada 0.56 > map1 = gvisGeoMap(index.ret,locationvar = 'country', num

[R] extract data features from subsets

2011-06-06 Thread Williams Scott
I have a large dataset similar to this: ID timeresult A 1 5 A 2 2 A 3 1 A 4 1 A 5 1 A 6 2 A 7 3 A 8 4 B 1 3 B 2 2 B 3 4 B 4 6 B 5 8

Re: [R] extract data features from subsets

2011-06-06 Thread Dennis Murphy
Hi: Here's one way using package plyr and its ddply() function. ddply() takes a data frame as input and expects to output either a scalar or a data frame. In this case, we want the latter. library(plyr) f <- function(df) { mn <- min(df$result) tms <- df$time[df$result == mn] subdf <-