Error: plotting model averaged estimates against covariates

posts related to the RPresence library, which may not be of general interest to users of 'classic' PRESENCE.

Error: plotting model averaged estimates against covariates

Postby rachelselwyn » Wed Apr 29, 2020 9:57 pm

Hi,
I'm trying to plot model averaged estimates for psi and p against various covariates using the predict function to get a smooth surface. I have no problems using modavg function with the predict argument with example data using code like

psi.ma<-modAvg(aic.tab=results,param="psi",
predict=TRUE,newdata=landscape)
However, when I try to run a similar code with my data and AIC output I consistently get an error:
" Error in pred.mat %*% coeff : non-conformable arguments".
I have designed the newdata to match the structure of the initial dataset, same length and all the same unitcov names. I have tried everything I can think of but cannot get the error to go away and for the predict function to work.
Does anyone have any ideas what could be causing the problem? This is my newdata and Modaveraged predict code :

new.data<-data.frame(hab=c("alluvialbench","uplandgranite","lowlandsandstone","peatswamp","freshwaterswamp"),
z_pheno=seq(min(BP$unitcov$z_pheno), max(BP$unitcov$z_pheno), length=2500), z_elev=seq(min(BP$unitcov$z_elev),
max(BP$unitcov$z_elev), length=2500), z_elev_sq=seq(min(BP$unitcov$z_elev_sq), max(BP$unitcov$elev_sq), length=2500),
h_index=seq(min(BP$unitcov$h_index), max(BP$unitcov$h_index), length=2500), effort=seq(min(BP$unitcov$effort), max(BP$unitcov$effort), length=2500),
off_trail_=c(0,1), time=seq(min(BP$unitcov$time), max(BP$unitcov$time), length=2500))

new.ma.psi<-modAvg(aic.tab =bporesults,param = "psi", predict=TRUE, newdata = new.data )


Thanks,
-Rachel
rachelselwyn
 
Posts: 3
Joined: Thu Feb 20, 2020 4:10 pm

Re: Error: plotting model averaged estimates against covaria

Postby jhines » Wed Apr 29, 2020 11:18 pm

Hi Rachel,

If you send me your R script and data files, (or just use save.image and send me the rdata file), I'd be happy to diagnose the problem.

Jim (jhines@usgs.gov)
jhines
 
Posts: 599
Joined: Fri May 16, 2003 9:24 am
Location: Laurel, MD, USA


Return to RPresence

Who is online

Users browsing this forum: No registered users and 11 guests

cron