I'm not sure what you want here.
Have you looked at ?predict.gam
# Load the gamm4 package
# Using gamm4's built-in data simulation capabilities to give us some data:
dat <- gamSim(6, n=100, scale=2)
# Fitting a model and plotting it:
mod <- gamm4(y~s(x0)+s(x1)+s(x2), data=dat, random = ~ (1|fac))
First, rewriting the $QR$ decomposition in a (hopefully) clearer way by showing the partitioning of $Q$ and explicitly giving the dimensions of the $0$ matrix:
So I think part of the confusion here is that in the book you are referring to, $R$ is not the $R$ of the $...
Your error message "weights must be like glm weights for generalized case" is saying that if you choose to use Gamm() with a generalized case (which means: using a non-Gaussian probability distribution such as Gamma) then the weights argument should be specified as it would be for GlmmPQL().
The explanation is that GAMM is essentially a wrapper function ...
This model is possible with the brms R package which is an interface to R:
A slight modification of one of the examples from https://cran.r-project.org/web/packages/brms/vignettes/brms_distreg.html shows essentially what is involved in setting up and fitting the model
## load package
## load data
zinb <- read.csv("http://stats.idre.ucla....
Yes, they are included, but only ever for the observed levels of the random factor. You can turn this using the by variable smooth trick however.
Consider the following example taken from ?gam.models:
dat <- gamSim(1,n=400,scale=2) ## simulate 4 term additive truth
## Now add some random effects to the simulation. Response is
## grouped into one of 20 ...
I would suggest a different strategy, fitting this as a GAM via gam(), and using a count distribution as the real response variable is an integer count.
The response should be Items in this setting. We do need to standardise by the effort but we can do that using a offset in the model. An offset is a term that has a fixed coefficient of 1, and it's ...
No, ocat doesn't work with gamm4(). From ?family.mgcv
As well as the standard families documented in family (see also
glm) which can be used with functions gam, bam and gamm,
mgcv also supplies some extra families, most of which are
currently only usable with gam, although some can also be used
(emphasis added). ...
You could add s(Year) + s(Year, by = area, m = 1) which will generate a common trend (s(Year)) and area-specific smooth departures from this common trend. The m = 1 in the area-specific term use a penalty on the first derivative of the spline and hence penalises departures from a flat, horizontal line, which when coupled with the common trend models how the ...
I would try running this using the bam() function in the mgcv which is designed for large data problems. You can add the simple random effects via a random effect spline s(transmitter, bs = "re") in the bam() formula, but this might cause you new problems as random effects in gam()/bam() don't make use of the sparsity of the model matrix of the random ...