使用r-mice时池函数导致估算数据出错

如何解决使用r-mice时池函数导致估算数据出错

R的新手,对于任何误解,我们深表歉意。

我正在尝试对估算数据进行线性回归。我已经用完整的案例进行了线性回归,但想比较估算模型。

我正在使用鼠标,并已创建估算的数据:

imp_data2 <- mice(data,m=5,maxit=20,meth='pmm',seed=12345)

然后:

# Stack imputed datasets in long format,exclude the original data
impdat <- complete(imp_data2,action="long",include = FALSE)

然后我指定了模型:

model1 <-with(data = impdat,exp = lm(nat11 ~ sex + AGE + (fasbathroom+fasbedroom+fascomputers+
                            fasdishwash+fasfamcar+fasholidays)))

但是当我尝试使用pool()函数给出模型摘要时:

summary(pool(model1))

我得到一些奇怪的错误代码,但我找不到任何可以帮助的东西。我可以使用summary(model1),它可以正常工作,但无法获得汇总模型的摘要。有什么建议吗?

我得到的错误是:

Error: No tidy method for objects of class qr
In addition: Warning messages:
1: In get.dfcom(object,dfcom) : Infinite sample size assumed.
2: 'tidy.numeric' is deprecated.
See help("Deprecated") 
3: 'tidy.numeric' is deprecated.
See help("Deprecated") 
4: 'tidy.numeric' is deprecated.
See help("Deprecated") 
5: 'tidy.numeric' is deprecated.
See help("Deprecated")
6: 'tidy.numeric' is deprecated.
See help("Deprecated") 
7: 'tidy.numeric' is deprecated.
See help("Deprecated")

编辑

如果有帮助,我使用了traceback()函数。输出为:

12: stop("No tidy method for objects of class ",class(x)[1],call. = FALSE)
11: tidy.default(X[[i]],...)
10: FUN(X[[i]],...)
9: lapply(fitlist,tidy,effects = "fixed",parametric = TRUE,...)
8: eval(lhs,parent,parent)
7: eval(lhs,parent)
6: lapply(fitlist,...) %>% 
bind_rows()
5: summary.mira(fitlist,type = "tidy",exponentiate = FALSE)`
4: summary(fitlist,exponentiate = FALSE)
3: pool.fitlist(getfit(object),dfcom = dfcom)      
2: pool(model1)
1: summary(pool(model1))

如果我输入

str(complete(imp_data2,action=1))

输出如下:

 'data.frame':   5286 obs. of  45 variables:
  `$ AGE             : num  11.6 12 12.3 11.2 12 ...`
  `$ sex             : num  1 1 1 2 2 1 1 2 2 2 ...`
..- attr(*,"value.labels")= Named chr [1:2] "2" "1"
.. ..- attr(*,"names")= chr [1:2] "female" "male"
$ grade           : num  1 1 1 1 1 1 1 1 1 1 ...
..- attr(*,"value.labels")= Named chr [1:3] "3" "2" "1"
.. ..- attr(*,"names")= chr [1:3] "Country specific grade (15 year old)" "Country specific grade (13 year old)" "Country specific grade (11 year old)"
$ fasfamcar       : num  3 3 3 2 3 3 3 2 3 3 ...
..- attr(*,"names")= chr [1:3] "Yes,two or more" "Yes,one" "No"
$ fasbedroom      : num  1 2 2 2 1 2 2 2 2 2 ...
..- attr(*,"names")= chr [1:2] "Yes" "No"
$ fascomputers    : num  4 3 4 4 4 4 4 4 4 4 ...
..- attr(*,"value.labels")= Named chr [1:4] "4" "3" "2" "1"
.. ..- attr(*,"names")= chr [1:4] "More than two" "Two" "One" "None"
$ fasbathroom     : num  4 4 3 4 3 4 4 3 4 4 ...
..- attr(*,"names")= chr [1:4] "More than two" "Two" "One" "None"
$ fasdishwash     : num  2 2 1 2 2 2 2 2 2 2 ...
..- attr(*,"names")= chr [1:2] "Yes" "No"
$ fasholidays     : num  4 4 3 3 1 4 4 2 2 2 ...
..- attr(*,"names")= chr [1:4] "More than twice" "Twice" "Once" "Not at all"
$ health          : num  1 1 2 2 2 1 1 1 2 1 ...
..- attr(*,"names")= chr [1:4] "Poor" "Fair" "Good" "Excellent"
$ lifesat         : num  9 8 9 7 8 10 10 10 8 9 ...
..- attr(*,"value.labels")= Named chr [1:11] "10" "9" "8" "7" ...
.. ..- attr(*,"names")= chr [1:11] "10 Best possible life" "9" "8" "7" ...
$ feellow         : num  5 5 4 4 5 5 5 5 4 4 ...
..- attr(*,"value.labels")= Named chr [1:5] "5" "4" "3" "2" ...
.. ..- attr(*,"names")= chr [1:5] "Rarely or never" "About every month" "About every week" "More than once a week" ...
$ irritable       : num  5 5 4 4 3 3 5 5 5 4 ...
..- attr(*,"names")= chr [1:5] "Rarely or never" "About every month" "About every week" "More than once a week" ...
$ nervous         : num  4 1 4 3 4 3 5 4 4 4 ...
..- attr(*,"names")= chr [1:5] "Rarely or never" "About every month" "About every week" "More than once a week" ...
$ sleepdifficulty : num  5 5 1 4 5 5 5 5 4 4 ...
..- attr(*,"names")= chr [1:5] "Rarely or never" "About every month" "About every week" "More than once a week" ...
$ fmeal           : num  1 1 2 1 2 1 2 2 4 2 ...
..- attr(*,"names")= chr [1:5] "Never" "Less often" "About once a week" "Most days" ...
$ smok30d_2       : num  1 1 1 1 1 1 1 1 1 1 ...
..- attr(*,"value.labels")= Named chr [1:7] "7" "6" "5" "4" ...
.. ..- attr(*,"names")= chr [1:7] "30 days (or more)" "20-29 days" "10-19 days" "6-9 days" ...
$ drunk30d        : num  1 1 1 1 1 1 1 1 1 1 ...
..- attr(*,"names")= chr [1:5] "Yes,more than 10 times" "Yes,4-10 times" "Yes,2-3 times" "Yes,once" ...
$ likeschool      : num  1 1 1 1 1 2 1 1 2 2 ...
..- attr(*,"names")= chr [1:4] "I don't like it at all" "I don't like it very much" "I like it a bit" "I like it a lot"
$ schoolpressure  : num  2 1 4 1 1 3 1 2 3 2 ...
..- attr(*,"names")= chr [1:4] "A lot" "Some" "A little" "Not at all"
$ studtogether    : num  2 2 3 2 2 2 2 2 2 2 ...
..- attr(*,"names")= chr [1:5] "Strongly disagree" "Disagree" "Neither agree nor disagree" "Agree" ...
$ studhelpful     : num  1 2 3 1 1 2 2 2 1 3 ...
..- attr(*,"names")= chr [1:5] "Strongly disagree" "Disagree" "Neither agree nor disagree" "Agree" ...
$ studaccept      : num  2 3 2 2 2 1 1 2 1 2 ...
..- attr(*,"names")= chr [1:5] "Strongly disagree" "Disagree" "Neither agree nor disagree" "Agree" ...
$ teacheraccept   : num  1 1 2 1 1 1 1 1 1 2 ...
..- attr(*,"names")= chr [1:5] "Strongly disagree" "Disagree" "Neither agree nor disagree" "Agree" ...
$ teachercare     : num  1 1 3 1 3 1 1 2 2 2 ...
..- attr(*,"names")= chr [1:5] "Strongly disagree" "Disagree" "Neither agree nor disagree" "Agree" ...
$ teachertrust    : num  1 1 3 1 2 1 1 2 2 2 ...
..- attr(*,"names")= chr [1:5] "Strongly disagree" "Disagree" "Neither agree nor disagree" "Agree" ...
$ beenbullied     : num  1 3 1 2 1 1 1 1 1 2 ...
..- attr(*,"names")= chr [1:5] "Several times a week" "About once a week" "2 or 3 times a month" "It has happened once or twice" ...
$ cbeenbullied    : num  1 1 1 1 1 1 1 1 1 1 ...
..- attr(*,"names")= chr [1:5] "Several times a week" "About once a week" "2 or 3 times a month" "It has happened once or twice" ...
$ fight12m        : num  1 1 2 1 1 1 1 1 1 1 ...
..- attr(*,"names")= chr [1:5] "4 times or more" "3 times" "2 times" "1 time" ...
$ friendhelp      : num  7 7 4 5 7 5 2 7 7 7 ...
..- attr(*,"names")= chr [1:7] "Very strongly agree" "6" "5" "4" ...
$ friendcounton   : num  7 6 4 5 7 5 1 7 7 7 ...
..- attr(*,"names")= chr [1:7] "Very strongly agree" "6" "5" "4" ...
$ friendshare     : num  7 5 3 5 7 5 1 7 7 7 ...
..- attr(*,"names")= chr [1:7] "Very strongly agree" "6" "5" "4" ...
$ friendtalk      : num  7 4 3 5 6 2 1 7 7 7 ...
..- attr(*,"names")= chr [1:7] "Very strongly agree" "6" "5" "4" ...
$ hadsex          : num  2 2 2 2 2 1 2 2 2 2 ...
..- attr(*,"names")= chr [1:2] "No" "Yes"
$ agesex          : num  1 3 5 1 5 4 3 3 4 5 ...
..- attr(*,"value.labels")= Named chr [1:6] "6" "5" "4" "3" ...
.. ..- attr(*,"names")= chr [1:6] "16 years old and older" "15 years old" "14 years old" "13 years old" ...
$ contraceptcondom: num  2 2 1 3 1 2 1 1 1 3 ...
..- attr(*,"names")= chr [1:3] "Don't know" "No" "Yes"
$ contraceptpill  : num  3 3 3 3 3 3 2 3 2 3 ...
..- attr(*,"names")= chr [1:3] "Don't know" "No" "Yes"
$ motherhome1     : num  1 1 1 1 1 1 1 1 1 1 ...
..- attr(*,"names")= chr [1:2] "No" "Yes"
$ fatherhome1     : num  2 1 2 1 1 1 1 1 1 1 ...
..- attr(*,"names")= chr [1:2] "No" "Yes"
$ talkfather      : num  1 1 2 2 2 2 2 2 2 2 ...
..- attr(*,"names")= chr [1:5] "Don't have or see this person" "Very difficult" "Difficult" "Easy" ...
$ talkmother      : num  1 1 1 2 2 2 2 1 2 1 ...
..- attr(*,"names")= chr [1:5] "Don't have or see this person" "Very difficult" "Difficult" "Easy" ...
$ famhelp         : num  7 7 5 6 7 7 1 7 7 7 ...
..- attr(*,"names")= chr [1:7] "Very strongly agree" "6" "5" "4" ...
$ famsup          : num  7 7 5 6 7 7 1 7 7 7 ...
..- attr(*,"names")= chr [1:7] "Very strongly agree" "6" "5" "4" ...
$ famtalk         : num  7 7 6 6 7 6 1 7 7 7 ...
..- attr(*,"names")= chr [1:7] "Very strongly agree" "6" "5" "4" ...
$ nat11           : num  2 2 3 2 1 2 2 2 2 2 ...
..- attr(*,"names")= chr [1:5] "Always" "Often" "Sometimes" "Hardly ever" ...
- attr(*,"variable.labels")= Named chr(0) 
..- attr(*,"names")= chr(0) 
- attr(*,"codepage")= int 65001

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-