GithubHelp home page GithubHelp logo

tmerge about snp_plotter HOT 4 OPEN

IKRAMTUN avatar IKRAMTUN commented on August 24, 2024
tmerge

from snp_plotter.

Comments (4)

kmezhoud avatar kmezhoud commented on August 24, 2024 1

Hi,
For better help could you give us an example as in tmerge example.

 The pbc data set contains baseline data and follow-up status
# for a set of subjects with primary biliary cirrhosis, while the
# pbcseq data set contains repeated laboratory values for those
# subjects.  
# The first data set contains data on 312 subjects in a clinical trial plus
# 106 that agreed to be followed off protocol, the second data set has data
# only on the trial subjects.
temp <- subset(pbc, id <= 312, select=c(id:sex, stage)) # baseline data
pbc2 <- tmerge(temp, temp, id=id, endpt = event(time, status))
pbc2 <- tmerge(pbc2, pbcseq, id=id, ascites = tdc(day, ascites),
               bili = tdc(day, bili), albumin = tdc(day, albumin),
               protime = tdc(day, protime), alk.phos = tdc(day, alk.phos))

fit <- coxph(Surv(tstart, tstop, endpt==2) ~ protime + log(bili), data=pbc2)

or
excluding tmerge functionalities, if you want to merge the two df you can use dplyr package:

data1<- data.frame(
    id = c(1, 2, 3),
    tstart = c(3, 2, 2),
    tstop= c(4, 8, 6),
    status = c(1, 0, 1),
    measu1=c(54, 66, 18))

data2<- data.frame(
    id = c(1, 2, 3),
    measu2=c(66, 73, 82))

data1 |>
    dplyr::left_join(data2, by= "id")
```
```
  id tstart tstop status measu1 measu2
1  1      3     4      1     54     66
2  2      2     8      0     66     73
3  3      2     6      1     18     82
```

from snp_plotter.

kmezhoud avatar kmezhoud commented on August 24, 2024 1

I think you need to create an event before to merge datasets.
Make a sens to your event

data1<- data.frame(
    id = c(1, 2, 3),
    tstart = c(3, 2, 2),
    tstop= c(4, 8, 6),
    status = c(1, 0, 1),
    measu1=c(54, 66, 18))

data2<- data.frame(
    id = c(1, 2, 3),
    tstart = c(3, 2, 2),
    measu2=c(66, 73, 82))

data2 <- tmerge(data2, data2, id=id, endpt = event(tstart, measu2))

tmerge(data2, data1, id=id, tstop= tdc(endpt, tstop))

Error in tmerge(data2, data1, id = id, tstop = tdc(endpt, tstop)) :
tstart and tstop arguments only apply to the first call

from snp_plotter.

IKRAMTUN avatar IKRAMTUN commented on August 24, 2024

Many thanks for the answer, however, it is necessary to use the tmerge to do the Cox proportional hazard ratio regression repeating measurement.
Accordingly, should I put two intervals of time in each data? and if yes how can I merge it? and associated with each measurement?
I was thinking about formatting my data as follows;

id tstart tstop measurment status
1 1 0 3 54 1
2 1 3 4 66 1
3 2 0 2 66 0
4 2 2 8 73 0

BUT, can't figure out how to do it with tmerge again!!
IS

from snp_plotter.

IKRAMTUN avatar IKRAMTUN commented on August 24, 2024

In the tmerge function, the tstart and tstop variables can be present in the first dataset only.

from snp_plotter.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.