【问题标题】:Error in round(mf) : non-numeric argument to mathematical function回合错误(mf):数学函数的非数字参数
【发布时间】:2015-11-19 09:19:39
【问题描述】:

我想弄清楚poLCA::poLCA() 函数,但系统给了我这样的警告:

round(mf) 中的错误:数学函数的非数字参数

代码如下:

#Latent class models with one (loglinear independence) to three classes
f=cbind("I_like_to_drink","I_drink_hard_liquor","I_have_drank_in_the_morning","I_have_drank_in_the_work","I_drink_to_get_drunk","I_like_the_taste_of_the_alcohol","I_drink_help_me_sleep","Drinking_interferes_with_my_relationships","I_frequently_visit_bars")~1
    nes1 = poLCA(f,lca1,nclass=1) # log-likelihood: 
    nes2 = poLCA(f,lca1,nclass=2) # log-likelihood: 
    nes3 = poLCA(f,lca1,nclass=3) # log-likelihood: 
    nes4 = poLCA(f,lca1,nclass=4) # log-likelihood: 

【问题讨论】:

  • 您是否按照str(lca1) 控制了您的数据?
  • 是的,999 个条目和 8 个变量。
  • 变量的类型你控制了吗?
  • 是的,我已将所有变量转换为因子类型。

标签: r


【解决方案1】:

这是一个旧帖子,但我正在回复未来的案例(我刚刚遇到了同样的问题)

它应该像定义没有引号的公式一样简单:

f=cbind(I_like_to_drink,I_drink_hard_liquor,I_have_drank_in_the_morning,I_have_drank_in_the_work,I_drink_to_get_drunk,I_like_the_taste_of_the_alcohol,I_drink_help_me_sleep,Drinking_interferes_with_my_relationships,I_frequently_visit_bars)~1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多