由于NA值导致向量自回归错误

时间:2019-08-30 08:09:40

标签: r

我正在尝试执行以下命令:

def foo(input_argument):
    func_name = 'foo'

    if type(input_argument) is not int or type(input_argument) is not str:
        print(
            '%s: "input_argument" expects int/str, not %s' % (
                func_name,
                type(input_argument)
            )
        )
        return None
    try:
        input_argument= int(input_argument)
    except:
        print(
            '%s: "input_argument" expects number in str/int format' % func_name
        )
        return None

此变量:

library(vars) # Load package
var.1 <- VAR(v1, 2, type = "none") # Estimate the model

如何处理NA值,以便正确执行VAR模型?

我不想更改NA值,我只是在寻找> dput(v1) c(NA, NA, NA, NA, 83065.8078463786, 80315.8839450438, 291505.602198517, 221513.303866292, 279140.380651832, 298097.0639114, 272173.784046495, 412897.18764903, 387304.736250378, 411286.048269894, 368148.919445238, 422553.963363549, 387894.509272978, 379685.266347887, 323750.28443457, 348857.195576222, 371270.579837624, 359926.267077774, 311822.695796726, 368679.198734135) 之类的用于lm回归的命令

编辑:

如果我具有以下数据框,怎么办:

na.action=na.omit

只有1个变量具有NA的地方?

0 个答案:

没有答案