2017-02-13 13 views
0

私はRにとても慣れていて、現在シベリの楕円を作成しようとしています。siber.ellipses - > rmultireg(Y、X、Bbar、A、nu、V)のエラー:行列ではありません。

私はポップキャスティングを見ました。楕円を使ってコミュニティメンバーを比較しました:(http://www.tcd.ie/Zoology/research/research/theoretical/Rpodcasts.php#siber)、最初はうまくいっています。私がsiber.ellipsesの関数になるたびにエラーが発生します: (rmultireg(Y、X、Bbar、A、nu、V)のエラー:行列ではありません) 私は理由を理解できません。私は自分自身のデータだけでなく、スクリプトと一緒に提供されているzipファイルのサンプルデータも手に入れています。

オンラインでエラーメッセージを調査しましたが、回答が出られませんでした。

スクリプトやデータには、提供されているとおりのものを使用しているため、ほとんどエラーが発生する可能性があります。私のRバージョンは3.3.2です 何らかの設定と関連がありますか? 理由は何でしょうか? rmultiregで

誰かが私をhelpeてくださいすることができ:)

おかげ

# this demo generates some random data for M consumers based on N samples and 
# constructs a standard ellipse for each based on SEAc and SEA_B 

rm(list = ls()) 

library(siar) 

------------------------------------------------------------------------- 
# ANDREW - REMOVE THESE LINES WHICH SHOULD BE REDUNDANT 
# change this line 
setwd("C:/Users/elisabeth/Desktop/R/demo") 

#  ----------------------------------------------------------------------------- 
# now close all currently open windows 
graphics.off() 

# read in some data 
# NB the column names have to be exactly, "group", "x", "y" 
mydata <- read.table("example_ellipse_data.txt",sep="\t",header=T) 

# make the column names availble for direct calling 
attach(mydata) 


# now loop through the data and calculate the ellipses 
ngroups <- length(unique(group)) 



# split the isotope data based on group 
spx <- split(x,group) 
spy <- split(y,group) 

# create some empty vectors for recording our metrics 
SEA <- numeric(ngroups) 
SEAc <- numeric(ngroups) 
TA <- numeric(ngroups) 

dev.new() 
plot(x,y,col=group,type="p") 
legend("topright",legend=as.character(paste("Group ",unique(group))), 
    pch=19,col=1:length(unique(group))) 

for (j in unique(group)){ 


    # Fit a standard ellipse to the data 
    SE <- standard.ellipse(spx[[j]],spy[[j]],steps=1) 

    # Extract the estimated SEA and SEAc from this object 
    SEA[j] <- SE$SEA 
    SEAc[j] <- SE$SEAc 

    # plot the standard ellipse with d.f. = 2 (i.e. SEAc) 
    # These are plotted here as thick solid lines 
    lines(SE$xSEAc,SE$ySEAc,col=j,lty=1,lwd=3) 


    # Also, for comparison we can fit and plot the convex hull 
    # the convex hull is plotted as dotted thin lines 
    # 
    # Calculate the convex hull for the jth group's isotope values 
    # held in the objects created using split() called spx and spy 
    CH <- convexhull(spx[[j]],spy[[j]]) 

    # Extract the area of the convex hull from this object 
    TA[j] <- CH$TA 

    # Plot the convex hull 
    lines(CH$xcoords,CH$ycoords,lwd=1,lty=3) 


} 

# print the area metrics to screen for comparison 
# NB if you are working with real data rather than simulated then you wont be 
# able to calculate the population SEA (pop.SEA) 
# If you do this enough times or for enough groups you will easily see the 
# bias in SEA as an estimate of pop.SEA as compared to SEAc which is unbiased. 
# Both measures are equally variable. 
print(cbind(SEA,SEAc,TA)) 

# So far we have fitted the standard ellipses based on frequentist methods 
# and calculated the relevant metrics (SEA and SEAc). Now we turn our attention 
# to producing a Bayesian estimate of the standard ellipse and its area SEA_B 


reps <- 10^4 # the number of posterior draws to make 

# Generate the Bayesian estimates for the SEA for each group using the 
# utility function siber.ellipses 
SEA.B <- siber.ellipses(x,y,group,R=reps) 

をエラー(Y、X、BBAR、A、NU、V):マトリックス

答えて

0

がSIARを再インストールしていませんJacksonのGithubサイトを使用してパッケージ:

library(devtools) 
install_github("andrewljackson/[email protected]", build_vingettes == TRUE) 
library(siar) 
関連する問題