similar to: repeat write.table with the same code many times

Displaying 20 results from an estimated 9000 matches similar to: "repeat write.table with the same code many times"

2011 Oct 18
1
Repeat a loop until...
Dear all, I know there have been various questions posted over the years about loops but I'm afraid that I'm still stuck. I am using Windows XP and R 2.9.2. I am generating some data using the multivariate normal distribution (within the 'mnormt' package). [The numerical values of sanad and covmat are not important.] > datamat <-
2017 Sep 14
3
Help understanding why glm and lrm.fit runs with my data, but lrm does not
Dear all, I am using the publically available GustoW dataset. The exact version I am using is available here: https://drive.google.com/open?id=0B4oZ2TQA0PAoUm85UzBFNjZ0Ulk I would like to produce a nomogram for 5 covariates - AGE, HYP, KILLIP, HRT and ANT. I have successfully fitted a logistic regression model using the "glm" function as shown below. library(rms) gusto <-
2017 Sep 14
1
Help understanding why glm and lrm.fit runs with my data, but lrm does not
Fixed 'maxiter' in the help file. Thanks. Please give the original source of that dataset. That dataset is a tiny sample of GUSTO-I and not large enough to fit this model very reliably. A nomogram using the full dataset (not publicly available to my knowledge) is already available in http://biostat.mc.vanderbilt.edu/tmp/bbr.pdf Use lrm, not lrm.fit for this. Adding maxit=20 will
2008 Oct 28
3
Dose Profile
Hi Everyone, I have data in a long format e.g. there is one row per patient but each follow-up appointment is included in the row. So, a snippet of the data looks like this: TrialNo Drug Sex Rand Adate1 Date1 Dose1 Time1 Adate2 Date2 Dose2 Time2 B1001029 LTG M 15719 30/04/2003 15825 150 106 29/08/2003 15946 200 227 B1117003 LTG M 15734 30/04/2003 15825 200 91 03/09/2003 15951 250 217
2011 Nov 23
1
Measure of separation for survival data
Dear all, I am using R 2.9.2 on Windows XP. I am undertaking a simulation study to consider methods of external validation in the context of missing covariates in the validation data set. I would like to use Royston's measure of prognostic separation as a method of external validation. Although there is no R code for this, the author informs me that it should be easy: 1. Calculate the
2010 May 25
2
Relative Risk/Hazard Ratio plots for continuous variables
Dear all, I am using Windows and R 2.9.2 for my analyses. I have a large dataset and I am particularly interested in looking at time to an event for a continuous variable. I would like to produce a plot of log(relative risk) or relative risk (also known as hazard ratio) against the continuous variable. I have spent a long time looking for advice on how to do this but my search has proved
2017 Sep 14
0
Help understanding why glm and lrm.fit runs with my data, but lrm does not
> On Sep 14, 2017, at 12:30 AM, Bonnett, Laura <L.J.Bonnett at liverpool.ac.uk> wrote: > > Dear all, > > I am using the publically available GustoW dataset. The exact version I am using is available here: https://drive.google.com/open?id=0B4oZ2TQA0PAoUm85UzBFNjZ0Ulk > > I would like to produce a nomogram for 5 covariates - AGE, HYP, KILLIP, HRT and ANT. I have
2009 Nov 30
1
Using stepAIC to produce a p-value for when a particular variable was taken out of the model
Dear all, I have decided after much deliberation to use backward elimination and forward selection to produce a multivariate model. Having read about the problems with choosing selection values I have chosen to base my decisions of inclusion and exclusion on the AIC and am consequently using the stepAIC function. This post however does not relate to whether or not this is the correct decision!
2018 Mar 02
1
Variable centring within "predict.coxph"
Dear R-help, I am using R-3.3.2 on Windows 10. I teach on a course which has 4 computer practical sessions related to the development and validation of clinical prediction models. These are currently written for Stata and I am in the process of writing them for use in R too (as I far prefer R to Stata!) I notice that predictions made from a Cox model in Stata are based on un-centred variables,
2009 Jun 09
2
Isolating a single plot from plots produced simultaneously
Dear R-Help, I am using the 'mfp' package. It produces three plots (as I am using the Cox model) simultaneously which can be viewed together using the following code: fit <- mfp(Surv(rem.Remtime,rem.Rcens)~fp(age)+strata(rpa),family=cox,data=nearma,select=0.05,verbose=TRUE) par(mfrow=c(2,2)) plot(fit) They can be viewed separately but the return key must be pressed after each graph
2009 Apr 03
2
Schoenfeld Residuals
Dear All, Sorry to bother you again. I have a model: coxfita=coxph(Surv(rem.Remtime/365,rem.Rcens)~all.sex,data=nearma) and I'm trying to do a plot of Schoenfeld residuals using the code: plot(cox.zph(coxfita)) abline(h=0,lty=3) The error message I get is: Error in plot.window(...) : need finite 'ylim' values In addition: Warning messages: 1: In sqrt(x$var[i, i] * seval) : NaNs
2008 Oct 13
1
na.pass
Hi All, I have a data frame which has columns comprised mainly of "NA"s. I know there are functions na.pass and na.omit etc which can be used in these situations however I can't them to work in this case. I have a function which returns the data according to some rule i.e. removal of N in this code: nep <- function(data) { dummy <- rep(0,378) for(i in 1:378){
2011 Sep 15
1
Where to put tryCatch or similar in a very big for loop
Dear all, I am running a simulation study to test variable imputation methods for Cox models using R 2.9.0 and Windows XP. The code I have written (which is rather long) works (if I set nsim = 9) with the following starting values. >bootrs(nsim=9,lendevdat=1500,lenvaldat=855,ac1=-0.19122,bc1=-0.18355,cc1=-0.51982,cc2=-0.49628,eprop1=0.98,eprop2=0.28,lda=0.003) I need to run the code 1400
2008 Sep 29
1
Hazard plot
Hi All, This sounds a relatively simple query, and I hope it is! I am looking at a continuous variable, age. I am looking at time to 12-month remission and can calculate the HR and 95% confidence interval are follows: coxfita = coxph(Surv(rem.Remtime,rem.Rcens)~nearma$all.age,data=nearma) exp(coxfita$coefficients) exp(confint(coxfita)) However, because I am looking at age as a continuous
2018 May 24
1
Predictions from a Cox model - understanding centering of binary/categorical variables
Dear all, I am using R 3.4.3 on Windows 10. I am preparing some teaching materials and I'm having trouble matching the by-hand version with the R code. I have fitted a Cox model - let's use the ovarian data as an example: library(survival) data(ovarian) ova_mod <- coxph(Surv(futime,fustat)~age+rx,data=ovarian) If I want to make predict survival for a new set of individuals at 100
2008 Apr 09
1
If statements for vectors
Dear Sirs, I am using both the Bioconductor adds on (Affy, AffyPLM,...) and the 'standard' R-package. I am trying to select a list of genes which all have expression values below a certain threshold. I have done this by creating a vector which has 0s where the expression is greater than the threshold and 1s where it is less than or equal to it. Multiplying this vector by the expression
2011 May 05
1
Confidence interval for difference in Harrell's c statistics (or equivalently Somers' D statistics)
Dear All, I am trying to calculate a 95% confidence interval for the difference in two c statistics (or equivalently D statistics). In Stata I gather that this can be done using the lincom command. Is there anything similar in R? As you can see below I have two datasets (that are actually two independent subsets of the same data) and the respective c statistics for the variables in both cases.
2012 Feb 07
2
Actual vs. predicted survival times
Dear R-help, I am using R 2.14.1 on Windows 7. I would like to produce a plot like the attached - although simplified to actual vs. Predicted survival time with distinguishing marks for censored and observed points. I have a dataset and have fitted a Cox model to it. In an attempt to visualise how accurate the model is it would be ideal if I could plot the actual survival times against the
2009 May 22
1
Forcing a variableinto a model using stepAIC
Dear All, I am attempting to use forward and/or backward selection to determine the best model for the variables I have. Unfortunately, because I am dealing with patients and every patient is receiving treatment I need to force the variable for treatment into the model. Is there a way to do this using R? (Additionally, the model is stratified by randomisation period). I know that SAS can be
2009 Mar 26
1
Centring variables in Cox Proportional Hazards Model
Dear All, I am contemplating centering the covariates in my Cox model to reduce multicollinearity between the predictors and the interaction term and to render a more meaningful interpretation of the regression coefficient. Suppose I have two indicator variables, x1 and x2 which represent age categories (x1 is patients less than 16 while x2 is for patients older than 65). If I use the following