gpt4 book ai didi

r - 从 R 中的 gls 输出中提取具有所有信息的系数

转载 作者:行者123 更新时间:2023-12-01 09:36:38 27 4
gpt4 key购买 nike

我需要从 R 中的 gls 输出中获取系数以及它们的 SE、t 值和 p 值。

library(nlme)
fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
correlation = corAR1(form = ~ 1 | Mare))

summary(fm1)
Generalized least squares fit by REML
Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time)
Data: Ovary
AIC BIC logLik
1571.455 1590.056 -780.7273

Correlation Structure: AR(1)
Formula: ~1 | Mare
Parameter estimate(s):
Phi
0.7532079

Coefficients:
Value Std.Error t-value p-value
(Intercept) 12.216398 0.6646437 18.380373 0.0000
sin(2 * pi * Time) -2.774712 0.6450478 -4.301561 0.0000
cos(2 * pi * Time) -0.899605 0.6975383 -1.289685 0.1981

Correlation:
(Intr) s(*p*T
sin(2 * pi * Time) 0.000
cos(2 * pi * Time) -0.294 0.000

Standardized residuals:
Min Q1 Med Q3 Max
-2.41180365 -0.75405234 -0.02923628 0.63156880 3.16247697

Residual standard error: 4.616172
Degrees of freedom: 308 total; 305 residual

如果有人帮我解决这个问题,我将不胜感激。提前致谢。

最佳答案

试试这个:

> cs <- as.data.frame(summary(fm1)$tTable)
> cs
Value Std.Error t-value p-value
(Intercept) 12.2163982 0.6646437 18.380373 2.618737e-51
sin(2 * pi * Time) -2.7747122 0.6450478 -4.301561 2.286284e-05
cos(2 * pi * Time) -0.8996047 0.6975383 -1.289685 1.981371e-01
> cs$t
[1] 18.380373 -4.301561 -1.289685
> cs$p
[1] 2.618737e-51 2.286284e-05 1.981371e-01

关于r - 从 R 中的 gls 输出中提取具有所有信息的系数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6477993/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com