[R] weights in GAMs (package mgcv)

Julian Burgos jmburgos at u.washington.edu
Tue Aug 14 18:45:00 CEST 2007

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.

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

More information about the R-help mailing list