[R] negative prediction by gam (mgcv package)
Gavin Simpson
gavin.simpson at ucl.ac.uk
Fri Nov 14 08:44:10 CET 2008
On Thu, 2008-11-13 at 21:32 -0800, sunil_POUDEL wrote:
> Hi
>
> Gam in mgcv package is predicting negative values which should not be
> the case despite all the predictors and response variables are positive.
> Tried to use log link function but it did not help. Please help
>
>
> sunil
Please help us to help you!
Each message on this list has the following in the footer:
....
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
So, if you do what it asks, someone on the list might well be able to
help. Read what you wrote to the list - how can anyone possibly know
what you did to end up with the results you got? (Without wasting their
time thinking it through for you!)
Having said that, am I'm starting at the beginning because you didn't
even show the code you are using for predict (!), did you perhaps use
the default for the *type* of predictions? If so, these are on the scale
of the linear predictor and *can* be negative. If you want predictions
on the scale of the response set argument 'type' to:
type = "response"
in your call to predict.
See ?predict.gam
G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081114/24cdb5da/attachment.bin>
More information about the R-help
mailing list