Re: [R] Comparing crossing survival curves

2012-07-05 Thread Vito Muggeo (UniPa)
hi isabel, You have to decide if focus is on the survival curves or hazards.. Crossing hazards do not imply crossing survival curves If you are dealing with crossing hazards, and you are interested in testing for an effect of a covariate (presumably with a crossing hazard effect), then a stan

Re: [R] Piecewise Lasso Regression

2012-06-06 Thread Vito Muggeo (UniPa)
tructure and I believe that fitting a piecewise regression would be of great benefit. Thanks, Lucas On Jun 6, 2012, at 4:54 AM, Vito Muggeo (UniPa) wrote: dear lucas, yes you are right, segmented does not handle 'lars' objects. Out of curisity, are you interested in selecting the nu

Re: [R] Piecewise Lasso Regression

2012-06-06 Thread Vito Muggeo (UniPa)
dear lucas, yes you are right, segmented does not handle 'lars' objects. Out of curisity, are you interested in selecting the number of breakpoints or in selecting additional covariates with linear parameters? vito Il 06/06/2012 0.01, Lucas Santana dos Santos ha scritto: Hi All, I am tryi

Re: [R] Finding multiple breakpoints - 'segmented' ?

2012-06-01 Thread Vito Muggeo (UniPa)
dear Peter, Currently segmented handles multiple breakpoints for several variables (the limit discussed in the msg 2006 has been fixed..). However you are looking for a somewhat complicated model where the breakpoint of the relationship 's.size' and 'R.AUC' depends on another covariate 'bedek

[R] getting the name of the working .Rdata file

2012-06-01 Thread Vito Muggeo (UniPa)
dear all, I do not if it is a nonsense question.. Is it possible in the R session to get the name of the current .Rdata file that I ran? I mean: suppose I double click the file myfile.Rdata. ls() returns the names of the objects in the current workspace (that is saved in myfile.Rdata). In th

Re: [R] Breakpoint in logistic GLM with 'segmented' package - error: replacement length zero

2012-05-25 Thread Vito Muggeo (UniPa)
dear Peter, Your code appears correct, so it is difficult to reply without the data.. If you are interested in further details, please contact me off-list vito Il 25/05/2012 15.34, Peter Hoitinga ha scritto: Hello all, I've been having trouble with assessing a breakpoint in a logistic GLM wi

Re: [R] Error with psi value for 'segmented' package for R

2012-05-08 Thread Vito Muggeo (UniPa)
dear Szymon, what do you mean "it does not work for others.. that fit within similar range"? Each dataset has its own features and breakpoint estimation is not as simple as estimation of linear models even if your data "fit within similar range". I will contact you out of the list for detai

Re: [R] Error with the 'segmented' package for R

2012-05-04 Thread Vito Muggeo (UniPa)
dear Szymon, it is a bug (in the new version), thanks. It depends on the flat underlying relationship you are trying to estimate with a small sample.. I will correct it as soon as possible. Meanwhile you can use o1<-glm(gpp ~ temp) os1<-segmented(o1, seg.Z=~temp, psi=15, control=seg.control(n.

Re: [R] variable dispersion in glm models

2012-04-26 Thread Vito Muggeo (UniPa)
there are at least two alternatives 1) package dglm for Double generalized linear models or probably better 2)package gamlss for Generalized Additive Models for Location Scale and Shape. Here you can use alternative, sometimes more appropriate, families and also you can include additive (nonp

Re: [R] linear-by-linear association model in R?

2012-04-02 Thread Vito Muggeo (UniPa)
dear Christofer, Try the following d<-expand.grid(a=1:3,b=1:4) d$freq<-rpois(12,5) o<-glm(freq~factor(a)+factor(b)+I(a*b), family=poisson, data=d) vito Il 02/04/2012 9.34, Christofer Bogaso ha scritto: Dear all, can somebody give me some pointer how I can fit a "linear-by-linear association

[R] glmnet() vs. lars()

2012-03-21 Thread Vito Muggeo (UniPa)
dear all, It appears that glmnet(), when "selecting" the covariates entering the model, skips from K covariates, say, to K+2 or K+3. Thus 2 or 3 variables are "added" at the same time and it is not possible to obtain a ranking of the covariates according to their importance in the model. On t

Re: [R] breakpoints and nonlinear regression

2012-01-19 Thread Vito Muggeo (UniPa)
dear Julian, Il 18/01/2012 14.36, crimsonengineer87 ha scritto: Thanks for the comments. Yes, I also had segmented and then I went away from that. I can't remember. I've tried using it but I get some sort of strange error. Here's some code ... it is difficult for me to help you without knowin

[R] looking for an ecological dataset

2012-01-19 Thread Vito Muggeo (UniPa)
dear all, apologizes for this off-topic question. I am looking for a "ecological" dataset (n>100, say) including measurements of one or more growth variable and age. Could anyone to suggest the R package/URL where I can find it? many thanks, vito -- Vit

Re: [R] Problem with segmented

2012-01-11 Thread Vito Muggeo (UniPa)
dear Phil, I am not able to read the error message.. did you forget it? However: does x exist in the workspace? The following lines work: myreg2 = lm(y ~ x, data=xy) mysegmented = segmented(myreg2, seg.Z=~x, psi=c(245000)) myreg2 = lm(xy$y ~ xy$x) x<-xy$x mysegmented = segmented(myreg2, seg.Z=

Re: [R] mgcv gam predict problem

2011-03-28 Thread Vito Muggeo (UniPa)
dear Philip, I am not able to solve your problem, however the error message you get does not depends on mgcv::gam, therefore gam(,..outer.ok=TRUE) or predict.gam(,outer.ok=TRUE) do not make sense. The error message comes from the function splines::splineDesign which is called when the option

Re: [R] plot not generic

2011-01-28 Thread Vito Muggeo (UniPa)
dear Nick, getAnywhere("plot.glmnet") Note the message you get when you type methods(plot) ... >>> Non-visible functions are asterisked Il 28/01/2011 14.26, Nick Sabbe ha scritto: Hello list. I was trying to see some of the code for plot.glmnet in package glmnet (this function name i

Re: [R] Choosing statistical test - Fisher's Exact Test?

2011-01-18 Thread Vito Muggeo (UniPa)
It appears that you have a 2x2 table coming from paired binary data.. If this is the case the McNemar test is appropriate. See ?mcnemar.test or even better the package exact2x2, function mcnemar.exact() for an "exact" approach, vito Il 18/01/2011 14.40, debz ha scritto: Hi I was wonderi

Re: [R] Convert a matrix's columns to list

2011-01-18 Thread Vito Muggeo (UniPa)
hi feng, a possible solution is b1<-apply(a,2,list) and possibly lapply(b1,unlist) if you want exactly the output equal to "list(a[, 1], a[, 2])" best, vito Il 18/01/2011 13.53, Feng Li ha scritto: Dear R, Is there an efficient way to make a list that each element is from the corresponding

Re: [R] confidence interval for logistic joinpoint regression from package ljr

2010-12-01 Thread Vito Muggeo (UniPa)
dear M., I do not know how to get the SE for the joinpoint (or breakpoint) from your ljr fit. However you can find useful the segmented package which works for any GLM (including the logistic one) and it returns (approximate) StErr (and Conf Int) also for the joinpoint (breakpoint in the segme

Re: [R] One silly question about "tapply output"

2010-10-27 Thread Vito Muggeo (UniPa)
dear Vincy, Firstly, a suggestion: to increase the probability of getting help, you should provide reproducible code (people can do "copy-and-paste" of your code and to modify the code to obtain the response.. ) However a possible solution (not tested, of course..) could be simply a<-tapply(r

[R] building lme call via call()

2010-10-25 Thread Vito Muggeo (UniPa)
dear all, I would like to get the lme call without fitting the relevant model. library(nlme) data(Orthodont) fm1 <- lme(distance ~ age, random=list(Subject=~age),data = Orthodont) To get fm1$call without fitting the model I use call(): my.cc<-call("lme.formula", fixed= distance ~ age, random =

Re: [R] Interactions in GAMMs

2010-07-21 Thread Vito Muggeo (UniPa)
Hi Karen, I think you should decide what you mean for "interaction". s(x:y) is meaningless If you want to fit a surface you should use s(x,y). If you want to fit a varying coefficient model (interaction between a linear and a smooth term) you should use the argument by in s(). The help file

Re: [R] Peak Over Threshold values

2010-05-26 Thread Vito Muggeo (UniPa)
dear Tonja, By plotting your data plot(df) it seems to me that you are looking for a piecewise linear relationships. If this is the case, have a look to the package segmented. You have to specify or not the number and the starting values for the breakpoints library(segmented) olm<-lm(waleve

[R] only actual variable names in all.names()

2010-03-04 Thread Vito Muggeo (UniPa)
dear all, When I use all.vars(), I am interest in extracting only the variable names.. Here a simple example all.vars(as.formula(y~poly(x,k)+z)) returns [1] "y" "x" "k" "z" and I would like to obtain "y" "x" "z" Where is the trick? many thanks vito -- Vi

[R] partial matching with grep()

2009-11-02 Thread Vito Muggeo (UniPa)
dear all, This is a probably a silly question. If I type > grep("x",c("a.x" ,"b.x","a.xx"),value=TRUE) [1] "a.x" "b.x" "a.xx" Instead, I would like to obtain only "a.x" "b.x" How is it possible to get this result with grep()? many thanks for your attention, best, vito --

Re: [R] Estimation in a changepoint regression with R

2009-10-15 Thread Vito Muggeo (UniPa)
There are at least two R packages dealing with changepoint estimation, segmented and strucchange. Two possible relevant papers are available: 1)Journal of Statistical Software for strucchange (2002, Vol.7, Issue2) 2)Rnews for segmented (2008, 8/1: 20-25) Hope this helps you vito FMH ha scritt

Re: [R] Fitting a linear model with a break point

2009-09-08 Thread Vito Muggeo (UniPa)
dear Dan, As far as I know, the strucchange package can be helpful for you.. On the other hand, if your regression function is continuous at the unknown break points to be estimated, you could try the segmented package. Hope this helps you, vito Daniel Brewer ha scritto: Hello, I would lik

Re: [R] Zinb for Non-interger data

2009-07-21 Thread Vito Muggeo (UniPa)
I think that the (impressive) gamlss package (see http://www.gamlss.com) may be helpful. If I remember correctly, in gamlss you can fit model with zero-inflated continuous distributions hope this helps you, vito Alain Zuur ha scritto: JPS2009 wrote: Sorry bit of a Newbie question, and I

Re: [R] Linear Regression Problem

2009-07-14 Thread Vito Muggeo (UniPa)
dear Alex, I think your problem with a large number of predictors and a relatively small number of subjects may be faced via some regularization approach (ridge or lasso regression..) hope this helps you, vito Alex Roy ha scritto: Dear All, I have a matrix say, X ( 100 X 40

Re: [R] zero cells in one variable in logistic regression

2009-07-13 Thread Vito Muggeo (UniPa)
dear anna, if you are not interested in point estimate and SE of the parameter of the aforementioned categorical variable, I believe the conventional glm(..,family=binomial) is correct. In particular, the returned deviance is reliable and also it is the relevant likelihood ratio test.. hope t

Re: [R] gradually switching regression

2009-06-24 Thread Vito Muggeo (UniPa)
Hi, Although Bacon&Watts (1971) assume a transition, the aim is to estimate the breakpoint where the linear relationship changes. The start- and end-point of the transition phase are not parameters to estimate ; it is a trick to estimate the model. As a possible alternative, you could have a