我想知道如何使用mixstock包。

huangapple go评论98阅读模式
英文:

I wonder how to use mixstock package

问题

我正在研究基于Bolker提供的步行指南的混合库存分析(https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=043730a02b148396ebd54b2f62e8f6364714b1b2),使用'mixstock'包。

在练习使用该包时,我遇到了一些问题。在进行多对多分析的过程中发生了错误,因此示例中呈现的图形未显示出来。您是否可能解决这个问题?

我想知道如何使用mixstock包。

我想制作这个图,但是

我想知道如何使用mixstock包。

我的代码生成了这个图。

这是我的代码。

Z = simmixstock2(nsource=4,nmark=5,nmix=3,
          sourcesize=c(4,2,1,1),
          sourcesampsize=rep(25,4),
          mixsampsize=rep(30,3),rseed=1001)
Zfit0 = mm.wbugs(Z,sourcesize=c(4,2,1,1),returntype="bugs")
plot(as.mcmc.bugs(Zfit0))
plot(Zfit0)

此外,我可以在"simmixstock2"命令中放入自己的数据而不是随机数据吗?我想用我的数据做一次,但是手动命令似乎只能生成随机数据,所以我想知道是否有办法。谢谢。

英文:

I'm studing a mixed stock analysis based on walkthrough provided by Bolker (https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=043730a02b148396ebd54b2f62e8f6364714b1b2), using the 'mixstock' package.

I had some problems while practicing the package. An error occurred in the process of graphing the many-to-many analysis, so the graph presented in the example does not appear. Could you possibly solve that problem?

我想知道如何使用mixstock包。

i want to make this graph, but

我想知道如何使用mixstock包。

My code made this graph.

This is my code.

Z = simmixstock2(nsource=4,nmark=5,nmix=3,
          sourcesize=c(4,2,1,1),
          sourcesampsize=rep(25,4),
          mixsampsize=rep(30,3),rseed=1001)
Zfit0 = mm.wbugs(Z,sourcesize=c(4,2,1,1),returntype="bugs")
plot(as.mcmc.bugs(Zfit0))
plot(Zfit0)

Also, can I put my own data other than random data into the "simmixstock2" command? I want to do it once with my data, but the manual command seems to generate it only randomly, so I would like to know if there is a way. thank you.

答案1

得分: 0

这部分的翻译如下:

这对我有用:

library(mixstock)
Z = simmixstock2(nsource=4,nmark=5,nmix=3,
          sourcesize=c(4,2,1,1),
          sourcesampsize=rep(25,4),
          mixsampsize=rep(30,3),rseed=1001)
Zfit0 = mm.wbugs(Z,sourcesize=c(4,2,1,1), pkg="JAGS", jags.seed = 101)
plot(Zfit0)

更改如下:

  • 使用JAGS而不是WinBUGS(后者可能已经过时,无论如何,在除Windows之外的平台上运行困难;我不知道OpenBUGS的状态),包括设置MCMC运行的种子
  • 不要指定returntype = "bugs"(相反,使用默认的"mixstock"选项,可以生成可绘制的结果)

对于以下这部分内容,我不太确定你的意思:

是否可以在"simmixstock2"命令中输入自己的数据而不是随机数据?

simmixstock2()函数是为了在你没有自己的数据时模拟数据而设计的情况。在vignette/walkthrough的第4-5页有关于如何为多个混合库存输入数据的说明(将它们作为附加列添加到矩阵中(行=单倍型,列=来源和混合库存),并在使用as.mixstock.data()时指定混合库存的数量(默认为nmix=1)。

英文:

This works for me:

library(mixstock)
Z = simmixstock2(nsource=4,nmark=5,nmix=3,
          sourcesize=c(4,2,1,1),
          sourcesampsize=rep(25,4),
          mixsampsize=rep(30,3),rseed=1001)
Zfit0 = mm.wbugs(Z,sourcesize=c(4,2,1,1), pkg="JAGS", jags.seed = 101)
plot(Zfit0)

The changes are

  • use JAGS instead of WinBUGS (which may be nearly obsolete - in any case, hard to run on platforms other than Windows; I don't know the status of OpenBUGS), including setting the seed for the MCMC run
  • don't specify returntype = "bugs" (instead, the default "mixstock" option gives something that we can plot)

I'm not quite sure what you mean by

> can I put my own data other than random data into the "simmixstock2" command ?

The simmixstock2() function is designed for simulating data in the case where you want to see how things work when you don't have your own data. There are instructions in the vignette/walkthrough on pp. 4-5 about how to input data for multiple mixed stocks (add them as additional columns to a matrix (with rows = haplotypes, columns = sources and mixed stocks) and specify the number of mixed stocks (nmix=1 by default) when using as.mixstock.data()).

huangapple
  • 本文由 发表于 2023年7月28日 04:17:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76783135.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定