[R] weights in GAMs (package mgcv)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Aug 14 19:26:10 CEST 2007
Let's simplify to a linear model. If your covariates have uncertainties,
most likely a linear regression is not appropriate. This sounds like an
'errors in measurements' model, as covered in
author = "Fuller, Wayne A.",
title = "Measurement Error Models",
publisher = "John Wiley and Sons",
address = "New York",
year = "1987",
ISBN = "0-471-86187-1",
in which there is a true covariate that enters the model, but it is only
observed with measurement error (or similar scenarios).
This is hard enough for linear models, without thinking about non-normal
models or extensions beyond linear predictors. The GLM (including GAM)
estimation process assumes various things, including that the covariates
that enter into the model are fixed (possibly by conditioning on them) and
On Tue, 14 Aug 2007, Julian Burgos wrote:
> Dear list,
> I?m using the ?mgcv? package to fit some GAMs. Some of my covariates are
> derived quantities and have an associated standard error, so I would
> like to incorporate this uncertainty into the GAM estimation process.
> Ideally, during the estimation process less importance would be given to
> observations whose covariates have high standard errors.
> The gam() function in the ?mgcv? package has a ?weights? argument.
> According to the package documentation, this can be used to provide
> prior weights to the data. This argument (as far as I understand) takes
> a vector of the same length of the data with numeric values higher than
> zero. So it seems that I should combine the standard errors of all
> covariates into a single vector and use it as weights. But it is not
> obvious to me how to do this, given that the covariates have different
> units and ranges of values.
Actually this is just taken from glm(), and case weights are part of the
definition of a GLM. In so far as I understand your scenario, you do not
have a GLM.
> Is there any way to provide weights to the covariates directly (for
> example providing a matrix of n x m values, where n=number of covariates
> and m=number of observations)?
> Julian M. Burgos
> Fisheries Acoustics Research Lab
> School of Aquatic and Fishery Science
> University of Washington
> 1122 NE Boat Street
> Seattle, WA 98105
> Phone: 206-221-6864
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help