Betareg 导致内存分配问题 [英] Betareg causes memory allocation issue

查看:32
本文介绍了Betareg 导致内存分配问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 betareg 包在 R 中运行 beta 回归模型.但是,我出人意料地遇到了内存大小问题.让我解释一下为什么这让我感到惊讶.

I am trying to run a beta regression model in R using the betareg package. However, I am surprisingly running into memory size issue. Let me explain why this surprises me.

我使用的是 Windows 7、64 位、R-64,并且内存为 32 GB.

I am using Windows 7, 64 Bit, R-64, and have 32 GB in RAM.

我正在运行的 betareg 命令是::

The betareg command I am running is::

br1 <- betareg(dfp ~ ago + evl + spe + low + poly(fpt, 4, raw = T), data = tt[tt$zero_one_ind == 1, ], model = T, y = F, x = F)

betareg 模型的对象大小为:

The object size of the betareg model is:

print(object.size(br1), units = "Mb")46 Mb

print(object.size(br1), units = "Mb") 46 Mb

这是我收到的错误信息:

This is the error message I am receiving:

Error: cannot allocate vector of size 344.1 Gb
In addition: Warning messages:
1: In diag(x %*% xwx1 %*% t(x)) :
Reached total allocation of 32693Mb: see help(memory.size)
2: In diag(x %*% xwx1 %*% t(x)) :
 Reached total allocation of 32693Mb: see help(memory.size)
3: In diag(x %*% xwx1 %*% t(x)) :
 Reached total allocation of 32693Mb: see help(memory.size)
4: In diag(x %*% xwx1 %*% t(x)) :
Reached total allocation of 32693Mb: see help(memory.size)

betareg 模型在 R 中成功运行并估计了系数,据我所知,所有的槽都被填满了,但看起来 R 无法构建方差协方差矩阵.任何关于这里出了什么问题的提示?

The betareg model successfully ran in R and estimated the coefficients, and as far as I can tell all of the slots are filled, but it looks like R is unable to construct the variance covariance matrix. Any pointers to what is going wrong here?

推荐答案

我也遇到了同样的问题,解决方法很简单.

I had the same problem, the solution is quite simple.

来自手册:

请注意,默认残差sweighted2"可能是在大样本中计算繁重,因此可能需要在此类应用中进行修改.

Note that the default residuals "sweighted2" might be burdensome to compute in large samples and hence might need modification in such applications.

例如,您可以使用摘要中的其他选项之一:

You could for instance use one of the other options in the summary:

type = c(pearson", deviance", response", weighted", sweighted", sweighted2")

type = c("pearson", "deviance", "response", "weighted", "sweighted", "sweighted2")

这篇关于Betareg 导致内存分配问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆