Displaying 20 results from an estimated 20000 matches similar to: "select observations from longitudinal data set"
2009 Mar 29
2
select observations from longitudinal data
Suppose I have a long format for a longitudinal data
id time x
1 1 10
1 2 11
1 3 23
1 4 23
2 2 12
2 3 13
2 4 14
3 1 11
3 3 15
3 4 18
3 5 21
4 2 22
4 3 27
4 6 29
I want to select the x values for each ID when time is equal to 3. When that
observation is not observed, then I want to replace it with the obervation
at time equal to 4. otherwise just use NA.
How can I implement this with a quick
2007 Jan 27
2
unequal number of observations for longitudinal data
i have a large longitudinal data set. The number of observations for each
subject is not the same across the sample. The largest number of a subject
is 5 and the smallest number is 1.
now i want to make each subject to have the same number of observations by
filling zero, e.g., my original sample is
id x
001 10
001 30
001 20
002 10
002 20
002 40
002 80
002 70
003 20
003 40
004 ......
now i wish
2007 Jan 27
3
how to handle a longitudinal data
i have a data set with repeated measures on same people, structure like
below:
id x1 x2 ...
001 10 20 ...
001 8 45 ...
001 4 2 ...
002 ....
002 ...
002 ....
002 ....
003 ....
.......
what is the easist way to show how many observations for each subject id?
[[alternative HTML version deleted]]
2008 Nov 24
3
select a subset
I have the complete data like
id time censor
1 10 0
1 20 0
1 30 0
2 10 0
2 20 1
2 30 0
2 40 0
3 10 0
3 20 0
3 30 1
....
for id 1, i want to select the last row since all censor indicator is 0; for
id 2, i want to select the row where censor ==1; for id 3, i also want to
select the row where censor==1. So if there is a 1 for censor, then I want
to select such a row, otherwise I want to select the
2010 Jun 26
2
Recoding dates to session id in a longitudinal dataset
Hi,
I'm fairly new to R but I have a large dataset (300000 obs) containing
patient material. Some patients came 2-9 times during the three year
observation period. The patients are identified by a unique idnr, the
sessions can be distinguished using the session date. How can I recode the
date of the session to a session id (1-9). This would be necessary to obtain
information and do some
2007 Oct 28
1
gam for longitudinal data?
I used gam for data analysis a lot. Is it possible to use gam to analyze
longitudinal data? I mean, besides the working independence assumption, can
i specify other more reasonable covariance structure in gam?
[[alternative HTML version deleted]]
2010 Apr 22
4
how to select the first observation only?
Dear r-helpers,
I have a very simple question. Suppose my data is like
id=c(rep(1,2),rep(2,2))
b=c(2,3,4,5)
m=cbind(id,b)
> m
id b
[1,] 1 2
[2,] 1 3
[3,] 2 4
[4,] 2 5
I wish to select the first observation for each id. That is, I want to
quickly select two rows:
id b
1 2
2 4
only. how should i do this?
[[alternative HTML version deleted]]
2011 Aug 18
1
Using mixed models to analyze Longitudinal intervention
Dear R List,
I am trying to use mixed models to analyze an intervention and want to make
sure I am doing it correctly. The intervention is for lowing cholesterol
and there are two groups: one with an intervention and one without. The
subjects were evaluated a differing amount of time, so there were between 2
and 7 visits, equally spaced.
Sample output is below. TC is total cholesterol,
2007 Jul 18
1
filter out observation by condition
hello,
I have a longitudinal data:
idn mort30 newinfec
1 0 1
1 0 1
1 0 1
1 0 1
2 1 1
2 1 1
2 1 1
3 0 0
3 0 0
3 0 0
3 0 0
3
2008 Jul 06
1
What is my replication unit? Lmer for binary longitudinal data with blocks and two treaments.
First I would like to say thank you for taking the time to read it.Here is my
problem.
I am running a lmer analysis for binary longitudinal (repeated measures)
data.
Basically, I manipulated fruits and vegetation to two levels each(present
and absent) and I am trying to access how these factors affect mice foraging
behavior. The design consist of 12 plots, divided in 3 blocks. So each
block
2010 Jan 18
3
add spline to longitudinal data - preferably similar to SAS's 'I=SM50S' routine
Hi Ruser
I'm trying to replicate some SAS code. I have to add a spline to my
longitudinal spaghetti plot.
I have the plot, but I can't add the spline, a overall trend line. In
the SAS code they use the command 'I=SM50S' and I would prefer
something similar. I?m using R 2.10.1 on windows XP?
I have made this working example.
tolerance.pp <-
2008 Aug 07
4
Obtaining the first /or last record of a subject in a longitudinal study
Dear R users,
I was wondering if anyone knows how to obtain(subset) the first and/or the
last record of a subject in a longitudinal setup.
Normally in SAS one uses first.variable1 and last.variable1. So my question
is that is there an R way of doing this.
Regards,
--
Luwis Diya, Phd student (Biostatistics),
Biostatistical Center,
School Of Public Health,
Catholic University of Leuven,
U.Z. St
2012 Apr 10
1
cbind, data.frame | numeric to string?
Complete newbie to R -- struggling with something which should be pretty
basic. Trying to create a simple data set (which I gather R refers to as a
data.frame). So
> a <- c(1,2,3,4,5);
> b <- c(0.3,0.4,0.5,0,6,0.7);
Stick the two together into a data frame (call test) using cbind
> test <- data.frame(cbind(a,b))
Seems to do the trick:
> test
a b
1 1 0.3
2 2 0.4
3 3
2009 Sep 24
3
Color of the plot which correspond to the group of the observations
Dear All,
?
Let:
dp: depth of the river
tp: temperature with respect to depth
These pair of observations are in 3 different groups i.e:
Obs. 1,3,5,7?from the first group
Obs. 2,4 and?10?from second group
Obs 6,8 and 9?from third group.
We can have a simple scatter plot, between depth as y-axis and temperature as x-axis, with each pairs are denoted by a red dot, by using a plot function shown
2007 Dec 19
3
plot cummulative sum from calendar time
I have the following list of observations of calendar time:
[1] 03-Nov-1997 09-Oct-1991 27-Aug-1992 01-Jul-1994 19-Jan-1990 12-Nov-1993
[7] 08-Oct-1993 10-Nov-1982 08-Dec-1986 23-Dec-1987 02-Aug-1995 20-Oct-1998
[13] 29-Apr-1991 16-Mar-1994 20-May-1991 28-Dec-1987 14-Jul-1999 27-Nov-1998
[19] 09-Sep-1999 26-Aug-1999 20-Jun-1997 05-May-1995 26-Mar-1998 15-Aug-1994
[25] 24-Jun-1996 02-Oct-1996
2002 Oct 14
3
Directory size display discrepency
Hi,
I would liek to ask the list if any one can explain why there should be
a discrepency in the directory sizes that are displayed when I use
explorer on Windows. This has been reported to me by a user, I have
never seen this before as I dont use windows if I can help it :-)...
When I slect properties of a directory it has two enties
Size and Size on disk
As an example size says 33 bytes, size
2010 Apr 20
1
how to select the last non-'NA' observation in a row
I have a matrix of the following form:
time
id 0 2 4 6 9 12 14
3 9 8 NA NA NA NA NA
7 3 NA 3 NA 3 NA 4
13 11 6 7 NA 5 NA 6
.....
I hope for each row to select the last observation which is not 'NA'.
For example, for the first row, id=3, the value I want to select is 8
for the second row, id=7, the value I want to select is 4
for the third row, id=13, the
2013 Feb 23
5
Selecting First Incidence from Longitudinal Data
I have a longitudinal competing risk data of the form:
ID COMPL SEX HEREDITY
1 0 1 2
1 0 1 2
1 3 1 2
2 0 0 1
2 1 0 1
2 2 0 1
2 2 0 1
3 0 0 1
3 0 0 1
3 0 0 1
3 0 0 1
3 2 0 1
4 0 1 2
4 0 1
2013 Apr 24
1
matching observations and ranking
Hi,
It is not that clear.
If VAR1 is a match between columns AB001A, AB0002A, VAR2? between AB001A, AB362 and VAR3 between AB0002A and AB362:
Also, I assume row8 match would be taken as 1.
dat1<- read.table(text="
? S.No AB001A AB0002A AB362
?? 1?? -/-??????? C/C?? A/A???????????????????????
??? 2?? C/C??????? C/C?? A/A???????????????????????
??? 3?? C/C??????? C/C??
2009 Jan 02
7
the first and last observation for each subject
I have the following data
ID x y time
1 10 20 0
1 10 30 1
1 10 40 2
2 12 23 0
2 12 25 1
2 12 28 2
2 12 38 3
3 5 10 0
3 5 15 2
.....
x is time invariant, ID is the subject id number, y is changing over time.
I want to find out the difference between the first and last observed y
value for each subject and get a table like
ID x y
1 10 20
2 12 15
3 5 5
......
Is there any easy way to generate