[R] random effect variance per treatment group in lmer

2007-07-08 Thread Afshartous, David
All, How does one specify a model in lmer such that say the random effect for the intercept has a different variance per treatment group? Thus, in the model equation, we'd have say b_ij represent the random effect for patient j in treatment group i, with variance depending on i, i.e,

Re: [R] maintaining specified factor contrasts when subsetting in lmer

2007-07-07 Thread Afshartous, David
. Zagmutt [mailto:[EMAIL PROTECTED] Sent: Friday, July 06, 2007 6:40 PM To: Afshartous, David Cc: r-help@stat.math.ethz.ch Subject: Re: maintaining specified factor contrasts when subsetting in lmer See ?relevel Regards, Francisco Afshartous, David wrote: All, I'm using lmer for some repeated

[R] maintaining specified factor contrasts when subsetting in lmer

2007-07-06 Thread Afshartous, David
All, I'm using lmer for some repeated measures data and have specified the contrasts for a time factor such that say time 3 is the base. This works fine. However, when I next use the subset argument to remove the last two time values, the output indicates that the specified contrast is not

[R] summarizing dataframe at variable/factor levels

2007-07-05 Thread Afshartous, David
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).

[R] xyplot and autokey, maintaining colors specified via col in key

2007-07-03 Thread Afshartous, David
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

[R] applying max elementwise to two vectors

2007-06-28 Thread Afshartous, David
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 =

Re: [R] applying max elementwise to two vectors

2007-06-28 Thread Afshartous, David
thanks all. yes, pmax(x,y) gets it straight away. sorry for missing this when I checked the docs. -Original Message- From: Greg Snow [mailto:[EMAIL PROTECTED] Sent: Thursday, June 28, 2007 5:26 PM To: Afshartous, David; r-help@stat.math.ethz.ch Subject: RE: [R] applying max

[R] xyplot with par

2007-06-27 Thread Afshartous, David
All, Is there are a simple way to plot multiple xyplots on the same page in the code below (it currently overwrites the first plot w/ the second). I searched the archives and saw a similar question but the answer didn't seem to work. thanks dave x1 = rnorm(10) x2 = rnorm (10) y1 = rnorm(10) y2 =

Re: [R] treatment effect at specific time point within mixedeffects model

2006-10-06 Thread Afshartous, David
-Original Message- From: Chuck Cleland [mailto:[EMAIL PROTECTED] Sent: Friday, October 06, 2006 5:32 AM To: Afshartous, David Subject: Re: [R] treatment effect at specific time point within mixedeffects model Afshartous, David wrote: The data structure is a repeated measures

Re: [R] treatment effect at specific time point within mixed effects model

2006-10-05 Thread Afshartous, David
+ factor(time)3 + DrugP + factor(time)3:drugP I'm surprised this isn't simple or maybe I'm missing something competely. thanks dave -Original Message- From: Spencer Graves [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 04, 2006 7:11 PM To: Afshartous, David Cc: r-help@stat.math.ethz.ch

Re: [R] treatment effect at specific time point within mixedeffects model

2006-10-05 Thread Afshartous, David
, does anyone know why this occurs? I apologize if my explanation above is confusing, I've tried to make it as clear as possible. thanks again, dave -Original Message- From: Doran, Harold [mailto:[EMAIL PROTECTED] Sent: Thursday, October 05, 2006 11:40 AM To: Afshartous, David; Spencer

[R] treatment effect at specific time point within mixed effects model

2006-09-26 Thread Afshartous, David
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

Re: [R] plotting grouped data object

2006-09-25 Thread Afshartous, David
-Original Message- From: X.H Chen [mailto:[EMAIL PROTECTED] Sent: Saturday, September 23, 2006 6:25 PM To: Afshartous, David; r-help@stat.math.ethz.ch Subject: RE: [R] plotting grouped data object I don't get your meaning in what is in datagrp, anyway, try: X11() par(new=T) before calling: plot

Re: [R] plotting grouped data object

2006-09-25 Thread Afshartous, David
thanks! -Original Message- From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] Sent: Monday, September 25, 2006 1:34 PM To: Afshartous, David Cc: r-help@stat.math.ethz.ch Subject: Re: [R] plotting grouped data object On 9/23/06, Afshartous, David [EMAIL PROTECTED] wrote: All, I'd like

[R] plotting grouped data object

2006-09-23 Thread Afshartous, David
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

[R] plotting all subgroups with augPred

2006-09-14 Thread Afshartous, David
All, I have a question RE plotting the prediction lines of a random effects model via augPred. I'll illustrate via the Pixel dataset within the nlme package: library(nlme) attach(Pixel) fm1Pixel = lme(pixel ~ day + I(day^2), data = Pixel, random = list(Dog = ~ 1)) plot(augPred(fm1Pixel)) ###

[R] levels of factor when subsetting the factor

2006-09-12 Thread Afshartous, David
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?

Re: [R] levels of factor when subsetting the factor

2006-09-12 Thread Afshartous, David
, David Cc: r-help@stat.math.ethz.ch Subject: Re: [R] levels of factor when subsetting the factor Afshartous, David [EMAIL PROTECTED] writes: 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

Re: [R] augPred plot in nlme library

2006-09-11 Thread Afshartous, David
[mailto:[EMAIL PROTECTED] Sent: Monday, September 11, 2006 2:52 AM To: Afshartous, David; r-help@stat.math.ethz.ch Subject: Re: [R] augPred plot in nlme library Hi please try not to hide an information plot(augPred(fm2c)) Error in log(distance) : object distance not found Is it what you have got

Re: [R] augPred plot in nlme library

2006-09-09 Thread Afshartous, David
me know and I'll send it directly. -Original Message- From: Andrew Robinson [mailto:[EMAIL PROTECTED] Sent: Friday, September 08, 2006 5:46 PM To: Afshartous, David Cc: Deepayan Sarkar; r-help@stat.math.ethz.ch Subject: Re: [R] augPred plot in nlme library Hi David, this is the sort

Re: [R] augPred plot in nlme library

2006-09-09 Thread Afshartous, David
, control=contr) plot(augPred(fm2c)) -Original Message- From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] Sent: Saturday, September 09, 2006 11:46 AM To: Afshartous, David Cc: Andrew Robinson; r-help@stat.math.ethz.ch Subject: Re: [R] augPred plot in nlme library On 9/9/06, Afshartous, David

Re: [R] augPred plot in nlme library

2006-09-08 Thread Afshartous, David
model. Does anyone know how to make sure that augPred plots the same model as that specified in the model (as below)? cheers, dave From: Afshartous, David Sent: Thursday, September 07, 2006 6:18 PM To: r-help@stat.math.ethz.ch Cc: Afshartous, David Subject

Re: [R] augPred plot in nlme library

2006-09-08 Thread Afshartous, David
(fm3comp)) Possibly augPred behaves differently in R than in S, but reading the R help and trying various other approaches has not solved this. Thanks! Dave -Original Message- From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] Sent: Friday, September 08, 2006 4:37 PM To: Afshartous, David Cc

[R] augPred plot in nlme library

2006-09-07 Thread Afshartous, David
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 ~

[R] Covariance/Correlation matrix for repeated measures data frame

2006-09-06 Thread Afshartous, David
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

[R] collapsing plot lines

2006-07-13 Thread Afshartous, David
All, When plotting a group data object, is there a way to have the plots of all the groups collapsed onto one plot, i.e., instead of separate panels as would be produced from example below? grouped.data.example - groupedData(Y ~ Time | Patient_no, data = example.frm)

[R] sapply question

2006-06-28 Thread Afshartous, David
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

Re: [R] sapply question

2006-06-28 Thread Afshartous, David
) { r[i] = 2*U[i] } r ## results for each patient } ) result } -Original Message- From: Liaw, Andy [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 28, 2006 10:23 AM To: Afshartous, David; r-help@stat.math.ethz.ch Subject: RE: [R

Re: [R] sapply question

2006-06-28 Thread Afshartous, David
:15 PM To: Afshartous, David; r-help@stat.math.ethz.ch Subject: RE: [R] sapply question Here's an example, using a data frame with two variables plus a grouping factor: (dat - data.frame(x1=1:10, x2=10:1, g=gl(2, 5))) x1 x2 g 1 1 10 1 2 2 9 1 3 3 8 1 4 4 7 1 5 5 6 1 6 6 5 2 7

[R] supplying dynamic main argument to plot?

2006-06-27 Thread Afshartous, David
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),

Re: [R] appending

2006-06-15 Thread Afshartous, David
creatine.function.new() ### The names are the concatenation of the patient and the observation ## e.g. patient 24 observation 6 is labeled 246. -Original Message- From: Martin Henry H. Stevens [mailto:[EMAIL PROTECTED] Sent: Thursday, June 15, 2006 7:00 AM To: Afshartous, David Cc: r-help

[R] appending

2006-06-14 Thread Afshartous, David
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

Re: [R] appending

2006-06-14 Thread Afshartous, David
. Stevens [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 14, 2006 1:23 PM To: Afshartous, David Cc: r-help@stat.math.ethz.ch Subject: Re: [R] appending Hi David, It would be helpful if you supply a little data, upon which this would operate. Hank On Jun 14, 2006, at 12:31 PM, Afshartous, David wrote

[R] workspace question

2006-02-03 Thread Afshartous, David
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

[R] memory management

2005-12-01 Thread Afshartous, David
All, I've written some functions that use a list and a list of sub-lists and I'm running into memory problems, even after changing memory.limit. Does it make any difference to the handling of memory if I use simple vectors and matrices instead of the list and list of sub-lists? I suspect

[R] save to ascii

2005-11-16 Thread Afshartous, David
All, Usually when I save a variable I have ascii = FALSE since I usually load the variable via the load(variable) command and do not need to view the variable outside of R. When I set ascii = TRUE and view the variable outside of R in a text editor, I notice additional characters (starting w/

[R] memory.size

2005-10-17 Thread Afshartous, David
All, In the help for memory.size, there is: Details: Command-line flag '--max-mem-size' sets the maximum value of obtainable memory (including a very small amount of housekeeping overhead). How does one implement a command-line flag in order to set the max for memory? cheers,

Re: [R] symbol print-name too long

2005-10-12 Thread Afshartous, David
-Original Message- From: Spencer Graves [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 11, 2005 9:05 PM To: Afshartous, David Cc: r-help@stat.math.ethz.ch; [EMAIL PROTECTED] Subject: Re: [R] symbol print-name too long Have you received a reply or otherwise resolved this issue

[R] wildcards and removing variables

2005-10-10 Thread Afshartous, David
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 [EMAIL PROTECTED]

[R] index question

2005-10-07 Thread Afshartous, David
All, I'm having a problem selecting directly from a vector. I've written ways to do this indirectly, but I'd rather do it directly and didn't see this in the manual. Essentially, I have: group.label.new [1] 7 9 6 1 10 4 8 3 2 5 junk [1] 1 2 group.label.new[junk 8:10] [1] 7 9

[R] function agruments

2005-10-07 Thread Afshartous, David
All, When defining the arguments of a function, is it possible to supply a function as an argument? If so, how is this introduced into the function code as well? For example, in the body of the function I have: result = function(x) and I'd like to supply either function.1 or

[R] symbol print-name too long

2005-10-03 Thread Afshartous, David
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

[R] diagonal matrices

2005-08-20 Thread Afshartous, David
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

[R] numeric operations w/ lists

2005-08-09 Thread Afshartous, David
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