参数必须属于 class StMoMoData
Argument needs to be of the class StMoMoData
您好,我将按照 this file 中的步骤将 CBD 模型拟合到来自 HMD 的美国男性数据。目前我有一个错误,我的参数数据不是 class StMoMoData。
CBDfit <- fit(CBD, data = USData, ages.fit = 60:89)
Error in fit.StMoMo(CBD, data = USData, ages.fit = 60:89) :
Argument data needs to be of class StMoMoData.
我尝试使用人口统计包直接从 R 下载 HMD 数据。我还尝试将 HMD 数据保存为 .csv 文件并将其读入 R。还有其他想法吗?
包中有一个函数可以创建 class StMoMoData 的对象。函数是StMoMoData
...使用方法是这样的:
StMoMoData(data, series = names(data$rate)[1], type = c("central", "initial"))
查看文档以进一步了解。很难为您提供更多帮助,因为您没有提供可重现的示例或一些代码...但是文档中有一个示例:
library(demography)
NZdata <- hmd.mx(country = "NZL_NP", username = username, password = password,
label = "New Zealand")
NZStMoMo <- StMoMoData(NZdata, series = "male")
summary(NZStMoMo)
您好,我将按照 this file 中的步骤将 CBD 模型拟合到来自 HMD 的美国男性数据。目前我有一个错误,我的参数数据不是 class StMoMoData。
CBDfit <- fit(CBD, data = USData, ages.fit = 60:89)
Error in fit.StMoMo(CBD, data = USData, ages.fit = 60:89) :
Argument data needs to be of class StMoMoData.
我尝试使用人口统计包直接从 R 下载 HMD 数据。我还尝试将 HMD 数据保存为 .csv 文件并将其读入 R。还有其他想法吗?
包中有一个函数可以创建 class StMoMoData 的对象。函数是StMoMoData
...使用方法是这样的:
StMoMoData(data, series = names(data$rate)[1], type = c("central", "initial"))
查看文档以进一步了解。很难为您提供更多帮助,因为您没有提供可重现的示例或一些代码...但是文档中有一个示例:
library(demography)
NZdata <- hmd.mx(country = "NZL_NP", username = username, password = password,
label = "New Zealand")
NZStMoMo <- StMoMoData(NZdata, series = "male")
summary(NZStMoMo)