有没有一种方法可以改善“ cosinor”模型

时间:2019-09-09 06:52:16

标签: r ggplot2

我想用 cosinor 模型改善拟合数据。

我阅读了一些文章,发现可以使用复合模型(24 h余弦拟合和12 h余弦拟合),但找不到最佳拟合结果。我也尝试过catCosinor,但没有得到最好的结果。

library("cosinor")

cosinor_Model <- cosinor.lm(moyenne_Temperature ~ time(hour) ,period = 21, data = mean_Temperature_H_Alldays ) 

summary(cosinor_Model) 

ggplot.cosinor.lm(cosinor_Model)+ geom_line(data=mean_Temperature_H_Alldays,aes(x=hour,y=moyenne_Temperature,color=factor(Id)))

我希望曲线尽可能地适合我的数据。 这是我的数据集:

structure(list(Id = structure(c(16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L), .Label = c("110f", "118d", "122c", "122f", "1231", "124b", "1265", "134b", "139f", "1524", "1643", "165b", "3.60E+04", "308d", "323a", "3270", "3343", "3390", "3393", "346e", "354f", "3626", "3707", "381a"), class = "factor"), hour = 0:23, moyenne_Temperature = c(39.1594557823129, 39.1343750000001, 39.1696688741722, 39.2040760869565, 39.2164609053498, 39.1516000000001, 39.2884979702301, 39.5986719787517, 39.6836849507736, 39.5314049586777, 39.3539528432732, 39.3680272108844, 39.4646746347942, 39.6108815426998, 39.5880272108844, 39.4295546558705, 39.211659807956, 39.1260107816711, 39.109561752988, 39.0975388601036, 39.1241469816273, 39.1317523056653, 39.1495238095238, 39.1721194879089)), row.names = c(NA, -24L ), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x0000000009301ef0>)

这就是我得到的:

cosinor fit

1 个答案:

答案 0 :(得分:0)

我在catCosinor中使用了多个组件,我发现有些好处。感谢大家。multiple components with catCosinor