本文介绍了观星者和gam-如何包含整个摘要输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当使用平滑样条曲线观星者拟合广义加性模型时,仅返回主要效果,而不返回您在summary(pros.gam)
中可以看到的平滑项.观星者也可以退还这些物品吗?还是有其他功能或软件包可以完成这项工作?
When fitting a generalized additive model with smoothed splines stargazer only returns the main effects and not the smooth terms which you can see in summary(pros.gam)
. Can stargazer return these as well? Or is there another function or package that can do the job?
library(ElemStatLearn)
library(mgcv)
library(stargazer)
pros.gam=gam(lpsa~s(lcavol)+s(lweight)+s(age)+s(lbph)+svi
+s(lcp)+gleason+s(pgg45),data=prostate)
summary(pros.gam) # Table should include the smooth terms that are visible here
stargazer(pros.gam,summary=TRUE)
utils
软件包的
推荐答案
toLatex
可以完成工作:
require(utils)
toLatex(summary(pros.gam)$s.table)
输出:
# \begin{tabular}{lD{.}{.}{7}D{.}{.}{7}D{.}{.}{7}D{.}{.}{7}}
# \toprule
# & \multicolumn{1}{c}{edf} & \multicolumn{1}{c}{Ref.df} & \multicolumn{1}{c}{F} & \multicolumn{1}{c}{p-value} \\
# \midrule
# s(lcavol) & 1.0000000 & 1.0000000 & 48.8654347 & 0.0000000 \\
# s(lweight) & 7.4334733 & 8.3759397 & 2.9521585 & 0.0054553 \\
# s(age) & 1.7609527 & 2.1888342 & 3.2466098 & 0.0402275 \\
# s(lbph) & 1.7480193 & 2.1293872 & 2.3329425 & 0.0998080 \\
# s(lcp) & 3.3087460 & 4.0189658 & 1.3792509 & 0.2484695 \\
# s(pgg45) & 1.1277962 & 1.2388741 & 0.2681440 & 0.6563885 \\
# \bottomrule
# \end{tabular}
这篇关于观星者和gam-如何包含整个摘要输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!