similar to: Replacing sets of rows in matrix within a loop

Displaying 20 results from an estimated 10000 matches similar to: "Replacing sets of rows in matrix within a loop"

2012 Jun 18
6
Trying to speed up an if/else statement in simulations
Dear R-help, I am trying to write a function to simulate datasets of size n which contain two time-to-event outcome variables with associated 'Event'/'Censored' indicator variables (flag1 and flag2 respectively). One of these indicator variables needs to be dependent on the other, so I am creating the first and trying to use this to create the second using an if/else statement.
2002 Dec 20
5
Getting graphs into LaTeX
Hello ALL: I ran with success the following commands in R getting a file saved ------------------------------------------------------------------------------------ postscript() postscript('~/data/st202/2003/lecture00/lecture00-graph-01.eps', horizontal = FALSE, height = 6, pointsize = 10) hist(trial.outcome.5, breaks = 5, main = '1000 Replications of 5 Trials of a
2006 Nov 09
2
Meta-regression with lmer() ? If so, how ?
Dear List, I am (again) looking at meta-regression as a way to refine meta-analytic results. What I want to do is to assess the impact of some fixed factors on the results of a meta-analysis. Some of them may be crossed with the main factor of the meta-analysis (e. g. clinical presentation of a disease, defining subgroups in each of the studies under analysis), some of them may be a grouping
2009 Apr 10
1
How to handle tabular form data in lmer without expanding the data into binary outcome form?
Dear R-gurus: I have a question about lmer. Basically, I have a dataset, in which each observation records number of trials (N) and number of events (Y) given a covariate combination(X) and group id (grp_id). So, my dataset is in tabular form. (in case my explanation of tabular form is unclear, please see the link:
2007 May 31
1
Conditional logistic regression for "events/trials" format
Dear R users, I have a large individual-level dataset (~700,000 records) which I am performing a conditional logistic regression on. Key variables include the dichotomous outcome, dichotomous exposure, and the stratum to which each person belongs. Using this individual-level dataset I can successfully use clogit to create the model I want. However reading this large .csv file into R and running
2003 Jan 29
3
Analyzing an unbalanced AB/BA cross-over design
I am looking for help to analyze an unbalanced AB/BA cross-over design by requesting the type III SS ! # Example 3.1 from S. Senn (1993). Cross-over Trials in Clinical Research outcome<-c(310,310,370,410,250,380,330,270,260,300,390,210,350,365,370,310,380,290,260,90,385,400,410,320,340,220) subject<-as.factor(c(1,4,6,7,10,11,14,1,4,6,7,10,11,14,2,3,5,9,12,13,2,3,5,9,12,13))
2006 Mar 03
1
Help with lme and correlated residuals
Dear R - Users I have some problems fitting a linear mixed effects model using the lme function (nlme library). A sample data is as shown at the bottom of this mail. I fit my linear mixed model using the following R code: bmr <-lme (outcome~ -1 + as.factor(endpoint)+ as.factor(endpoint):trt, data=datt, random=~-1 + as.factor(endpoint) + as.factor(endpoint):trt|as.factor(Trial),
2010 Sep 23
2
Error: attempt to apply non-function
This code worked fine for me, then did some cleaning up of formatting using ESS (Emacs) and now I get this error, no idea what is causing it, all the brackets/parentheses seem to be balanced. What have I done wrong? Thanks Jim p0.trial01 <- 0.25 TruOR01 <- 0.80 num.patients.01 <- 50 num.trials.01 <- 5 LOR01.het.in <- 0.00 num.sims <- 1 simLOR01 <-
2006 Feb 03
5
pbinom with size argument 0 (PR#8560)
Full_Name: Uffe H?gsbro Thygesen Version: 2.2.0 OS: linux Submission from: (NULL) (130.226.135.250) Hello all. pbinom(q=0,size=0,prob=0.5) returns the value NaN. I had expected the result 1. In fact any value for q seems to give an NaN. Note that dbinom(x=0,size=0,prob=0.5) returns the value 1. Cheers, Uffe
2003 May 28
1
Test for trend?
Hello R community, I would like to test for learning effects by subjects in my experiment. Each subject participates in six consecutive auction rounds of the same treatment. The response variable is the efficiency of an auction outcome measured by a real number. Since the efficiency increases over the six rounds, I suppose that subjects learn about the rules of the auction institution, but I
2010 Jul 02
1
metafor and meta-analysis at arm-level
Hi, I have been looking for an R package which allowed to do meta-analysis (both pairwise and network/mixed-treatment) at arm-level rather than at trial-level, the latter being the common way in which meta-analysis is done. By arm-level meta-analysis I mean one that accounts for data provided at the level of the individual arms of each trial and that does not simply derive the difference between
2006 Mar 07
1
lme and gls : accessing values from correlation structure and variance functions
Dear R-users I am relatively new to R, i hope my many novice questions are welcome. I have problems accessing some objects (specifically the random effects, correlation structure and variance function) from an object of class gls and lme. I used the following models: yah <- gls (outcome~ -1 + as.factor(Trial):as.factor(endpoint)+
2013 Nov 28
1
Relative Cumulative Frequency of Event Occurence
Hi, My objective is to calculate "Relative (Cumulative) Frequency of Event Occurrence" - something as follows: Sample.Number 1st.Fly 2nd.Fly Did.E.occur? Relative.Cum.Frequency.of.E 1 G B No 0.000 2 B B Yes 0.500 3 B G No 0.333 4 G B No 0.250 5 G G Yes 0.400 6 G B No 0.333 7 B B Yes 0.429 8 G G Yes 0.500 9 G B No 0.444 10 B B Yes 0.500 Please refer to the code below:
2009 Mar 04
2
Selecting one row or multiple rows per ID
Hi, Could someone help with coding this in R? I need to select one row per patient i in clinic j. The data is organized similar to that shown below. Two columns - patient i in column j identify each unique patient. There are two columns on outcome. Some patients have multiple rows with each row representing one visit, coded for in the column, visit. Some patients have just one row indicating
2010 Sep 20
2
OT: Is randomization for targeted cancer therapies ethical?
Hi Folks: **Off Topic** Those interested in clinical trials may find the following of interest: http://www.nytimes.com/2010/09/19/health/research/19trial.html It concerns the ethicality of randomizing those with life-threatening disease to relatively ineffective SOC when new "biologically targeted" therapies "appear" to be more effective. While the context may be new, the
2011 May 13
2
L'abbe plot
I cannot seem to get a L'abbe plot to work on R. I do not understand what the X coordinates, or alternatively an object of class metabin, is supposed to mean. What is a class of metabin? Institute of Behavioral Genetics University of Colorado, Boulder Whitney.Melroy at Colorado.EDU
2007 Mar 30
1
faster computation of cumulative multinomial distribution
Dear list members, I have a series of /unequal/ probabilities [p1,p2,...,pk], describing mutually exclusive events, and a "remainder" class with a probability p0=1-p1-p2-....-pk, and need to calculate, for a given number of trials t>=k, the combined probability that each of the classes 1...k contains at least 1 "event" (the remainder class may be empty). To me this reaks
2011 Mar 31
1
rank of Matrix
Dear list, Can anyone tell me how to obtain the rank of a sparse Matrix, for example from package Matrix (class dgCMatrix)? Here is an example of QR decomposition of a sparse matrix (from the sparseQR class help). library(Matrix) data(KNex) mm <- KNex$mm str(mmQR <- qr(mm)) Similarly, using the functions/classes from the relatively new MatrixModels package: library(MatrixModels)
2009 Mar 10
1
Nesting order for mixed models
Hello, I am confused about the order of nesting in mixed models using functions like aov(), lme(), lmer(). I have the following data: n subjects in either condition A or B each subject tested at each of 3 numerical values ("distance" = 40,50,60), repeated 4 times for each of the 3 numerical values ("trial" = 1,2,3,4) Variable summary: Condition: 2 level factor Distance:
2012 Aug 17
3
Error: level sets of factors are different?
Why the error is coming? even though the length of outcome.new$compkey and outcome.new$armkey were exactly same. Can anyone help? setwd("D:/AZ") library("RODBC") cdb_cnct <- odbcConnectExcel("AZIF_DC_GVK_NSCLC_MSALL_287papers_02072012_141450_v1_4.xls") outcomes <- sqlFetch(cdb_cnct, "Outcomes_info") odbcClose(cdb_cnct) rm(cdb_cnct)