Hello. I'm trying to analyze data, which is looking at the relationship between
temperature and survival for fish (from fertilization to emergence). Looking at
the raw data, there appears to be a bell shaped relationship. Ordinarily for
survival data, I would run a generalized linear model (because the data has a
binomial error structure). However, I am thinking that running a generalized
additive model (which I've never used before), as its my understanding that
they are better able to deal with non-linear relationships. Hopefully this is a
correct assumption.
Question 1: Unfortunately, the data I have to work with is not formatted to be
as #successes or # failures, as R seems to want for other generalized models
(the survival data I have is percent survival). I'm using 'The R Book' by Mick
Crawley,and have searched online, but haven't had much luck finding the right
code that will run with percentage data for GAM (and whether or not its
appropriate to use percentage data). Is it inappropriate to run the analyses
like this? With Generalized Linear Models R seems to want #successes and
failures, but the GAM doesn't (it worked--output below). I'm just wondering
whether it is alright to run the model as I have done (with percentage data)?
Question 2: For this type of model (GAM), is there a simple way of constructing
an equation for the model (e.g., to come up with predicted values). This is
probably not the best, but I've plotted the predicted values in Excel, fitted a
polynomial trend line and got the equation from there. I'm just wondering if
there's a more appropriate way to get it in R?
Not sure if it would be useful, but I've provided the code and output for the
model below. Any help you can offer would be much appreciated. Thanks in
advance for your help--I really appreciate it!
Kris
> names(data)
[1] "Temp" "Survival"
> str(data)
'data.frame': 17 obs. of 2 variables:
$ Temp : num 35.6 38.8 39 39 41 ...
$ Survival: num 0.14 0.972 0.697 0.938 0.83 0.987 0.989 0.9 0.996 0.87 ...
>
> Surv<-gam(Survival~s(Temp), quasibinomial, data=na.omit(data))
> summary(Surv)
Family: quasibinomial
Link function: logit
Formula:
Survival ~ s(Temp)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.9938 0.3067 6.501 8.02e-05 ***
---
Signif. codes: 0 â***â 0.001 â**â 0.01 â*â 0.05 â.â 0.1 â â
1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(Temp) 6.325 6.325 4.065 0.0257 *
---
Signif. codes: 0 â***â 0.001 â**â 0.01 â*â 0.05 â.â 0.1 â â
1
R-sq.(adj) = 0.775 Deviance explained = 81.2%
GCV score = 0.18885 Scale est. = 0.10748 n = 17
This email has been processed by SmoothZap - www.smoothwall.net
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel