[R-sig-Geo] spBayes package spLM function

Sarah Goslee sarah.goslee at gmail.com
Fri Jul 24 00:16:35 CEST 2015


Are you sure that cook is a matrix and not a data frame?

What are the outputs of:

dim(cook)
is.matrix(cook)
str(cook)

Sarah

On Thu, Jul 23, 2015 at 6:12 PM, Helen Chen <hc10024 at gmail.com> wrote:
> Hi,
>
> I have tried to implement the spLM function from spBayes package to my data
> (rainfall value, elevation, coordinates).
>
> However, the error message shows up when I run this chunk of codes:
>
> bef.sp <- spLM(S3~elv,
> + data=A, coords=cook, starting=list("phi"=3/200,"sigma.sq"=0.08,
> + "tau.sq"=0.02), tuning=list("phi"=0.1, "sigma.sq"=0.05, "tau.sq"=0.05),
> +                priors=list("phi.Unif"=c(3/1500, 3/50), "sigma.sq.IG"=c(2,
> 0.08),"tau.sq.IG"=c(2, 0.02)), cov.model="spherical",n.samples=n.samples)
>
> the error message is
>
> Error in spLM(S3 ~ elv, data = A, coords = cook, starting = list(phi =
> 3/200,  :
>   error: coords must n-by-2 matrix of xy-coordinate locations
>
> I am sure that my coordinates is a 29 by 2 matrix, but it also tells me
> this error message.
>
> Could anyone help me to figure out. Thanks for all your help.
>
>
>
> Helen
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-sig-Geo mailing list