在分类变量上提取非线性方程的系数
这个问题似乎偏离主题,因为它侧重于编程、调试或执行常规操作,或者询问有关获取数据集的问题。您可以尝试使用我们维护的支持链接或开放数据网站。
如果您询问如何调试某些代码或使用编程语言执行任务,这不是一个主题问题。如果您询问如何获取数据,那么这不是一个主题问题。如果您认为您的问题确实与帮助中心中所述的统计数据有关,请[编辑]进行澄清。
25 分钟前关闭。
(给你的私人反馈)
我试图从方程中提取系数 k1,2 和 3:
Mt=M1exp(−k1⋅CDI⋅t)+M2exp(−k2⋅CDI⋅t)+M3exp(−k3⋅CDI⋅t)
其中 Mt 是时间 t 时的质量,m1 是初始不稳定碳含量(以%为单位),m2 是全纤维素含量,m3 是木质素内容,最后,CDI
是气候分解指数(见下图)。
我已经设法使用以下代码从单个视线中提取系数:
eqtn <- function(m1, k1, cdi, t, m2, k2, m3, k3){(m1 * exp(-k1 * cdi * t)+
m2 * exp(-k2 * cdi * t)+
m3 * exp(-k3 * cdi * t))}
nls(mass_remaining_percent ~ eqtn(scf_mean_initial, k1, cdi_mean, days_between,
holocellulose_mean_initial, k2, lignin_mean_initial, k3),
start = list(k1 = 0.0007, k2 = 0.0005, k3 = 0.0001), data = a.3_pooled_data)
有谁知道如何将其应用于视线类别(字段代码)并提取系数/ R2?我知道它需要分成许多小数据集,然后应用模型,提取数据并重新组合,但我不知道如何做到这一点
提前感谢
我刚刚设法编写了上述代码,将模型拟合到单行代码,我知道我可以手动执行此操作,拟合许多较小的数据集,但这需要年龄和我想要了解如何使用 apply 系列或 broom 包来完成此操作。
This question appears to be off-topic because it focuses on programming, debugging, or performing routine operations, or it asks about obtaining datasets. You could try the support links we maintain or the Open Data site instead.
If you are asking about how to debug some code or carry out a task in a programming language, this is not an on-topic question. If you're asking about how to obtain data, that is not an on-topic question. If you feel your question is truly about statistics as described in the help center, please [edit] to clarify.
Closed 25 mins ago.
(Private feedback for you)
I am trying to extract the coefficients k1,2 and 3 from the equation:
Mt=M1exp(−k1⋅CDI⋅t)+M2exp(−k2⋅CDI⋅t)+M3exp(−k3⋅CDI⋅t)
where Mt is mass at time t, m1 is the initial labile carbon content (in %), m2 is holocellulose content, m3 is lignin content, and finally, CDI
is climate decomposition index (see below image).
I have managed to extract the coefficients from a single sight using the following code:
eqtn <- function(m1, k1, cdi, t, m2, k2, m3, k3){(m1 * exp(-k1 * cdi * t)+
m2 * exp(-k2 * cdi * t)+
m3 * exp(-k3 * cdi * t))}
nls(mass_remaining_percent ~ eqtn(scf_mean_initial, k1, cdi_mean, days_between,
holocellulose_mean_initial, k2, lignin_mean_initial, k3),
start = list(k1 = 0.0007, k2 = 0.0005, k3 = 0.0001), data = a.3_pooled_data)
Does anyone know how I can apply this over categories of sight (field code) and extract the coefficients/ R2? I know that it needs splitting into many small datasets, then applying the model, extracting data and recombining but I can't figure out how to do it
Thanks in advance
I have just managed to write the above code, fitting the model to a singular line of code, I know that I can do this manually, fitting to many smaller datasets but it will take an age and I would like to learn how to do it using the apply family or the broom package.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于系数,请使用
coef
返回向量或
summary.nls(...)$coefficients
返回一个矩阵,其中还包括 t 统计数据和 p 值nls()
的结果。要按分组运行模型,请考虑by
(tapply
的面向对象包装器):For coefficients, use either
coef
to return a vector orsummary.nls(...)$coefficients
to return a matrix which also includes t-stats and p-values on results ofnls()
. To run model by groupings, considerby
(the object-oriented wrapper oftapply
):