楼主: verbatim
1357 2

[问答] Help to make a plot? Thanks a lot! [推广有奖]

  • 1关注
  • 3粉丝

已卖:25份资源

博士生

5%

还不是VIP/贵宾

-

威望
0
论坛币
513 个
通用积分
2.0505
学术水平
0 点
热心指数
2 点
信用等级
0 点
经验
3404 点
帖子
139
精华
0
在线时间
143 小时
注册时间
2006-12-1
最后登录
2020-1-30

楼主
verbatim 发表于 2013-11-14 03:32:04 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
dncp600.xls (29.5 KB)

Dear,

I would like to make a plot of CP vs TIME by using median value of CP at each time point. However, I am thinking to bin the time points to the following points:

0.25, 0.5, 1, 1.5, 2, 2.5, 3, 4, 6, 8, 12, 24

instead of the time points in the dataset. But still keep the concentration. Is there a way to do it? Thanks a lot!


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:thanks Thank Hank Help make following median points

沙发
ryusukekenji 发表于 2013-11-14 20:51:24
  1. > plot(CP~TIME,type="l",data=dat)
  2. > axis(side=1,at=c(0.25, 0.5, 1, 1.5, 2, 2.5, 3, 4, 6, 8, 12, 24))
复制代码

藤椅
zhangyangsmith 发表于 2013-11-15 21:14:55
Generally speaking you may want to include a column for scheduled sampling time in your dataset for later processing. In your case you can simply round your actual sampling time to get the scheduled ones ASSUMING NO LARGE DEVIATIONS FROM YOUR SAMPLING SCHEME. Otherwise there is no way to do it. Check your data carefully before doing that, e.g.

  1. # Your data in .csv
  2. dncp600 <- read.csv("dncp600.csv")

  3. # Check distribution of time deviation
  4. summary(dncp600$TIME - round(dncp600$TIME*4)/4)
  5. #      Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
  6. # -0.100000  0.000000  0.000000  0.009635  0.020000  0.120000

  7. # So it is safe to just use round(dncp600$TIME*4)/4 as scheduled time
  8. dncp600$SCHD <- round(dncp600$TIME*4)/4
复制代码

The next step will be calculating median of your concentration data grouped by scheduled time.

  1. # Calculate the medians
  2. library(plyr)
  3. cpMedian <-
  4.   ddply(dncp600[, -1], .(SCHD), summarize, mdnCP = median(CP))
复制代码

Now you have every thing you need for the plot. I still suggest you to do your plot using actual sampling time even though the medians are calculated per scheduled time.

  1. # Plot with actual time
  2. with(dncp600, plot(TIME, CP, pch = 4, col = "grey"))

  3. # You may want semi-log scale
  4. # with(dncp600, plot(TIME, CP, pch = 4, col = "grey", log = "y"))

  5. # Add medians
  6. lines(cpMedian$SCHD, cpMedian$mdnCP, lty = 8, lwd = 2)
复制代码

Results:
Ct_orig.png

As your actual time is quite close to the schedule in my approach. There will be little difference if you plot using schedule time.
For comparison:

Ct_schd.png

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-8 12:36