On Oct 8, 2011, at 8:43 PM, maspitze wrote:

Hi,
I have a series of id's with multiple visits and questionnaire scores. This is a clinical trial that will be analyzed using the last observation carried forward method. In other words, in order to comply with intent to treat analysis when many subjects withdraw, data points for the last visit must be generated and filled in with the last observation. The ultimate goal is to tabulate the difference in qustionnaires between the start of the trial and
the end of trial.  I am lost at about how to do this.
Each subject had multiple visits, up to 13.  In general, they took a
questionnaire at each visit. However, if a questionnaire was not completed
or the visit is missing, the data point does not exist.  To explain, I
created a table as analogy.

My goal is to take something that looks like the following:

ID      Visit   score
1       1       10
2       1       12
2       3       15
3       1       1
3       2       6
4       1       16
4       2       1
4       3       7
4       4       17

I think I then need to change to this in order to perfrom locf in zoo:
ID      Visit   score
1       1       10
1       2       na
1       3       na
1       4       na
2       1       12
2       2       na
2       3       15
2       4       na
3       1       1
3       2       6
3       3       na
3       4       na
4       1       16
4       2       1
4       3       7
4       4       17


require(zoo)
dat2 <- merge(data.frame(ID=rep(1:4, each=4), Visit=rep(1:4, 4)), dat, all.x=TRUE)
 dat2$Vscr.fill <- na.locf(dat2$score)
 dat2
lapply(split(dat2, dat2$ID), function(x) x$Vscr.fill[4]-x $Vscr.fill[1] )
#########
$`1`
[1] 0

$`2`
[1] 3

$`3`
[1] 5

$`4`
[1] 1

--
David


then change to:
ID      Visit   score
1       1       10
1       2       10
1       3       10
1       4       10
2       1       12
2       2       12
2       3       15
2       4       15
3       1       1
3       2       6
3       3       6
3       4       6
4       1       16
4       2       1
4       3       7
4       4       17

I would then like to take visit 4 and subtract visit 1 to create the
difference in the questionnaire scores during the clinical trial. I will
then compare this score by t.test between placebo and drug groups.

Would anyone please have some guidance about how to do this in r? I would
be grateful for assistance.
Regards, Matt


--
View this message in context: 
http://r.789695.n4.nabble.com/help-with-using-last-observation-carried-forward-analysis-for-a-clinical-trial-please-tp3886396p3886396.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org 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.

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org 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.

Reply via email to