search for: afshart

Displaying 20 results from an estimated 53 matches for "afshart".

2006 Sep 07
5
augPred plot in nlme library
...variable lengths differ I've checked all the variale lengths, and have also made sure that factors are correctly defined as factors. Is there anything special I need to be doing for augPred to work correctly? I checked the help but didn't find much. cheers, dave David Afshartous, PhD University of Miami School of Business Rm KE-408 Coral Gables, FL 33124 [[alternative HTML version deleted]]
2006 Sep 12
11
levels of factor when subsetting the factor
All, When I take a subset of a factor the reduced factor still maintains all the original levels of the factor when say forming the key in a plot. The data is correct, but the variable still "remembers" the original levels. See below for reproducible code. Does anyone know how to fix this? cheers, dave fact = as.factor(c(rep("A", 3),rep("B", 3), rep("C",
2006 Jun 28
5
sapply question
sent this to the list yesterday but didn't see it listed in the daily summary ... apologies if you receive it twice ... ________________________________ From: Afshartous, David Sent: Tuesday, June 27, 2006 10:02 AM To: 'r-help@stat.math.ethz.ch' Subject: sapply question All: I'm trying to use sapply to break up data within another function. (tapply doens't seem to work since I want to access several variables of a data set, not just break u...
2006 Sep 23
4
plotting grouped data object
All, I'd like to plot the main relationship of a grouped data object for all levels of a factor in a single panel. The sample code below creates a separate panel for each level of the factor. I realize that this could be done in other ways, but I'd like to do it via plotting the grouped data object. thanks! dave z = rnorm(18, mean=0, sd=1) x = rep(1:6, 3) y =
2005 Oct 03
2
"symbol print-name too long"
...nually apart from the whole function, no error message results. I've checked the manuals and don't see anything RE print-name too long. I also tried google and saw an old message on this error message, but it doesn't seem to apply here. Thanks, Dave ps - please respond directly to dafshartous@yahoo.com please. David Afshartous, PhD University of Miami Department of Management Science School of Business Coral Gables, FL 33124 phone: 305-284-8005 [[alternative HTML version deleted]]
2006 Jun 27
2
supplying dynamic main argument to plot?
All, Simple question but I don't seem to be able to find the answer in the documentation: When using "plot" within a loop, is there any way to supply the argument to "main" dynamically, i.e., so that the title is Patient k below as the loop cycles through each value of k? plot(x,y, xlim=c(0,250), ylim=c(0,1000), xlab="gamma", ylab="r1",
2007 Jul 05
3
summarizing dataframe at variable/factor levels
All, Is there an efficient way to apply say "mean" or "median" to a dataframe according to say all combinations of two variables in the dataframe? Below is a simple example and the outline of a "manual" solution that will work but is not very efficient (could also generalize this to a function). Searched the archives and docs but didn't see anything close to
2008 May 20
5
Alignment of axes intersection
All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical parameters under par(graphics) but can't seem to find it. Thanks! David
2006 Sep 06
1
Covariance/Correlation matrix for repeated measures data frame
...orrelation matrix for the cov/corr between Potassium at time i and time j. Is this possible in the current dataframe format? Or do I have to define new varialbes, say Time i and Time j, and then compute the cov/corr between Time i and Time j for all combinations? Cheers, Dave David Afshartous, PhD University of Miami School of Business Rm KE-408 Coral Gables, FL 33124 [[alternative HTML version deleted]]
2006 Oct 05
2
treatment effect at specific time point within mixedeffects model
...think your second post clears this up. You should refer to pages 224- 225 of Pinhiero and Bates for your answer. This shows how to specify contrasts. > -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of > Afshartous, David > Sent: Thursday, October 05, 2006 11:08 AM > To: Spencer Graves > Cc: r-help at stat.math.ethz.ch > Subject: Re: [R] treatment effect at specific time point > within mixedeffects model > > Hi Spencer, > > Thanks for your reply. > I don't think this an...
2007 Jun 28
3
applying max elementwise to two vectors
All, Is there one liner way to obtain the max per observation for two vectors? I looked at apply and lapply but it seems that groundwork would have to be done before applying either of those. The code below does it but seems like overkill. Thanks! Dave x = rnorm(10) y = rnorm(10) ind = which(x < y) z = x z[ind] <- y[ind] ## z now contains the max's
2010 Jun 02
2
pdf function, resize xyplot plot automatically
...anually that would be great. Any tips much appreciated. pdf(file = "foo.pdf", onefile = T) xyplot(Y ~ Time | as.factor(Subject), data = foo.frm, scale = list(x = list(at = c(0, 15, 30, 45, 60, 90, 150, 210, 270)))) dev.off() Thanks, David -------------------------------------- David Afshartous, Ph.D. Research Assistant Professor University of Miami, Miller School of Medicine Division of Clinical Pharmacology 1500 N.W. 12th Avenue, 15th Floor West Miami, Florida 33136 E-mail: afshar at med.miami.edu Phone: +1 305-243-1549
2008 Jun 26
3
Connecting lines across missing data points, xyplot
...5 time points that I am graphing via xyplot, along with error bars. For one of the variables I have missing data for two of the time points. The code below is okay but I can't seem to get the lines to connect across the missing time points. Does anyone now how to rectify this? Cheers, David Afshartous library(lattice) ## the data junk = data.frame( Visit = as.factor(rep(seq(1,5), 2)), Drug = rep(c("D", "P"), each = 5), Aldo = c(13, NA, NA, 15, 14, 12, NA, NA, 14, 13), SE.Aldo = c(3, NA, NA, 3, 3, 2, NA, NA, 2, 2), lower.ci.Aldo = c(10, NA, NA, 12, 11, 10,NA, NA, 12,...
2006 Jun 14
3
appending
All, In the function below I have 24 individuals and 6 calculations per individual. The 6 calculations are collected each time in a 1:24 loop when calculating "delta". I'd like to collect all 144 = 24*6 calculations in one vector ("delta.patient.comb"). The function works as is via indexing, but is there an easier way to collect the measurements via appendinng the 6
2005 Aug 09
2
numeric operations w/ lists
Hello all, X is a list of 20 lists, and each individual list has 65 elements. Y is a list of 65 elements. WANT: subtract Y from each of the 20 lists in X. Here's what I tried and the error messages: > X - rep(Y, 20) Error in X - rep(Y 20) : non-numeric argument to binary operator I tried several methods w/o success. Any suggestions kindly appreciated. Thanks, Dave ps - please copy
2005 Aug 20
2
diagonal matrices
Hello all, I have matrices V.i of dimension n.i x n.i, where i = 1, ..., J, and the sum of n.i equals N. (and n.i ! = n.j) goal: create one large matrix V, where V has matrices V.i on diagonal. I create each matrix V.i in a for loop (1 to J), so each time I'd like to augment V with the most recently calculated V.i, such that I'll have V after the final iteration of the for loop.
2009 Jul 24
1
Aggregate, max and time of max
...= aggregate(data.ex[c(1)], data.ex[c(3,4)], max) ## this provides the peak of each subject on each treatment, but time is ## lost. Including time in the statement doesn't help clearly as then ## the peak of all the times will be calculated David -------------------------------------- David Afshartous, Ph.D. Research Assistant Professor University of Miami, Miller School of Medicine Division of Clinical Pharmacology 1500 N.W. 12th Avenue, 15th Floor West Miami, Florida 33136 E-mail: afshar at med.miami.edu Phone: +1 305-243-1549
2008 Jan 24
3
Alternating numbers in rep()
All, I'm trying to obtain a one-liner to generate a certain sequence of alternatign numbers. Consider: > unlist(rep(list(c(1,2), c(3,4)), each = 6)) [1] 1 2 1 2 1 2 1 2 1 2 1 2 3 4 3 4 3 4 3 4 3 4 3 4 I'd like the result to be as above but continue until 38. Of course, I could hardcode this going up to c(37,38), but is there a more elegant way? Thanks! David
2006 Sep 26
2
treatment effect at specific time point within mixed effects model
All, The code below is for a pseudo dataset of repeated measures on patients where there is also a treatment factor called "drug". Time is treated as categorical. What code is necessary to test for a treatment effect at a single time point, e.g., time = 3? Does the answer matter if the design is a crossover design, i.e, each patient received drug and placebo? Finally, what would
2006 Feb 03
2
workspace question
All, When starting R, how does one prevent the loading the previous workspace which was saved? I'd like to start a new project and save the new image in a different directory, but I'd like to partition this from the old project. Does there exist a better way than just deleting the files associated w/ the old project manually? I looked in the Intro to R manual and searched for