Hi all, This might be a very dumb question that shows I have very little idea of what I am talking about, but I'll risk it: What is the difference between fitting a model using these 3 different syntaxes? 1/ fit1 <- ppm(ppp, ~covariate), 2/ fit2 <- ppm(ppp, ~x+y+Z, covariates=list(Z=covariate)) 3/ fit3 <- ppm(ppp, ~x+y+covariate) where ppp is my point pattern and "covariate" is a pixel image? I realise the outputs of 2 and 3 are the same and different to that of 1, so I guess the question really is a/ Is there any difference, practical or in the actual computations of the model, between using 2 and 3? b/ What is the difference between (2&3) and 1? Thanks a lot, Virginia Morera PhD Student Department of Animal Biology University of Barcelona Aquest correu electr?nic i els annexos poden contenir informaci? confidencial o protegida legalment i est? adre?at exclusivament a la persona o entitat destinat?ria. Si no sou el destinatari final o la persona encarregada de rebre?l, no esteu autoritzat a llegir-lo, retenir-lo, modificar-lo, distribuir-lo, copiar-lo ni a revelar-ne el contingut. Si heu rebut aquest correu electr?nic per error, us preguem que n?informeu al remitent i que elimineu del sistema el missatge i el material annex que pugui contenir. Gr?cies per la vostra col?laboraci?. Este correo electr?nico y sus anexos pueden contener informaci?n confidencial o legalmente protegida y est? exclusivamente dirigido a la persona o entidad destinataria. Si usted no es el destinatario final o la persona encargada de recibirlo, no est? autorizado a leerlo, retenerlo, modificarlo, distribuirlo, copiarlo ni a revelar su contenido. Si ha recibido este mensaje electr?nico por error, le rogamos que informe al remitente y elimine del sistema el mensaje y el material anexo que pueda contener. Gracias por su colaboraci?n. This email message and any documents attached to it may contain confidential or legally protected material and are intended solely for the use of the individual or organization to whom they are addressed. We remind you that if you are not the intended recipient of this email message or the person responsible for processing it, then you are not authorized to read, save, modify, send, copy or disclose any of its contents. If you have received this email message by mistake, we kindly ask you to inform the sender of this and to eliminate both the message and any attachments it carries from your account.Thank you for your collaboration.
different models
4 messages · Virginia Morera Pujol, Rolf Turner
On 06/04/16 22:00, Virginia Morera Pujol wrote:
Hi all, This might be a very dumb question that shows I have very little idea of what I am talking about, but I'll risk it: What is the difference between fitting a model using these 3 different syntaxes? 1/ fit1 <- ppm(ppp, ~covariate), 2/ fit2 <- ppm(ppp, ~x+y+Z, covariates=list(Z=covariate)) 3/ fit3 <- ppm(ppp, ~x+y+covariate) where ppp is my point pattern and "covariate" is a pixel image? I realise the outputs of 2 and 3 are the same and different to that of 1, so I guess the question really is a/ Is there any difference, practical or in the actual computations of the model, between using 2 and 3? b/ What is the difference between (2&3) and 1?
(1) There is essentially no difference between fits 2 & 3. The fit 2
syntax is provided so that the user can have the relevant covariates
bundled up in a list without any need to extract these covariates from
that list. With the fit 2 syntax you don't need to have all covariates
present in your workspace.
E.g.: fit <- ppm(bei ~ elev + grad, data=bei.extra)
(2) The fit 2 syntax is essentially the same as that used by lm() and
glm() and was designed in imitation thereof.
(3) The preferred structure of a call to ppm() is
fit2 <- ppm(ppp ~ x + y + Z, data=list(Z=covariate))
Note: "data" rather than "covariates"; no comma between the name of the
response variable ("ppp") and the formula.
This makes the syntax identical to that of lm() and glm().
The syntax that you used is a remnant of earlier versions of spatstat
and remains acceptable for reasons of backward compatibility.
(4) The difference between model 1 and models 2 and 3 is that models 2
and 3 involve the Cartesian coordinates "x" and "y". Model 1 is such
that the model intensity takes the form
exp(beta_0 + beta_1 * covariate)
In models 2 and 3 the model intensity takes the (more complex) form
exp(beta_0 + beta_1 * x + beta_2 *y beta_3 * covariate)
Note that "x" and "y" are *reserved* names. You cannot use these names
for any covariates *other than* the Cartesian coordinates.
(5) The name "covariate" is probably *not* a good name for a covariate.
As fortune(77) puts it "Would you call your dog 'dog'?"
(6) Likewise (and even more so) "ppp" is *not* a good name for a point
pattern, since it clashes the name of the creator function ppp().
cheers,
Rolf Turner
Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276
Hi Rolf, Thank you for your very complete response. If I understand it correctly then, I should just include the Cartesian coordinates in my covariates list if I want to model the intensity specifically in relation to them as well as the covariates, correct? Oh, and just for clarification, I do not name my point patterns "ppp" and my covariates "covariate" (although I kind of like the idea of calling my dog "dog"). I was just trying to make a general example, but thanks for the heads up anyway! Best, Virginia Morera PhD Student Department of Animal Biology University of Barcelona Aquest correu electr?nic i els annexos poden contenir informaci? confidencial o protegida legalment i est? adre?at exclusivament a la persona o entitat destinat?ria. Si no sou el destinatari final o la persona encarregada de rebre?l, no esteu autoritzat a llegir-lo, retenir-lo, modificar-lo, distribuir-lo, copiar-lo ni a revelar-ne el contingut. Si heu rebut aquest correu electr?nic per error, us preguem que n?informeu al remitent i que elimineu del sistema el missatge i el material annex que pugui contenir. Gr?cies per la vostra col?laboraci?. Este correo electr?nico y sus anexos pueden contener informaci?n confidencial o legalmente protegida y est? exclusivamente dirigido a la persona o entidad destinataria. Si usted no es el destinatario final o la persona encargada de recibirlo, no est? autorizado a leerlo, retenerlo, modificarlo, distribuirlo, copiarlo ni a revelar su contenido. Si ha recibido este mensaje electr?nico por error, le rogamos que informe al remitente y elimine del sistema el mensaje y el material anexo que pueda contener. Gracias por su colaboraci?n. This email message and any documents attached to it may contain confidential or legally protected material and are intended solely for the use of the individual or organization to whom they are addressed. We remind you that if you are not the intended recipient of this email message or the person responsible for processing it, then you are not authorized to read, save, modify, send, copy or disclose any of its contents. If you have received this email message by mistake, we kindly ask you to inform the sender of this and to eliminate both the message and any attachments it carries from your account.Thank you for your collaboration. 2016-04-07 5:11 GMT+02:00 Rolf Turner <r.turner at auckland.ac.nz>:
On 06/04/16 22:00, Virginia Morera Pujol wrote:
Hi all, This might be a very dumb question that shows I have very little idea of what I am talking about, but I'll risk it: What is the difference between fitting a model using these 3 different syntaxes? 1/ fit1 <- ppm(ppp, ~covariate), 2/ fit2 <- ppm(ppp, ~x+y+Z, covariates=list(Z=covariate)) 3/ fit3 <- ppm(ppp, ~x+y+covariate) where ppp is my point pattern and "covariate" is a pixel image? I realise the outputs of 2 and 3 are the same and different to that of 1, so I guess the question really is a/ Is there any difference, practical or in the actual computations of the model, between using 2 and 3? b/ What is the difference between (2&3) and 1?
(1) There is essentially no difference between fits 2 & 3. The fit 2
syntax is provided so that the user can have the relevant covariates
bundled up in a list without any need to extract these covariates from that
list. With the fit 2 syntax you don't need to have all covariates present
in your workspace.
E.g.: fit <- ppm(bei ~ elev + grad, data=bei.extra)
(2) The fit 2 syntax is essentially the same as that used by lm() and
glm() and was designed in imitation thereof.
(3) The preferred structure of a call to ppm() is
fit2 <- ppm(ppp ~ x + y + Z, data=list(Z=covariate))
Note: "data" rather than "covariates"; no comma between the name of the
response variable ("ppp") and the formula.
This makes the syntax identical to that of lm() and glm().
The syntax that you used is a remnant of earlier versions of spatstat and
remains acceptable for reasons of backward compatibility.
(4) The difference between model 1 and models 2 and 3 is that models 2 and
3 involve the Cartesian coordinates "x" and "y". Model 1 is such that the
model intensity takes the form
exp(beta_0 + beta_1 * covariate)
In models 2 and 3 the model intensity takes the (more complex) form
exp(beta_0 + beta_1 * x + beta_2 *y beta_3 * covariate)
Note that "x" and "y" are *reserved* names. You cannot use these names
for any covariates *other than* the Cartesian coordinates.
(5) The name "covariate" is probably *not* a good name for a covariate.
As fortune(77) puts it "Would you call your dog 'dog'?"
(6) Likewise (and even more so) "ppp" is *not* a good name for a point
pattern, since it clashes the name of the creator function ppp().
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
On 07/04/16 19:52, Virginia Morera Pujol wrote:
Hi Rolf, Thank you for your very complete response. If I understand it correctly then, I should just include the Cartesian coordinates in my covariates list if I want to model the intensity specifically in relation to them as well as the covariates, correct?
Well, in a word, yes. Dunno what more I can say without inducing obfuscation instead of clarification (of what is actually a simple issue.) The best way to get an understanding of what is involved, IMHO, is to do some experimentation. Fit some models to some data, plot the fitted surfaces (either as image plots or perspective plots) and see what the results look like. <SNIP> cheers, Rolf
Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276