Sorry: I put wrong subject in my previous mail..Dear list,I have a data set with 3 columns (crop yield, temperature, precipitation). I fitted CAR and SAR model using yield as dependent variable and the rest two as independent variables. Now, does it make sense if I include the interaction term temperature*precipitation as well  as a predictor in the model?  Next,  Is it possible to  fit autologistic model for such a data? (I see that my data is not binary).Thanks,Mitra 
 
 


Mitra DevkotaBrookings, SD 57006571 242 6140"A person who never made a mistake never tried anything new". -Albert Einstein


 



 > From: mitradevkota@hotmail.com
> To: r-sig-geo@r-project.org
> Date: Mon, 8 Oct 2012 23:03:04 +0000
> Subject: Re: [R-sig-Geo] finding CRS from latitude/longitude
> 
> Dear list,I have a data set with 3 columns (crop yield, temperature, precipitation). I fitted CAR and SAR model using yield as dependent variable and the rest two as independent variables. Now, does it make sense if I include the interaction term temperature*precipitation as well  as a predictor in the model?  Next,  Is it possible to  fit autologistic model for such a data? (I see that my data is not binary).Thanks,Mitra 
> 
> 
> Mitra DevkotaBrookings, SD 57006571 242 6140"A person who never made a mistake never tried anything new". -Albert Einstein
> 
> 
>  
> 
> 
> 
>  > Date: Mon, 8 Oct 2012 23:21:49 +0100
> > From: mintibezabih@gmail.com
> > To: r.hijmans@gmail.com; tom.gottfried@o2mail.de
> > CC:
> > Subject: Re: [R-sig-Geo] finding CRS from latitude/longitude
> > 
> > Dear Robert,
> > 
> > Thanks.  I have now tried rasterizing as per your suggestion but I was not
> > sure what should exactly get into the rasterize as the raster.object
> > argument (r in my case). Below is a reproducable example I did with what I
> > think could be potential r's.
> > 
> > x <- 1:10
> > y <- 1:10
> > F1<-data.frame(x, y)
> > library(raster)
> > r <- raster(as.matrix(F1))
> > #r <- raster(ncols=36, nrows=18)
> > xy <- cbind(x, y)
> > r1 <- rasterize(xy, r)
> > 
> > I would be happy if I get suggestions on how I can fix this.
> > 
> > Thanks
> > minti
> > On Mon, Oct 8, 2012 at 4:13 AM, Robert J. Hijmans <r.hijmans@gmail.com>wrote:
> > 
> > >
> > >
> > > On Sat, Oct 6, 2012 at 3:08 PM, alemante zd <mintibezabih@gmail.com>wrote:
> > >
> > >> Dear Robert, Tom and Caleb,
> > >>
> > >> Thanks for your suggestions. I have now fixed my CRs. But I now face
> > >> further problems further down in my code as my ultimate objective is
> > >> to get a raster layer.
> > >>
> > >> Here is the full code based on Robert's reproducable example:
> > >>
> > >>
> > >>
> > >> x <- 1:10
> > >>
> > >> y <- 1:10
> > >>
> > >>
> > >>
> > >>
> > >> F1<-data.frame(x, y)
> > >>
> > >> library(sp)
> > >>
> > >>
> > >> #SP <- SpatialPoints(F1,proj4string=CRS("+proj=longlat"))
> > >>
> > >> SP <- SpatialPoints(F1,proj4string=CRS("+proj=latlong +datum=potsdam")),
> > >>          CRS("+proj=merc"))
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> library(rgdal)
> > >>
> > >> #spt <- spTransform(SP, CRS("  fill in  the proj4 string you want  ") )
> > >> spt<-spTransform(SpatialPoints(data.frame(x=1:10, y=1:10),
> > >>          proj4string=CRS("+proj=latlong +datum=potsdam")),
> > >>          CRS("+proj=merc"))
> > >>
> > >>
> > >> gridded(spt) = TRUE
> > >>
> > >> library(raster)
> > >> r = raster(spt)
> > >> projection(r) = CRS("+proj=latlong +datum=potsdam")
> > >> plot(r)
> > >>
> > >>
> > >> I now get error messages like coordinate intervals not constant and no
> > >> vallues associated with the raster layer.
> > >>
> > >>
> > >
> > > If you report a problem. Please provide the exact messages you get, not
> > > something "like".
> > > Either way, the situation seems clear. You have points that are not on a
> > > regular grid. To create a raster you could use the raster function
> > > rasterize.
> > >
> > >
> > >
> > >
> > >
> > >> Thanks
> > >> minti
> > >>
> > >> On Sat, Oct 6, 2012 at 6:19 PM, Robert J. Hijmans <r.hijmans@gmail.com>
> > >> wrote:
> > >> >
> > >> > Alemante,
> > >> >
> > >> >> but I keep on getting the message that CRS is wrong.
> > >> >> Coordinate Reference System (CRS) arguments: NA
> > >> >
> > >> > Please show more complete code. Which object are you talking about?
> > >> Some of
> > >> > the object you create have a CRS (SP) others do not.(pts, F1), which is
> > >> > pretty obvious from reading the sequence of events in your code. You
> > >> set the
> > >> > CRS for SP, but then you use F1 again which does not have a CRS and
> > >> > therefore neither do the objects derived from it. You could do after,
> > >> > gridded(F1) = TRUE,  proj4string(F1) <- CRS("+proj=longlat")
> > >> >
> > >> >
> > >> >> Could you please advice me on how I can get it right?
> > >> >
> > >> > I need to guess, but I think you want to transform points, in that
> > >> case, do
> > >> > this:
> > >> >
> > >> > # example data
> > >> > x <- 1:10
> > >> > y <- 1:10
> > >> >
> > >> > F1<-data.frame(x, y)
> > >> > library(sp)
> > >> > SP <- SpatialPoints(F1,proj4string=CRS("+proj=longlat"))
> > >> >
> > >> > library(rgdal)
> > >> > spt <- spTransform(SP, CRS("  fill in  the proj4 string you want  ") )
> > >> >
> > >> >
> > >> > Best, Robert
> > >> >
> > >> >
> > >> > On Sat, Oct 6, 2012 at 5:48 AM, alemante zd <mintibezabih@gmail.com>
> > >> wrote:
> > >> >>
> > >> >> Dear all,
> > >> >>
> > >> >> I would like to sp transform my latitude/longitude vector to by first
> > >> >> telling it what CRS it is. This is what I did.
> > >> >>
> > >> >> F1<-data.frame(x, y)
> > >> >> coordinates(F1)=~x+y
> > >> >> SP<-SpatialPoints(F1,proj4string=CRS("+proj=longlat"))
> > >> >> pts = SpatialPixels(SpatialPoints(F1))
> > >> >> gridded(F1) = TRUE
> > >> >>
> > >> >> but I keep on getting the message that CRS is wrong.
> > >> >> Coordinate Reference System (CRS) arguments: NA
> > >> >>
> > >> >> Could you please advice me on how I can get it right?
> > >> >>
> > >> >> cheers
> > >> >> minti
> > >> >>
> > >> >> _______________________________________________
> > >> >> R-sig-Geo mailing list
> > >> >> R-sig-Geo@r-project.org
> > >> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> > >> >
> > >> >
> > >>
> > >
> > >
> > 
> > 	[[alternative HTML version deleted]]
> > 
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>  		 	   		  
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
 		 	   		  
	[[alternative HTML version deleted]]

