Good, that is the error message you should get, and R tries to
understand what you wanted to do. ;-)
> The formula = Response ~ f(Temperature, model="iid") also run smoothly. I
> tried to understand what is the concept behind "pure random effects".
That model says
y_i = a + e_i + eps_i, where both e_i and eps_i are independent
whereas the regression model is
y_i = a + t_i * beta + eps_i, where t_i are the temperatures.
Forget about the "pure random effects" model until you actually want a
model of that type... The regression models is what you want.
/Finn
Estimate Std. Error z value Pr(>|z|)
(Intercept) -88.4505 8.6446 -10.23 <2e-16 ***
Temperature 2.9677 0.2893 10.26 <2e-16 ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’
1
INLA result :
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant
(Intercept) -28.8392982 3.0662949 -34.8361799 -28.8452536 -22.8074389
Temperature 0.7249629 0.1015447 0.5251831 0.7251992 0.9234421
kld
(Intercept) 1.768524e-07
Temperature 4.628354e-07
If I may summarised,
GLM : logit(p) = -88.4505 + 2.9677*Temperature
INLA: logit(p) = -28.8392982 + 0.7249629*Temperature
Just curious of the differences. :)
Eddie
I think you just spesified the glm-model wrong using the weight-argument
instead of cbind(y,n)
> summary(inla(X.Response. ~ X.Temperature., data = d, family =
"binomial", Ntrials=d$X.n.))
Call:
c("inla(formula = X.Response. ~ X.Temperature., family = \"binomial\",
", " data = d, Ntrials = d$X.n.)")
Time used:
Pre-processing Running inla Post-processing Total
0.06314635277 0.04034376144 0.01054978371 0.11403989792
Fixed effects:
mean sd 0.025quant 0.5quant
(Intercept) -28.8241043091 3.0663123131 -34.8000865405 -28.8379472521
X.Temperature. 0.7244566083 0.1015451699 0.5239653221 0.7249486172
0.975quant kld
(Intercept) -22.7685405426 9.406954188e-06
X.Temperature. 0.9222016233 8.001251409e-06
The model has no random effects
The model has no hyperparameters
Expected number of effective parameters(std dev): 2.007(0.00)
Number of equivalent replicates : 338.33
Marginal Likelihood: 0.00
Warning: Interpret the marginal likelihood with care if the prior model
is improper.
> summary(glm(cbind(X.Response., X.n.) ~ X.Temperature., data = d,
family = binomial()))
Call:
glm(formula = cbind(X.Response., X.n.) ~ X.Temperature., family =
binomial(),
data = d)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.75038246 -0.92247152 0.06408632 0.53389689 0.89910308
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -28.8192031 3.0665683 -9.39787 < 2.22e-16 ***
X.Temperature. 0.7242266 0.1015535 7.13148 9.9294e-13 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 407.38952 on 678 degrees of freedom
Residual deviance: 359.29633 on 677 degrees of freedom
AIC: 1194.6843
Number of Fisher Scoring iterations: 5
--
INLA help <he...@r-inla.org>
R-INLA
glm( cbind(y, n - y) ~ ....)
so it should read
glm(cbind(X.Response., X.n. - X.Response.) ~ X.Temperature., ....