similar to: plotting grouped data object

Displaying 20 results from an estimated 6000 matches similar to: "plotting grouped data object"

2006 Sep 07
5
augPred plot in nlme library
All, I'm trying to create an augPred plot in the nlme library, similar to the plot on p.43 of Pinheiro & Bates (Mixed Effects Models in S and S-Plus) for their Pixel data. My data structure is the same as the example but I still get the error msg below. > comp.adj.UKV <- groupedData(adj.UKV ~ Time | Patient_no/Lisinopril, data = comp.adj.UKV.frm, order.groups = F) >
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 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
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.
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
2006 Sep 06
1
Covariance/Correlation matrix for repeated measures data frame
All, I have a repeated measures data frame and was wondering if the covariance matrix can be calculated via some created indexing or built-in R function. Specifically, say there are 3 variables, where potassium concentration is measured 6 times on each patient. Patient number (discrete) Time (1 to 6, discrete) Potassium (continuous variable) I want the covariance/correlation matrix for the
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
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
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
2007 Jul 03
1
xyplot and autokey, maintaining colors specified via "col" in key
All, When specifying colors to xyplot w/ a groups argument, using auto.key no longer maintains the colors properly. I've searched the docs and help but haven't found exactly what I need ... I saw a few examples in the archives involving par.settings but that doesn't seem to do it. I also saw some people using key instead of auto.key, but that didn't seem consistent. Is there a
2006 Oct 05
2
treatment effect at specific time point within mixedeffects model
Hi David: In looking at your original post it is a bit difficult to ascertain exactly what your null hypothesis was. That is, you want to assess whether there is a treatment effect at time 3, but compared to what. I 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-----
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
2010 Jun 02
2
pdf function, resize xyplot plot automatically
All, When saving plots to a pdf file via the pdf function, I would like to be able to automatically expand the graphics device to achieve the same result as when one does this manually (e.g., clicking the green expand button on the upper left of the graph on Mac OS). Consider simple example below: library("lattice") foo.frm = data.frame(Subject = rep(c(1:4), each = 9), Y =
2009 Jul 24
1
Aggregate, max and time of max
All, For data consisting of serial measurements on subjects, one may use the aggregate function to say compute the peak response for each subject for each design condition. Is there a way to alter this or another one-liner to also retain the time at which the peak occurred and thus avoid writing a doing this via a loop? I suppose one could attempt to employ the split function but that's
2005 Oct 03
2
"symbol print-name too long"
All, I've coded a function and it works manually if I copy it line by line into R. However, when I try to "load" (copy and paste) the entire function into R, I get the following error after the listed line of code: + N.j.list = lapply(rej.hyp, length) Error: symbol print-name too long Does anyone you know what this error means? Strangely, when I copy the same line verbatim
2001 Dec 03
3
beginner's questions about lme, fixed and random effects
I'm trying to understand better the differences between fixed and random effects by running very simple examples in the nlme package. My first attempt was to try doing a t-test in lme. This is very similar to the Rail example that comes with nlme, but it has two groups instead of five. So I try a1 <- 1:10 a2 <- 7:16 t.test(a2,a1) getting t(18)=4.43, p=.0003224. Then I try to do it
2007 Oct 12
2
Basic plot question: Figure 1.1 Pinheiro & Bates
All, Sorry for overly simplistic question, but I can't seem to remember how to create the basic plot shown in Figure 1.1 of Pinheiro & Bates (2004; p.4). The y-axis delineates a factor (Rail) while the x-axis displays the distribution of a continuous variable (time) according to each level of the factor. Didn't see it in archives but perhaps I'm not searching on correct key words,
2005 Oct 10
2
wildcards and removing variables
All, Is there are a wildcard in R for varible names as in unix? For example, rm(results*) to remove all variable or function names that begin w/ "results"? cheers, Dave ps - please respond directly to afshar@miami.edu [[alternative HTML version deleted]]
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