by Prashant_mahajan » Thu Nov 17, 2022 4:10 am
Also, when I plot the psi values with a covariate, the graph shows a different curve than the beta estimate. For example, my beta estimates values are:
beta_parameters_cov est se
A1_psiA 2.31 0.79
A2_psiBA -3.40 0.94
A3_psiBa -0.11 2.83
A4_psiA.cov_psiA 2.53 1.11
A5_psiBA.SP2:cov_psiBA -2.90 1.23
A6_psiBa.INT2:cov_psiBa 0.13 3.82
The effect of "cov" on psiBa is positive however, my graph shows a decreasing probability of psiBa with an increase in cov. I am using the following codes:
cov=seq(min(data$unitcov$cov,
na.rm = TRUE),
max(data$unitcov$cov,
na.rm = TRUE),
by = 0.01);
nu=length(cov)
newdata=data.frame(
SP=factor(c(rep('A',nu),rep('B',2*nu))),
INT=c(rep(0,nu),rep(0,nu),rep(1,nu)),
cov=cov)
z = predict(object=mod3, newdata=newdata, param='psi')
# add parameter name to z data-frame
z$param = c(rep('psiA',nu),rep('psiBA',nu), rep('psiBa',nu))
z$cov = newdata$cov
ggplot(z,aes(x=cov,y=est)) + xlab('cov (standardized)') +
ylab('Occupancy Probability')+
ylim(0,1)+
geom_line(aes(color=param))+
theme_classic()
Is there any error in the codes, because of which my graph shows an opposite curve for psiBa.