[R] 2007 John M. Chambers Statistical Software Award

2006-11-09 Thread J.R. Lockwood
(sorry for cross-posting)

John M. Chambers Statistical Software Award

Statistical Computing Section
American Statistical Association

The Statistical Computing Section of the American Statistical
Association announces the competition for the John M. Chambers
Statistical Software Award. In 1998 the Association for Computing
Machinery presented its Software System Award to John Chambers for the
design and development of S. Dr. Chambers generously donated his award
to the Statistical Computing Section to endow an annual prize for
statistical software written by an undergraduate or graduate student.
The prize carries with it a cash award of $1000, plus a substantial
allowance for travel to the annual Joint Statistical Meetings where
the award will be presented.

Teams of up to 3 people can participate in the competition, with the
cash award being split among team members. The travel allowance will
be given to just one individual in the team, who will be presented the
award at JSM.  To be eligible, the team must have designed and
implemented a piece of statistical software.  The individual within
the team indicated to receive the travel allowance must have begun the
development while a student, and must either currently be a student,
or have completed all requirements for her/his last degree after
January 1, 2004.  To apply for the award, teams must provide the
following materials:

   Current CV's of all team members.

   A letter from a faculty mentor at the academic institution of the
   individual indicated to receive the travel award.  The letter
   should confirm that the individual had substantial participation in
   the development of the software, certify her/his student status
   when the software began to be developed (and either the current
   student status or the date of degree completion), and briefly
   discuss the importance of the software to statistical practice.

   A brief, one to two page description of the software, summarizing
   what it does, how it does it, and why it is an important
   contribution.  If the team member competing for the travel
   allowance has continued developing the software after finishing
   her/his studies, the description should indicate what was developed
   when the individual was a student and what has been added since.

   Access to the software by the award committee for their use on
   inputs of their choosing.  Access to the software can consist of an
   executable file, Web-based access, macro code, or other appropriate
   form.  Access should be accompanied by enough information to allow
   the judges to effectively use and evaluate the software (including
   its design considerations.)  This information can be provided in a
   variety of ways, including but not limited to a user manual (paper
   or electronic), a paper, a URL, online help to the system, and
   source code.  In particular, the entrant must be prepared to
   provide complete source code for inspection by the committee if
   requested.

All materials must be in English.  We prefer that electronic text be
submitted in Postscript or PDF.  The entries will be judged on a
variety of dimensions, including the importance and relevance for
statistical practice of the tasks performed by the software, ease of
use, clarity of description, elegance and availability for use by the
statistical community. Preference will be given to those entries that
are grounded in software design rather than calculation.  The decision
of the award committee is final.

All application materials must be received by 5:00pm EST, Monday,
February 26, 2007 at the address below.  The winner will be announced
in May and the award will be given at the 2007 Joint Statistical
Meetings.

Information on the competition can also be accessed on the website of
the Statistical Computing Section (www.statcomputing.org or see the
ASA website, www.amstat.org for a pointer), including the names and
contributions of previous winners.  Inquiries and application
materials should be emailed or mailed to:

   Chambers Software Award
   c/o J.R. Lockwood
   The RAND Corporation
   4570 Fifth Avenue, Suite 600
   Pittsburgh, PA 15213
   [EMAIL PROTECTED]




This email message is for the sole use of the intended recip...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating Movies with R

2006-09-22 Thread J.R. Lockwood
 plots are an example of the plots I'd like to use to
  make an animation
  
  
  g - expand.grid(x = newx, y = newy)
  
  instant-100
  mydens-rho_x_t[ instant, ]%o%rho_y_t[ instant, ]/(max(rho_x_t[
  instant, ]%o%rho_y_t[ instant, ]))
  
  
  lentot-nx^2
  dim(mydens)-c(lentot,1)
  
  g$z-mydens
  jpeg(dens-t-3.jpeg)
  print(wireframe(z ~ x * y, g, drape = TRUE,shade=TRUE,
  scales = list(arrows = FALSE),pretty=FALSE, aspect = c(1,1), colorkey = TRUE
  ,zoom=0.8, main=expression(Density at t=2), zlab =
  list(expression(density),rot = 90),distance=0.0,
  perspective=TRUE,#screen = list(z = 150, x = -55,y= 0)
  ,zlim=range(c(0,1
  dev.off()
  
  
  instant-300
  mydens-rho_x_t[ instant, ]%o%rho_y_t[ instant, ]/(max(rho_x_t[
  instant, ]%o%rho_y_t[ instant, ]))
  
  
  lentot-nx^2
  dim(mydens)-c(lentot,1)
  
  g$z-mydens
  jpeg(dens-t-3.jpeg)
  print(wireframe(z ~ x * y, g, drape = TRUE,shade=TRUE,
  scales = list(arrows = FALSE),pretty=FALSE, aspect = c(1,1), colorkey = TRUE
  ,zoom=0.8, main=expression(Density at t=3), zlab =
  list(expression(density),rot = 90),distance=0.0,
  perspective=TRUE,#screen = list(z = 150, x = -55,y= 0)
  ,zlim=range(c(0,1
  dev.off()
  
  
  
  
  Kind Regards
  
  Lorenzo
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 -- 
 http://biostat.mc.vanderbilt.edu/JeffreyHorner
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/statistics/bios/



This email message is for the sole use of the intended recip...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 2007 Computing/Graphics Student Paper Competition

2006-09-18 Thread J.R. Lockwood
Statistical Computing and Statistical Graphics Sections
American Statistical Association
Student Paper Competition 2007

The Statistical Computing and Statistical Graphics Sections of the ASA
are co-sponsoring a student paper competition on the topics of
Statistical Computing and Statistical Graphics. Students are
encouraged to submit a paper in one of these areas, which might be
original methodological research, some novel computing or graphical
application in statistics, or any other suitable contribution (for
example, a software-related project).  The selected winners will
present their papers in a topic-contributed session at the 2007 Joint
Statistical Meetings. The Sections will pay registration fees for the
winners as well as a substantial allowance for transportation to the
meetings and lodging (which in most cases covers these expenses
completely).

Anyone who is a student (graduate or undergraduate) on or after
September 1, 2006 is eligible to participate. An entry must include an
abstract, a six page manuscript (including figures, tables and
references), a blinded version of the manuscript (with no authors and
no references that easily lead to identifying the authors), a C.V.,
and a letter from a faculty member familiar with the student's
work. The applicant must be the first author of the paper. The faculty
letter must include a verification of the applicant's student status
and, in the case of joint authorship, should indicate what fraction of
the contribution is attributable to the applicant. We prefer that
electronic submissions of papers be in Postscript or PDF. All
materials must be in English.

All application materials MUST BE RECEIVED by 5:00 PM EST, Monday,
December 18, 2006 at the address below. They will be reviewed by the
Student Paper Competition Award committee of the Statistical Computing
and Graphics Sections. The selection criteria used by the committee
will include innovation and significance of the contribution. Award
announcements will be made in late January, 2007.

Additional important information on the competition can be accessed on
the website of the Statistical Computing Section,
www.statcomputing.org. A current pointer to the website is available
from the ASA website at www.amstat.org. Inquiries and application
materials should be emailed or mailed to:

Student Paper Competition
c/o J.R. Lockwood
The RAND Corporation
4570 Fifth Avenue, Suite 600
Pittsburgh, PA 15213
[EMAIL PROTECTED]



This email message is for the sole use of the intended recip...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plotting box plots on same x

2005-05-27 Thread J.R. Lockwood
BJ-

For the record as well I could not make heads or tails of your question.

The dedicated folks who day in, day out field poorly specified questions have
no obligation to do so, and have every right to get frustrated when it seems
that their time is being taken advantage of.

On Fri, 27 May 2005, BJ wrote:

 Date: Fri, 27 May 2005 11:01:39 -0400
 From: BJ [EMAIL PROTECTED]
 To: Uwe Ligges [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] plotting box plots on same x
 
 Does it matter what they are? they are just names. The six box plots are 
 from the array I created with columns. I forgot to add teh dim 
 statement, my mistake. But I thought it was obvious that i was using a 
 matrix from the data frame call and the assignments I provided. My 
 question was simply about setting the x axis so that it stopped after 
 x=3, even though I had 6 plots.  For teh record, before I get jumped on 
 for the statistics, I am just using a 3 x 6 matrix to test the code 
 before applying it to actual data. Also, I was not being scarcastic. I 
 have recieved a lot of help from this mailing list. The R documentation 
 is hard to hunt down and not complete. Without the help of actual people 
 I would be dead in the water. I am sorry for any hostility that I have 
 incurred. ~Erithid
 
 Uwe Ligges wrote:
 
  BJ wrote:
 
  I am trying to construct a graph of 6 box plots of blood pressures. I 
  want them to be on a single set of axis and I want the SBP to be 
  ontop of the DBP. I have an array bp with the data in it and I tried
 
 
 
  Folks, please invest 1 minute of time to rethink whether other people 
  will understand your question!
 
  What is SBP, DBP, and where are the 6 boxplots from?
 
  a[1,]-c(145,60,147,62,140,57)
 
 
  a must already be defined here, or we cannot replace a column!
 
  a[2,]-c(160,75,160,74,160,70)
  a[3,]-c(140,55,140,65,142,55)
  boxplot(data.frame(a), main = Blood Pressures, at=c(1,1,2,2,3,3), 
  names=c(sit,,lie,,stand,))
 
  which is close to what I want, but it gives me a bunch of empty space 
  at the end. is there a better way to do this to avoid this?
 
 
  Well, the first point is that you should write questions that you 
  would understand yourself. In a next step you might find someone who 
  is able to answer it 
 
  As always, Thank You. ~Erithid
 
 
  As always? Does not sound very enthusiastic ...
 
 
  Uwe Ligges
 
 
 
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/statistics/bios/



This email message is for the sole use of the intended recip...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] R 1.8.1 on SUSE 9.0

2003-11-27 Thread J.R. Lockwood
 
 I think the problem is that by default g77 is not installed.  However you
 should still be able to find the rpm on the CDROM.
 
 HTH,
 Andy

Thanks to all for your replies.  Indeed the package gcc-g77 was on the
install disk, and I was able to install the R rpm with no problems.


J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] expanding factor with NA

2003-10-27 Thread J.R. Lockwood
I have a factor (with n observations and k levels), with only
nobs  n of the observations not missing.  I would like to produce a
(n x k) model matrix with treatment contrasts for this factor, with
rows of NAs placeholding the missing observations.  If I use
model.matrix() I get back a (nobs x k) matrix.  Is there an easy way
to get the (n x k) without carrying along a row ID and merging?
Thanks.

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Making a group membership matrix

2003-07-22 Thread J.R. Lockwood
Hi,

The resulting matrix will be *really* large, so make sure you have
enough RAM.  You might reduce this by dropping all the levels of the
factor that have zero counts.  As far as the solution, it is a
one-liner, but not really a crypic one:

model.matrix(~foo-1)

(assuming that you haven't changed the default contrasts in options() )


 Hi Helpers:
 
 I have a factor object that has 314k entries of 39 land cover types.
 (This object can be coerced to characters neatly should that be easier
 to work with.) 
  length(foo)
 [1] 314482
  foo[1:10]
  [1] Montane Chaparral BarrenRed Fir   Red Fir
 
  [5] Red Fir   Red Fir   Red Fir   Red Fir
 
  [9] Red Fir   Red Fir  
 39 Levels: Alpine-Dwarf Shrub Annual Grassland Aspen Barren ... White
 Fir
  summary(foo)
  Alpine-Dwarf ShrubAnnual Grassland
 Aspen 
7402   0
 582 
  Barren Bitterbrush  Blue
 Oak-Foothill Pine 
   69111   9
 0 
   Blue Oak Woodland  Chamise-Redshank ChaparralClosed-Cone
 Pine-Cypress 
   0   0
 0 
CroplandDesert Scrub
 Douglas-Fir 
   0   0
 0 
   Eastside Pine Freshwater Emergent Wetland
 Jeffrey Pine 
   0   0
 11342 
 Joshua Tree Juniper
 Lacustrine 
   01293
 501 
  Lodgepole PineLow Sage
 Mixed Chaparral 
   60332  31
 1043 
   Montane ChaparralMontane HardwoodMontane
 Hardwood-Conifer 
6648 326
 0 
Montane RiparianOrchard and Vineyard
 Perennial Grassland 
 180   0
 17 
  Pinyon-Juniper  Ponderosa Pine
 Red Fir 
 968 708
 66263 
Riverine   Sagebrush   Sierran
 Mixed Conifer 
   02292
 14264 
   Subalpine Conifer   Urban
 Valley-Foothill Riparian 
   66237   0
 0 
 Valley Oak Woodland  Wet Meadow
 White Fir 
   02216
 2717 
 
 
 
 I want to make a matrix that has the cover types as columns and
 length(foo) rows. I want the matrix entities to be scored one if that
 cover type else zero.
 
 foo.mat - matrix(data = 0, nrow = length(foo), 
   ncol = nlevels(foo))
 
 colnames(foo.mat) - levels(foo)
 
 That is easy enough but I'm at a loss as how to populate it properly.
 
 In case I'm not being clear. This is what I want:
 
  foo[1]
 [1] Montane Chaparral
 39 Levels: Alpine-Dwarf Shrub Annual Grassland Aspen Barren ... White
 Fir
  foo.mat[1,]

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] three short questions

2003-07-11 Thread J.R. Lockwood
 
 This is my first message to the list, and I've got three basic questions:
 
 How could I insert comments in a file with commands to be used as source in R?

use the pound sign #

 
 Is it possible to quickly display a window with all the colors available in 
 colors()? How?
 

I've got such a thing on my web page, though it may be dated

http://www.rand.org/methodology/stat/members/lockwood/downloads/R-built-in-colors.pdf


 I'm displaying points, but they overlap, wether points() uses triangles, 
 bullets or whatever. Is it possible to change (diminish) the size of the 
 symbols? 
 

yes; use pch to change symbols and cex to change sizes of symbols.
See the help page for par

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] within group variance of the coeficients in LME

2003-07-02 Thread J.R. Lockwood
 I would appreciate your reflection on the following. I need a quantitative
 figure to evaluate weather the covariate varies across second level units in
 the process of simulation. Of course I will be running thousands of them and
 would need to program the condition in code. In one of the previous
 questions to the group dr. Bates suggested to use the CI estmates, however
 he warned me about their very conservative nature (I got the same tip from
 the book). I thought about using the lower bound of the CI as an estimate
 with the rule if above 0 then the covariate varies. Would that be a sound
 think to do? Do you have any other suggestions? I would really appreciate
 the feedback.

I somehow missed Dr. Bates useful clarification regarding the apVar
component of the lme object (I had forgotten that the optimization and
apVar used different transformations).  I agree with him that even
though it is possible to obtain standard errors for your variance
components using an appropriate transformation of the apVar component,
you probably don't want to use that because the Wald statistics on
this scale will be ill-behaved. I would second the notion that the CIs
obtained from intervals() on your lme object (using a more
well-behaved scale) during the simulation is the best way to get at
what you want, even if they are conservative.  I think what you want
to do is think about why you are simulating -- presumably to
understand the properties of some operation on real data.  If you had
real data and wanted to test the variance components, you would
probably use the CIs from intervals().

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Re: Fitting particular repeated measures model with lme()

2003-07-02 Thread J.R. Lockwood
Hello,

A couple weeks ago I posted a message about using lme() to fit a model
based on the following: Students are tested in two years, and are
linked to teachers in the second year only.  Thus students are not
nested within teachers in the traditional sense.  The model for
student j in class i is:

Y_{ij0} = a_0 + e_{ij0}
Y_{ij1} = a_1 + b_i + e_{ij1}

with Var(b_i) the teacher variance component and Cov(e_{ij0},e_{ij1})
unstructured.  Thus if the data are organized by student, the Z
matrix in the usual linear mixed model notation has every other row
equal to a row of zeros.  For reference I include at the end of this
message a function generate.data() that simulates (balanced) data
according to this model.

I think I figured out a way to fit this model in lme() but I have some
questions about it.  My strategy was essentially to brute-force create
the Z matrix with columns containing indicators of the second year
teacher interleaved with zeros for the first year scores, and then
force the covariance matrix of the random effects to be a constant
times the identity.  Here is the code I am using:


library(nlme)
library(MASS)
ntch-30
d-generate.data(k=ntch)
varnames-paste(tchid,1:ntch,sep=)
fmla-as.formula(paste(~,paste(varnames,collapse=+),-1))

lme.u2a-lme(fixed=Y~time,data=d,random=list(tchid=pdIdent(form=fmla)),weights=varIdent(form=~1|time),correlation=corSymm(form
 = ~1|tchid/studid))

lme.u2b-lme(fixed=Y~time,data=d,random=list(dummy.group=pdIdent(form=fmla)),weights=varIdent(form=~1|time),correlation=corSymm(form
 = ~1|dummy.group/studid))


I have one set of questions and one observation:

1) The two model fits provide (essentially) the same estimates, and
these estimates seem reasonable.  However, they provide different DF
in the table of fixed effects, reflecting the fact that the nesting
structures specified in the two models are different.  In the first
case, I specify that students are nested within teachers which is not
exactly true.  In the second, I use a dummy grouping variable
dummy.group which is identically equal to 1 for all records. 

My major questions are why/how these specifications fit the same
model, whether it is possible for me to fit the model without
specifying names to the list components in the random statement, and
more generally, whether lme() *requires* a nesting structure at all.
I guess what it comes down to is that I am having trouble
understanding how exactly specifying the random statement as a list of
formulas works.

2) intervals() on either of these objects fails with the following
   error message:

Error in structure(exp(as.vector(object)), names = c(paste(sd(, 
deparse(formula(object)[[2]]),  : 
names attribute must be the same length as the vector

Any insights would be greatly appreciated.

best regards,

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

## Function for generating data
generate.data-function(k=50,n=25,mu=c(0,10),tau=sqrt(2),esd=sqrt(c(2,4)),corr=0.8){
  ## k=number of teachers
  ## n=number of students per teacher
  Sigma-diag(esd)%*%matrix(c(1,corr,corr,1),ncol=2)%*%diag(esd)
  theta-rnorm(k,sd=tau)
  theta-cbind(0,rep(theta,each=n))
  e-mvrnorm(n*k,mu=mu,Sigma=Sigma)
  Y-c(t(theta))+c(t(e))
  tchid-gl(k,2*n)
  z-model.matrix(~tchid-1)
  s-seq(from=1,to=(2*k*n-1),by=2)
  z[s,]-rep(0,k)
  studid-gl(n*k,2)
  time-rep(c(0,1),times=n*k)
  dummy.group-factor(rep(1,2*n*k))
  return(data.frame(studid,Y,time,dummy.group,tchid,z))
}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] within group variance of the coeficients in LME

2003-06-26 Thread J.R. Lockwood
 
   Dear listers, 
 
   I can't find the variance or se of the coefficients in a multilevel model 
   using lme. 
 

The component of an lme() object called apVar provides the estimated
asymptotic covariance matrix of a particular transformation of the
variance components. Dr. Bates can correct me if I'm wrong but I
believe it is the matrix logarithm of Cholesky decomposition of the
covariance matrix of the random effects.  I believe the details are in
the book by Pinheiro and Bates.  Once you know the transformation you
can use the apVar elements to get estimated asympotic standard
errors for your variance components estimates using the delta method.

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] mode of a data set

2003-06-23 Thread J.R. Lockwood
Dear Erin,
Assuming that by data set you mean a vector v, then

sort(table(v))

will give you what you want.

On Mon, 23 Jun 2003, Erin Hodgess wrote:

 Date: Mon, 23 Jun 2003 10:50:47 -0500 (CDT)
 From: Erin Hodgess [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [R] mode of a data set
 
 Dear R People:
 
 Is there a function to find the mode of a data set, please?
 
 This is the mode as in the value(s) which occur most often.
 
 Thanks so much!
 
 R for Windows, v 1.7.0
 
 Sincerely,
 Erin Hodgess
 mailto: [EMAIL PROTECTED]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Fitting particular repeated measures model with lme()

2003-06-20 Thread J.R. Lockwood
Hello,

I have a simulated data structure in which students are nested within
teachers, and with each student are associated two test scores.  There
are 20 classrooms and 25 students per classroom, for a total of 500
students and two scores per student.  Here are the first 10 lines of
my dataframe d:

   studid tchid  Y time
1   1 1 -1.08332220
2   1 1 -0.76562811
3   2 1 -1.01986410
4   2 1  0.78081481
5   3 1 -1.13817210
6   3 1 -0.43950211
7   4 1 -2.09446850
8   4 1 -1.87468401
9   5 1 -0.77844120
10  5 1  1.99521701
...

I am trying to use lme() to fit a relatively basic repeated measures
model where there are random teacher intercepts, and an unstructured
residual covariance matrix within students.  The following call to
lme() seems to fit the model:

lme.t5-lme(fixed=Y~time,data=d,random=~1|tchid,weights=varIdent(form=~1|time),\
correlation=corSymm(form = ~1|tchid/studid))

Now, I would like to try to alter this model to one in which the
teacher effect applies to only one year.  One can think of the first
score on the student as a score from a prior year (for which I have no
teacher links), and the second score is from the current year and is
linked to the teacher.  The model for student j in class i is:

Y_{ij0} = a_0 + e_{ij0}
Y_{ij1} = a_1 + b_i + e_{ij1}

with Var(b_i) the teacher variance component and Cov(e_{ij0},e_{ij1})
unstructured.  That is, if the data are organized by student, the Z
matrix in the usual linear mixed model notation has every other row
equal to a row of zeros.

I am wondering whether there is some way to fit this model using
lme().  Thanks in advance for your help and patience.

best regards,

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Fitting particular repeated measures model with lme()

2003-06-19 Thread J.R. Lockwood
Hello,

I have a simulated data structure in which students are nested within
teachers, and with each student are associated two test scores.  There
are 20 classrooms and 25 students per classroom, for a total of 500
students and two scores per student.  Here are the first 10 lines of
my dataframe d:

   studid tchid  Y time
1   1 1 -1.08332220
2   1 1 -0.76562811
3   2 1 -1.01986410
4   2 1  0.78081481
5   3 1 -1.13817210
6   3 1 -0.43950211
7   4 1 -2.09446850
8   4 1 -1.87468401
9   5 1 -0.77844120
10  5 1  1.99521701
...

I am trying to use lme() to fit a relatively basic repeated measures
model where there are random teacher intercepts, and an unstructured
residual covariance matrix within students.  The following call to
lme() seems to fit the model:

lme.t5-lme(fixed=Y~time,data=d,random=~1|tchid,weights=varIdent(form=~1|time),\
correlation=corSymm(form = ~1|tchid/studid))

Now, I would like to try to alter this model to one in which the
teacher effect applies to only one year.  One can think of the first
score on the student as a score from a prior year (for which I have no
teacher links), and the second score is from the current year and is
linked to the teacher.  The model for student j in class i is:

Y_{ij0} = a_0 + e_{ij0}
Y_{ij1} = a_1 + b_i + e_{ij1}

with Var(b_i) the teacher variance component and Cov(e_{ij0},e_{ij1})
unstructured.  That is, if the data are organized by student, the Z
matrix in the usual linear mixed model notation has every other row
equal to a row of zeros.

I am wondering whether there is some way to fit this model using
lme().  Thanks in advance for your help and patience.

best regards,

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] how to find the location of the first TRUE of a logicalvector

2003-03-05 Thread J.R. Lockwood
 
 without having to check the vector element by element? Thanks a lot!

which.max() will coerce the logical to numeric and give the location of
the first max, which is the first TRUE.

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] group means

2003-02-20 Thread J.R. Lockwood
 Date: Fri, 21 Feb 2003 11:43:53 +1300
 From: Jeremy Z Butler [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [R] group means
 
 Hi,
 Any hints on how I would generate the means of each 5 number group in a 
 column of numbers in data.frame form. i.e. get mean of first five in column 
 and then mean of second five in column etc. etc.
 

One way to do what you want is to create a grouping variable and add
it to your data frame as a factor, and then use tapply. e.g., assuming
your dataframe d with column x has a number of rows divisible by
5, use

d$grp-gl(dim(d)[1]/5,5)
tapply(d$x,d$grp,mean)

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] subset dataframe based on rows

2003-01-23 Thread J.R. Lockwood
 
 I want to subset the dataframe based on certain values in a row.
 
 for each row in my dataframe
   if ANY one value of a particular set of columns satisfies cond
   append a logical value true at the end of the row
   else
   append a false at the end of the row
 
 in the end I want to be able to subset the whole data based on the
 appended true or false value.
 
 I could literally code like this, but I think there must be a better way
 to do this. Can someone give me a hint?? thanks.
 
 Lei
 

I'm not sure what you mean by better, but at the least you don't
need to append the indicator column to your dataframe.  Just use
whatever logical vector results from checking whether the columns
satisfy the condition to subset your data frame, as in:

d[meetsyourconditions,]

As for determining whether the conditions are met, row by row, you
should be able to this as a vector operation, but it could get ugly
depending on the nature of the columns and what you call cond.  In
the most fortunate case where all the columns are of a single mode and
cond is sufficiently simple, you can apply function(x){any(x meets
cond)} to the rows of a matrix defined by your columns of interest.
This will give you the logical vector you need to subset the
dataframe.


J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/methodology/stat/members/lockwood/

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help