Re: [R] survreg and predict probability of failure

2014-03-14 Thread David Winsemius
Perhaps: G10 <- predict(wei, list(Group =10 , UsefulLife =10), type="response") You should get a single km-type object and will need to extract a time-specific value. (You really _should_ post what you have tried.) -- David Sent from my iPhone Sent from my iPhone > On Mar 14, 2014, at 9:11

Re: [R] survreg and predict probability of failure

2014-03-14 Thread David Winsemius
Perhaps: G10 <- predict(wei, list(Group =10 , UsefulLife =10), type="response") You should get a single km-type object and will need to extract a time-specific value. (You really _should_ post what you have tried.) -- David Sent from my iPhone > On Mar 14, 2014, at 7:11 PM, shilpi harpavat

Re: [R] survreg and predict probability of failure

2014-03-14 Thread David Winsemius
Perhaps: G10 <- predict(wei, list(Group =10 , UsefulLife =10), type="response") You should get a single km-type object and will need to extract a time-specific value. (You really _should_ post what you have tried.) -- David Sent from my iPhone > On Mar 14, 2014, at 7:11 PM, shilpi harpavat

[R] survfit question - Q1 and Q3 survival time?

2014-03-14 Thread Lucy Leigh
Hello, I am using the function survfit in the 'survival' package. Calling the function produces the median survival time automatically, as below. sleepfit <- survfit(Surv(timeb, death)~1) > sleepfit Call: survfit(formula = Surv(timeb, death) ~ 1) records n.max n.start events median 0.95LCL 0

Re: [R] strangely long floating point with write.table()

2014-03-14 Thread Mike Miller
On Fri, 14 Mar 2014, Duncan Murdoch wrote: On 14-03-14 8:59 PM, Mike Miller wrote: What I'm using: R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-unknown-linux-gnu (64-bit) That's not current, but it's not very old.

Re: [R] strangely long floating point with write.table()

2014-03-14 Thread Duncan Murdoch
On 14-03-14 8:59 PM, Mike Miller wrote: What I'm using: R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-unknown-linux-gnu (64-bit) That's not current, but it's not very old... According to some docs, options(digits)

[R] strangely long floating point with write.table()

2014-03-14 Thread Mike Miller
What I'm using: R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-unknown-linux-gnu (64-bit) According to some docs, options(digits) controls numerical precision in output of write.table(). I'm using the default value f

Re: [R] plots

2014-03-14 Thread David Stevens
David Carlson's solution is obviously better! (sorry, I just saw it) David Stevens On 3/14/2014 4:57 PM, David Stevens wrote: Renalda - your figure got stripped out. I'll assume you mean to have depth on the vertical axis with a zero at the top and increasing (+) depth as you go down. This is

Re: [R] plots

2014-03-14 Thread David Stevens
Renalda - your figure got stripped out. I'll assume you mean to have depth on the vertical axis with a zero at the top and increasing (+) depth as you go down. This is pretty simple to do. 1) use the (-) of depth on the y-axis 2) make the plot without the y-axis labels (yaxt='n') using ylim=c

Re: [R] Simple plot with line instead of dashes

2014-03-14 Thread MacQueen, Don
Make your years numeric, not character. Then plot(Year, AnnualInflation, type='l') (don't need the data frame for this plot) -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 3/14/14 11:15 AM, "Miguel A. Buitrago" wrote:

[R] Simple plot with line instead of dashes

2014-03-14 Thread Miguel A. Buitrago
Dear R-helpers, here is a novice question. I want to plot a two variable graph: year and Inflation Rate. I created two vectors which I combined into a data frame: Year <- c("1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "20

[R] Determining Total Number of Multiple Comparisons

2014-03-14 Thread Nick Negovetich
Greetings, I'm running a series of Chi-square tests to examine differences across categorical variables. The situation is this: I have three variables: sex (M/F), habitat (5 levels), season (W,Sp,Su,F). A Cochran-Mantel-Haenzel test detects non-indepedence across my sex strata. I then sub

Re: [R] plots

2014-03-14 Thread Jim Lemon
On 03/14/2014 06:55 PM, Renalda Munubi-Misinzo wrote: I would like to have a plot with values in a reversed order (as shown in fig 2). I tried to plot the graph in R using the following codes plot(density,depth,pch=as.numeric(species),xlab="fish density (#/m2)",ylab="water depth (m)") legend(

Re: [R] Metafor - why use escalc?

2014-03-14 Thread Viechtbauer Wolfgang (STAT)
Often, there is a mix of information available from the various studies that needs to be used to compute the effect sizes or outcomes to be used for the meta-analysis. Then you have to 'build up' your dataset in multiple steps and you cannot bypass first using escalc(). As a very basic example,

[R] FrailtyHL package does not work

2014-03-14 Thread Maria Helena Mourino Silva Nunes
Dear all, I want to describe the time interval between mammography screenings as a function of several clinical and demographic variables. For each woman (ID), I have multiple events and each event corresponds to the time interval between two consecutive mammography screenings. Also, women's da

Re: [R] plots

2014-03-14 Thread David Carlson
R-help strips attachments so your post has three problems: 1. No plot to look at 2. No data to replicate your code 3. Email is in html format instead of plain text Try again using plain text mail, copy the results of dput(your.data.frame) into your email and provide code that generates the figure

Re: [R] filter seq wise

2014-03-14 Thread arun
Hi, Please use ?dput() to show the data. dat <- read.table(text="id name seq  101 as 1  102 ld 2  103 eg 3  101 as 4  104 bs 5  103 eg 6  105 ka 7  104 bs 8",sep="",header=TRUE,stringsAsFactors=FALSE) res1 <- aggregate(seq~.,data=dat,FUN=I)  res1 <- res1[order(res1$id),] ##creates the column 'seq'

Re: [R] apply a function containing a reduce statement to all rows of a 2d array?

2014-03-14 Thread Bert Gunter
Ummm... totalfunc(0) totalfunc(100) totalfunc() always gives the same result, because its argument is not used in the function body. You probably want something like: totalfunc <- function (y,z) {Reduce(func1, x = y, accumulate = TRUE, init = z) } Also note that yo

Re: [R] Splitting of Single value data into Multiple columns

2014-03-14 Thread arun
Hi, You could use ?strsplit() dat <- read.table(text="'Column 1'    'AAA--> BBB'   'CCC--> DDD'",sep="",header=TRUE,check.names=FALSE,stringsAsFactors=FALSE)   dat1 <- setNames(as.data.frame(do.call(rbind,strsplit(da

Re: [R] Deletion of rows

2014-03-14 Thread arun
Hi, Try:  res2 <- res1[!is.na(res1$Amount),] A.K. On Friday, March 14, 2014 3:41 AM, dila radi wrote: Hi all,   Regarding the previous post, here is part of my data. structure(list(Year = c(1949L, 1949L, 1949L, 1949L, 1949L, 1949L,  1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L,

[R] apply a function containing a reduce statement to all rows of a 2d array?

2014-03-14 Thread Jim Maas
If possible I would like to apply a function, that contains a "reduce" statement, across the rows of 2d array. This code works for me right up until the last. Can it be done or is there a better way? My next challenge is to pass it a vector of starting values, i.e. each row will have a different in

[R] Random effects model with PLM: "System is computationally singular"-Error?

2014-03-14 Thread tahaus
Dear readers, I am currently trying to estimate some panel data models in R using PLM package. This includes the estimation of basic pooled, fixed effects and random effects models. Therefore I make use of this code: Now here's the problem: Now here's the problem: I can without any problem esti

[R] survreg and predict probability of failure

2014-03-14 Thread shilpi harpavat
Hi, I am fitting a weibull model as follows my models is s <- Surv(DFBR$Time,DFBR$Censor) wei <- survreg(s~Group+UsefulLife,data = DFBR,dist="weibull") How can i predict the probabilty of failure in next 10 days, for a new data with group =10 and usefuleLife =100 Thx shilpi

Re: [R] boxplot with x-axis time

2014-03-14 Thread MacQueen, Don
Something like: tmp <- boxplot(V ~ date, data=pippo, plot=FALSE) bxp(tmp, at=sort(unique(pippo$date)) You may need to adjust the x-axis limits and the box widths. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 3/13/1

[R] plots

2014-03-14 Thread Renalda Munubi-Misinzo
I would like to have a plot with values in a reversed order (as shown in fig 2). I tried to plot the graph in R using the following codes plot(density,depth,pch=as.numeric(species),xlab="fish density (#/m2)",ylab="water depth (m)") legend(locator(n=1),legend=c("Tropheus brichardi","Petrochromis

[R] bayesglm function in ARM package

2014-03-14 Thread Peter Harrell
I am getting odd results from the bayesglm function in the ARM package. Running R 3.0.2 and downloaded the most resent ARM package. Every dataset I try runs, but the output is incorrect - I get a null deviance that is less than the residual deviance. I have tested this with datasets I have us

[R] plots

2014-03-14 Thread Renalda Munubi-Misinzo
I would like to have a plot with values in a reversed order (as shown in fig 2). I tried to plot the graph in R using the following codes plot(density,depth,pch=as.numeric(species),xlab="fish density (#/m2)",ylab="water depth (m)") legend(locator(n=1),legend=c("Tropheus brichardi","Petrochromis

Re: [R] creating table with sequences of numbers based on the table

2014-03-14 Thread Gosia Gazda
Thank you so much for all your answers my problem was solved. I really appreciate all your emails and really fast reaction. All the best, Malgorzata Gazda Date sent: Thu, 13 Mar 2014 22:38:54 +0100 From: Arunkumar Srinivasan To: arun , Dennis Murphy Copies to: R help Subject:

Re: [R] Deletion of rows

2014-03-14 Thread dila radi
Hi all, Regarding the previous post, here is part of my data. structure(list(Year = c(1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1949L, 1

[R] Metafor - why use escalc?

2014-03-14 Thread Purssell, Ed
Dear All As you can specify the data directly to rma.uni via n1i, m1i, sd1i, etc in Metafor, why would you ever want to use escalc to calculate yi and vi? Aren't these just intermediate steps to the final pooled effect size which is calculated by rma.uni; or is there some advantage to calcul

Re: [R] combinatorics for minimal set of samples

2014-03-14 Thread David Reiner
Perhaps this blog post will be of use: http://www.r-bloggers.com/generating-balanced-incomplete-block-designs-bibd/ HTH, -- David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of n.hub...@ncmls.ru.nl Sent: Friday, March 14, 2014 4

Re: [R] How to get the adjusted R squared from GLS() estimator

2014-03-14 Thread Chris Wilkinson
You could fit a linear model to original/predicted y values and get rsquared from that. Chris On Mar 13, 2014 5:26 PM, Greg Snow <538...@gmail.com> wrote: > > Well if I had it and you asked nicely, then I would be happy to give > it to you.  Oh, you mean the gls function, not GLS as my initials

[R] data.table and R package check

2014-03-14 Thread Witold E Wolski
Hi, using data.table in package code i.e setkey(aligtable,transition_group_id,align_origfilename) aligtable = aligtable[CJ(unique(transition_group_id), unique(align_origfilename))] When I do run R package check I got warnings such as: convert2msExperiment: no visible binding for global variable

Re: [R] Negative binomial models and censored observations

2014-03-14 Thread Achim Zeileis
On Thu, 13 Mar 2014, Tim Marcella wrote: Hi, I am working with hurdle models in the pscl package to model zero inflated overdispersed count data and want to incorporate censored observations into the equation. 33% of the observed positive count data is right censored, i.e. subject lost to fo

Re: [R] centroid of diamond

2014-03-14 Thread Jim Lemon
On 03/14/2014 08:19 PM, al Vel wrote: Hi, Exactly the matrix transformation is the one that pasted in my first mail. That is here: new_point <- function(x1, x2, y1, y2, grad=1.73206){ b1 <- y1-(grad*x1) b2 <- y2-(-grad*x2) M <- matrix(c(grad, -grad, -1,-1), ncol=2) intercepts <- as.matrix(c(b1,b

Re: [R] centroid of diamond

2014-03-14 Thread al Vel
Hi, Exactly the matrix transformation is the one that pasted in my first mail. That is here: new_point <- function(x1, x2, y1, y2, grad=1.73206){ b1 <- y1-(grad*x1) b2 <- y2-(-grad*x2) M <- matrix(c(grad, -grad, -1,-1), ncol=2) intercepts <- as.matrix(c(b1,b2)) t_mat <- -solve(M) %*% intercep

Re: [R] GLM vs GAM

2014-03-14 Thread Simon Wood
I am wondering whether anyone could explain what'd be the difference between running a 'generalized additive regression' versus 'generalized linear regression' with splines. The smooth terms in mgcv::gam are represented using *penalized* regression splines, with the degree of penalization sel

[R] combinatorics for minimal set of samples

2014-03-14 Thread N.Hubner
Dear all, This is something for the combinatorics freaks amongst you (which I am certainly not :-). I do the following problem to solve and was wondering if this can be easily done using R: I have a set of, let's say, 10 variables: n(varibale) = 10 e.g. var <- c(a,b,c,d,e,f,g,h,i,j)

Re: [R] How to get the adjusted R squared from GLS() estimator

2014-03-14 Thread peter dalgaard
On 13 Mar 2014, at 22:26 , Greg Snow <538...@gmail.com> wrote: > Oh, you mean the gls function, not GLS as my initials (my > parents are OLS and WLS, perhaps I was destined to regress), sorry. Fortune candidate? > The gls function in the nlme package (is that the one that you are > asking about

Re: [R] centroid of diamond

2014-03-14 Thread Jim Lemon
On 03/14/2014 07:05 PM, al Vel wrote: Hi, I was very clear in the mail that i want to create a four edged Barycentric diagram like Ternary plot (like the rhombus in the piper diagram (http://en.wikipedia.org/wiki/Piper_diagram)). The idea is to graphically depicts the ratios of the four variabl

Re: [R] Creating a box plot with whiskers when I only have mean, sd and n

2014-03-14 Thread Frederik Borup
Thanks for very quick reply Cheers Frederik Borup On Fri, Mar 14, 2014 at 6:09 AM, Jim Lemon wrote: > On 03/14/2014 06:52 AM, Frederik Borup wrote: > >> Dear all, >> >> I want to create a boxplot with whiskers. I want to compare several >> studies. For each study I have >> >> 1. mean >

Re: [R] centroid of diamond

2014-03-14 Thread al Vel
Hi, I was very clear in the mail that i want to create a four edged Barycentric diagram like Ternary plot (like the rhombus in the piper diagram ( http://en.wikipedia.org/wiki/Piper_diagram)). The idea is to graphically depicts the ratios of the four variables as positions in an rhombus/diamond s