In R, the predict family of functions provides that facility. If you
want the code it will be in the particular function associated with
the model type.
?predict
?predict.glm
# the example illustrates creation of prediction curves on the
response scale for a specific range of data.
# create the desired CI's by appropriate use of the se.fit value
returned from the predict call.
# This is the code inside predict.glm that does the work when se.fit
is set as TRUE in the predict call:
se.fit <- pred$se.fit
switch(type, response = {
se.fit <- se.fit * abs(family(object)$mu.eta(fit))
fit <- family(object)$linkinv(fit)
}, link = , terms = )
--
David Winsemius
On Apr 24, 2009, at 3:03 AM, Michelle Ensbey wrote:
Hi all,
I was wondering if there is a function out there, or someone has
written code for making confidence intervals around model averaged
predictions (y~á+âx). The model average estimates are from the
dRedging library?
It seems a common thing but I can't seem to find one via the search
engines
Examples of the models are:
fit1 <- glm(y~ dbh, family = binomial, data = data)
fit2 <- glm(y~ dbh+vegperc, family = binomial, data = data)
fit3 <- glm(y~ dbh, family = binomial, data = data)
and the model averaging
model.averaging <-model.avg(fit1,fit2,fit3, method="0")
and the output (from model.avg) has the following items:
Coefficient, Variance, Standard error, adjusted standard error and
lower and upper confidence interval for each parameter (and
intercept).
What I would like to do is make "prediction intervals". I know I
need to include covariance and variance. Please let me know if
anyone has a function or code to get these prediction intervals out
of this output.
Thanks in advance for your help, and please advise me if you need
more information
M
michelle.ens...@nt.gov.au
R version 2.8.1
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.