返回

r-如何使用ggplot绘制该模型?

发布时间:2022-08-14 05:33:57 210
# 数据

如何在ggplot中绘制此模型?由于我的模型在x轴上包含多个参数,我不确定该如何绘制

mod = gam(rate ~ s(Indigenous, k = 10, bs = "cr") + s(Urbanisation, k = 10, bs = "cr") + s(Density, k = 10, bs = "cr") 
              + Poverty + s(Poor_Sanitation, k = 10, bs = "cr") + Unemployment + Timeliness + Year + Region + s(lon, lat), 
              data = TBdata, 
              family = tw(link = 'log'))

#creating predictions from out model
preds  = predict(tw_mod_cr2, type = 'response', se.fit = T) 

数据段

  head(TBdata)
  Indigenous Illiteracy Urbanisation Density Poverty Poor_Sanitation Unemployment Timeliness  Year    TB Population Region   lon    lat     rate
  1      0.335       6.35         84.1   0.714    31.3            15.3         5.41       59.2  2012   323     559543  11001 -60.7 -12.1  0.000577
  2      6.45        8.49         71.4   0.743    48.6            29.4         5.92       58.1  2012    15      73193  11002 -64.0  -9.43 0.000205
  3      0.160      10.2          67.0   0.664    42.3            31.9         4.08       88.7  2012    47     176003  11003 -62.4 -10.6  0.000267
  4      0.549      10.3          68.7   0.595    38.9            28.5         5.50       75.2  2012    45     294157  11004 -64.1 -11.7  0.000153
  5      0.318      11.4          42.8   0.639    51.6            48.4         4.04       58.3  2012    17      69841  11005 -61.2 -13.2  0.000243
  6      1.02       10.3          66.5   0.595    39.1            29.3         5.58       69.3  2012    66     228654  11006 -61.7 -11.9  0.000289
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像
下一篇
linux-从文件中读取curl文件属性 2022-08-14 03:42:33