Pairwise comparison after repeated measures ANOVA

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Pairwise comparison after repeated measures ANOVA

Felipe Martínez-Pastor
I am analyzing some data obtained after measuring some parameters at
different times in samples obtained from many subjects. The model is
quite simple: aov(parameter ~ Time + Error(Subject/Time))

Now I want to make a pairwise comparison between the levels of Time.
However, I have not find how to do such a thing. I cannot use TukeyHSD
or pairwise.t.test, I supposse. Maybe using contrasts?

Could you aim me at some kind of information? All I have found is
information on ANOVA, but not how to compare the levels of the factors
afterwards.

Maybe I simply do not understand how this really works, my background is
not very deep in statistics.
Thank you.

Felipe

--------------------oOo--------------------
Felipe Martínez Pastor, Ph. D.
Ciencia y Tecnología Agroforestal
ETSIA-UCLM
Av. España s/n
02071-Albacete (Spain)
Phone: +34 967 599 200+2581
Fax:   +34 967 599 238+2081
Mobile: +34 687 365 362
e-mail: [hidden email]
Jabber: [hidden email]
website: http://www.germplasm.all.at



--
Ningún investigador sin contrato.
Employment rights for Spanish junior researchers.
        http://www.precarios.org

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Pairwise comparison after repeated measures ANOVA

Dieter Menne
Felipe Martínez-Pastor <Felipe.Martinez <at> uclm.es> writes:

>
> I am analyzing some data obtained after measuring some parameters at
> different times in samples obtained from many subjects. The model is
> quite simple: aov(parameter ~ Time + Error(Subject/Time))
>
> Now I want to make a pairwise comparison between the levels of Time.
> However, I have not find how to do such a thing. I cannot use TukeyHSD
> or pairwise.t.test, I supposse. Maybe using contrasts?
>

I would suggest that you use lme from package nlme for this type of a problem,
because it provides a MUCH better toolbox fro what noadays is called mixed-
effect models. And get the book by Pinheiro/Bates (Mixed-Effect Models in S and
S-PLUS), which is full of practical examples of this type.

With the results of <lme>, you can use <estimable> from package gmodels to
estimate contrasts, and p.adjust to adjust for multiple comparison. However, as
you parameter is called Time, you should really rethink if this is the right
way to go. Why not treat Time as and continuous variable, effectively
estimating a slope? Or at least as an ordered variable? I know from my clients
that, after measuring a parameter 6 instances in time, they insist on a star-
spangled list of all 15 pairwise comparisons. If they do, I take out  
Bonferroni's Iron Claw even if I know better methods.

The question: "At what time intervals is the difference significant" is mostly
nonsense.

Try to rephrase as "Is there a significant linear trend in time?". Would adding
a quadratic component improve the quality of the fit (use AIC for this, see
Pinheiro/Bates or Venables/Ripley). In many biological applications I know, a
linear trend is perfectly fine, and it often has an easy interpretation. You
only have to fight "but it's not linear" faculty, who mostly would not object
to computing the mean without ever thinking to ask "but it's not constant".

Soapbox off. You see, I just had a discussion on the subject with a client.

Dieter

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

readline() for passwords?

Ulf Mehlig
Hello,

I am using RODBC to access a password-protected database. Is there a
possibility to prevent that the password appears on the screen when
issuing the odbcConnect() command? I thought of something like
readline() without echo. I guess that a getpass()-based solution
wouldn't work for ESS/Emacs, anyway, would it?

Thanks for your attention!
Ulf

R 2.2.1, i386-pc-linux-gnu

--
 Ulf Mehlig    <[hidden email]>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: readline() for passwords?

Dalphin, Mark
I don't like to have my password exposed by typing at all. I also don't like
to enter it each time that I wish to open a database (or when I run scripts
automatically across a Linux cluster). My solution has been to keep a file
in my HOME directory containing the username and password for the databases.
This file has read and write permission set so only I (and root) can read
it; this is something of a security hole, but it is the best I have come up
with so far.

I then wrap my dbConnect() or in your case, odbcConnect(), in a function
that picks up the information. I've included my function below.

While I use this function often, I have not tested some of it. My files for
the databases all contain one username and one password. Multiple names and
passwords have not been tested.

Mark Dalphin

openDB <- function(dbname, user=Sys.getenv('USER'), dbg=FALSE) {
  if(length(grep('ROracle', search())) == 0)
    stop("Libraries not loaded: library(DBI) and library(ROracle)")

  path <- paste(Sys.getenv('HOME'), paste('.', dbname, sep=''), sep='/')
  if(dbg) cat("Reading file:", path, "\n")

  input <- scan(file=path, what='character', quiet=TRUE)
  if(dbg) cat("Found", length(input), "items in file\n")

  ## Generally, 'input' will contain two items: username and password.
  ## Assume it will always contain pairs:
  ##   username \t password \n username \t password \n
  ## Match the username to 'user' and then pickup the password as the next
  ## item.
  i.1 <- seq(1, length(input), by=2)
  usr <- input[i.1]
  psd <- input[i.1 + 1]

  inx <- usr==user
  if(dbg) cat("\tUser=", usr[inx], "\n")
  if(sum(inx) < 1)
    stop(paste("User, '", user, "', not present in file: ", path, sep=''))
  if(sum(inx) > 1) stop("Unable to locate unique USER in input")
  if(dbg) cat("\tPass=", psd[inx], "\n")
  return(dbConnect('Oracle', dbname=dbname, user=usr[inx], pass=psd[inx]))
}

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]On Behalf Of Ulf Mehlig
Sent: Wednesday, February 15, 2006 1:22 PM
To: [hidden email]
Subject: [R] readline() for passwords?


Hello,

I am using RODBC to access a password-protected database. Is there a
possibility to prevent that the password appears on the screen when
issuing the odbcConnect() command? I thought of something like
readline() without echo. I guess that a getpass()-based solution
wouldn't work for ESS/Emacs, anyway, would it?

Thanks for your attention!
Ulf

R 2.2.1, i386-pc-linux-gnu

--
 Ulf Mehlig    <[hidden email]>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

how can I write two objects together, problem with cbind()

Srinivas Iyyer
In reply to this post by Ulf Mehlig
Hi Group,
 I have two objects
1. A data.frame with 2 columns

Apple  4
Boy    2
Cat    5
Dog    10
Eel    9
...
Zebra  10
(26 rows)

I have another object which was obtained as vector of
integers with names as character.

Fruit 10
King 20
Eel  19
Boy 20
Apple 15
...
(26 rows)

Now I wanted to combine the two objects and wanted a
result that would look like this:

Apple  4 15
Boy    2 20
Cat    5 28
Dog    10 25
Eel    9 19


result <- cbind(obj1, obj2)

My result is now jumbled:

Apple  4 34
Boy    2 21
Cat    5 234
Dog    10 23
Eel    9  12

I want to write identical row names elements together.


What could be done here. Could any one please help me.


thanks
Srini

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: how can I write two objects together, problem with cbind()

Uwe Ligges
Srinivas Iyyer wrote:

> Hi Group,
>  I have two objects
> 1. A data.frame with 2 columns
>
> Apple  4
> Boy    2
> Cat    5
> Dog    10
> Eel    9
> ...
> Zebra  10
> (26 rows)
>
> I have another object which was obtained as vector of
> integers with names as character.
>
> Fruit 10
> King 20
> Eel  19
> Boy 20
> Apple 15
> ...
> (26 rows)
>
> Now I wanted to combine the two objects and wanted a
> result that would look like this:
>
> Apple  4 15
> Boy    2 20
> Cat    5 28
> Dog    10 25
> Eel    9 19
>
>
> result <- cbind(obj1, obj2)
>
> My result is now jumbled:
>
> Apple  4 34
> Boy    2 21
> Cat    5 234
> Dog    10 23
> Eel    9  12
>
> I want to write identical row names elements together.
>
>
> What could be done here. Could any one please help me.
>


See ?merge

Uwe Ligges


> thanks
> Srini
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: readline() for passwords?

barry rowlingson
In reply to this post by Ulf Mehlig
Ulf Mehlig wrote:

> I am using RODBC to access a password-protected database. Is there a
> possibility to prevent that the password appears on the screen when
> issuing the odbcConnect() command? I thought of something like
> readline() without echo. I guess that a getpass()-based solution
> wouldn't work for ESS/Emacs, anyway, would it?

tk has a way of doing this, so you can build a function that uses the
tcltk package. Something like:

getPassword <- function(){
   require(tcltk)
   tt <- tktoplevel()
   pass=tclVar("")
   label.widget <- tklabel(tt, text="Enter Password")
   password.widget <-  tkentry(tt,show="*",textvariable=pass)
   ok <- tkbutton(tt,text="Ok",command=function()tkdestroy(tt))
   tkpack(label.widget, password.widget,ok)
   tkwait.window(tt)
   return(tclvalue(pass))
}

The vital part here is the 'show="*"' option in the tkentry widget.

Of course this is no use if you aren't in a graphical environment at the
time.

Barry

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html