[R-sig-Geo] Weighted linear regression

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Sep 2 15:37:29 CEST 2008


Dear Jean-Paul,

Have a look at the weights argument in ?lm. This should do the trick:

lm(agri ~poly(x, y, degree = 2), data = yourDataFrameName, weights =
var_agri)

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] Namens Jean-Paul Kibambe
Lubamba
Verzonden: dinsdag 2 september 2008 15:21
Aan: r-sig-geo at stat.math.ethz.ch
Onderwerp: [R-sig-Geo] Weighted linear regression

Hi,

I am trying to explain some of my variables using a weighted linear
regression, with x and y-coordinates as my explanatory variables.

For example, I want to explain my variable 'agri' in the following way :
agri = x + y + x*y+ x^2 + y^2 where x and y are my coordinates and the
regression must be weighted by the variance.

How can I do it ? Thanks in advance !

JP

For illustration, here is a part of my database (var_agri = variance)

    agri	     se_agri	var_agri	   x	         y
1  -1.04E-05  4.47E-06	2.00E-11	  23.78230555	2.968836238
2  -1.01E-05  4.36E-06	1.90E-11	  26.05798185	4.476217345
3  -9.47E-06  4.55E-06	2.07E-11	  30.5248107	3.058706843
4  -1.00E-05  4.22E-06	1.78E-11	  26.97325452	0.737615804
5  -9.96E-06  3.74E-06	1.40E-11	  17.67392327	-3.908029603
6  -1.05E-05  4.44E-06	1.97E-11	  25.92926863	3.114662312
7  -1.01E-05  4.35E-06	1.89E-11	  25.4312434	1.572565497
8  -6.54E-06  4.38E-06	1.92E-11	  20.07104333	1.048456276
9  -9.65E-06  4.38E-06	1.91E-11	  23.92598192	1.728975609
10 -7.39E-06  4.20E-06	1.76E-11	  21.2291592	0.489260168

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in  this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document




More information about the R-sig-Geo mailing list