fanshenzhang
我试了一下,不会报错,以下是我的运行环境。建议你清空R里面的变量再试一试或者检查R及包的版本
library(gamlss)
#> 载入需要的程辑包:splines
#> 载入需要的程辑包:gamlss.data
#>
#> 载入程辑包:'gamlss.data'
#> The following object is masked from 'package:datasets':
#>
#> sleep
#> 载入需要的程辑包:gamlss.dist
#> 载入需要的程辑包:MASS
#> 载入需要的程辑包:nlme
#> 载入需要的程辑包:parallel
#> ********** GAMLSS Version 5.4-3 **********
#> For more on GAMLSS look at https://www.gamlss.com/
#> Type gamlssNews() to see new features/changes/bug fixes.
# cubic splines example
data(aids)
# fitting a smoothing cubic spline with 7 degrees of freedom
# plus the a quarterly effect
aids1<-gamlss(y~cs(x,df=7)+qrt,data=aids,family=PO)
#> GAMLSS-RS iteration 1: Global Deviance = 374.1748
#> GAMLSS-RS iteration 2: Global Deviance = 374.1748
<sup>Created on 2022-10-24 by the reprex package (v2.0.1)</sup>
运行环境如下:
sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] parallel splines stats graphics grDevices utils
[7] datasets methods base
other attached packages:
[1] xfun_0.30 reprex_2.0.1 gamlss_5.4-3
[4] nlme_3.1-157 gamlss.dist_6.0-5 MASS_7.3-56
[7] gamlss.data_6.0-2
loaded via a namespace (and not attached):
[1] highr_0.9 compiler_4.1.3 pillar_1.7.0
[4] R.methodsS3_1.8.1 R.utils_2.11.0 tools_4.1.3
[7] digest_0.6.29 evaluate_0.15 lifecycle_1.0.1
[10] tibble_3.1.6 lattice_0.20-45 R.cache_0.15.0
[13] pkgconfig_2.0.3 rlang_1.0.2 Matrix_1.4-1
[16] rstudioapi_0.13 cli_3.2.0 yaml_2.3.5
[19] fastmap_1.1.0 withr_2.5.0 styler_1.7.0
[22] knitr_1.38 fs_1.5.2 vctrs_0.4.1
[25] grid_4.1.3 glue_1.6.2 R6_2.5.1
[28] processx_3.5.2 fansi_1.0.3 survival_3.3-1
[31] rmarkdown_2.13 callr_3.7.0 clipr_0.8.0
[34] purrr_0.3.4 magrittr_2.0.3 ps_1.6.0
[37] ellipsis_0.3.2 htmltools_0.5.2 utf8_1.2.2
[40] crayon_1.5.1 R.oo_1.24.0
<sup>Created on 2022-10-24 by the reprex package (v2.0.1)</sup>