[R] Package rms: c-statistic from lrm function with weights

2016-06-15 Thread Marie-Pierre Sylvestre
Dear list, I am using the lrm function from the rms package to estimate a logistic model with weights. The c-statistic (or area under the curve) is part of the lrm output. To understand how the weights enter the computation of the c-statistics, I looked at the script of lrm and lrm.fit but I am

[R] Frequencies for a list of vectors

2014-08-05 Thread Marie-Pierre Sylvestre
Dear R users, I have a list of vectors (list is called HTNlist). Each vector is of length 1 to 4 and takes only 0 and 1 as values. E.g. head(HTNlist) $`30008` [1] 1 0 1 0 $`60008` [1] 0 0 1 0 $`90008` [1] 0 0 1 0 $`17` [1] 1 $`130001` [1] 0 1 $`130007` [1] 1 0 1 0 I would like to

Re: [R] update.formula() to add interaction terms

2014-02-04 Thread Marie-Pierre Sylvestre
output) - currently it adds x1:x5. Bill Dunlap TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Marie-Pierre Sylvestre Sent: Monday, February 03, 2014 12:54 PM To: r-help@r-project.org

[R] update.formula() to add interaction terms

2014-02-03 Thread Marie-Pierre Sylvestre
Hi, I have a list of formulae that I need to modify. For each formula, I need to add an interaction term between the first independent variable and the last one. I want to write a function to achieve that because the list of formulae to modify is long. For example, if the formula is y ~ x1 + x2 +

[R] meta-analysis, outcome = OR associated with a continuous independent variable

2012-04-04 Thread Marie-Pierre Sylvestre
Hello everyone, I want to do a meta-analysis of case-control studies on which an OR was computed based on a continuous exposure. I have found several several packages (metafor, rmeta, meta) but unless I misunderstood their main functions, it seems to me that they focus on two-group comparisons

[R] pairs and panel.smooth for two groups

2010-09-08 Thread Marie-Pierre Sylvestre
Hi, I have modified the USJudgeRatings data (available in R) to illustrate my question. # Use the first 4 variables of USJudgeRatings and add a group variable with two levels USJudgeRatings - USJudgeRatings[,1:4] USJudgeRatings$group - factor(c(rep(1, 22), rep(0, 21))) # I can draw a pairs

[R] Converting a data set from 'long' format to 'interval' format

2010-03-24 Thread Marie-Pierre Sylvestre
Hi, I have a data set in which the variable 'dose' is time-varying. Currently, the data set is in a long format, with 1 row for each time unit of follow-up for each individual Id. It looks like this: orig.data - cbind(Id = c(rep(1,4), rep(2,5)), time = c(1:4, 1:5), dose = c(1,1,1,0,1,0,1,1,0))

[R] gamm (mgvc) and time-varying coefficient model

2009-03-01 Thread Marie-Pierre Sylvestre
Dear R users, I have repeated measurements on individuals. I want to estimate the time-varying effect of a factor variable X (taking three levels), e.g. a model in the spirit of Hastie and Tibshirani (1993). I am considering using the package mgvc which implements generalized additive models,

[R] gamm (mgvc) and time-varying coefficient model

2009-03-01 Thread Marie-Pierre Sylvestre
Dear R users, I have repeated measurements on individuals. I want to estimate the time-varying effect of a factor variable X (taking three levels), e.g. a model in the spirit of Hastie and Tibshirani (1993). I am considering using the package mgvc which implements generalized additive

[R] creating a package with internal (hiden) S4 classes and methods

2008-09-11 Thread Marie-Pierre Sylvestre
Dear R users, I am writing my first R package and it finally past the R CMD check. Before sending it to CRAN, I would like to check a few issues. 1. I created s4 classes and methods in the package but I want only 1 function (foo) to be available to users and documented in the manual that

[R] building a package that contains S4 classes and methods

2008-09-09 Thread Marie Pierre Sylvestre
Hello R users, I am trying to make a my first package and I get an error that I can understand. The package is build out of three files (one for functions, 1 for s4 classes and 1 for s4 methods). Once I source them I run package.skeleton( name=TDC ) within a R session and I get Creating

[R] Tidying up code - Warning message: deparse may be incomplete

2008-08-28 Thread Marie Pierre Sylvestre
Dear R users, I am currently writing a R package and to do so I am following the guidelines in manual 'Writing R extensions'. In Section 3.1, it is suggested to tidy up the code using a file containing the following: options(keep.source = FALSE) source(myfuns..R) dump(ls(all = TRUE), file =

[R] Fixing the coefficient of a regressor in formula

2008-05-28 Thread Marie-Pierre Sylvestre
Dear R users, I want to estimate a Cox PH model with time-dependent covariates so I am using a counting process format with the following formula: Surv(data$start, data$stop, data$event.time) ~ cluster(data$id) + G1 + G2 + G3 + G4 + G5 +G6 Gs represent a B-spline basis functions so they

[R] assigning and saving datasets in a loop, with names changing with i

2007-12-18 Thread Marie Pierre Sylvestre
Dear R users, I am analysing a very large data set and I need to perform several data manipulations. The dataset is so big that the only way I can play with it without having memory problems (E.g. cannot allocate vectors of size...) is to write a batch script to: 1. cut the data into pieces 2.

[R] Identifying and characterizing strings of NA in a vector

2007-10-11 Thread Marie-Pierre Sylvestre
Dear R users, I was wondering if someone could suggest a few lines of code for my problem. I want to count the number and the length of strings of NA in a vector. For example: vec - c(1, 2, 1, NA, NA, 1, 2, NA, NA, NA, 3, 4, NA, NA) has 2 strings of NA's of length 2 and 1 string of NA' of