[R-sig-Geo] 4. R from cgi and Xvfb (G. Allegri)

Paul Hiemstra p.hiemstra at geo.uu.nl
Wed Jan 16 15:45:08 CET 2008


Hi Giovanni,

You could consider using 'bitmap()' instead of png(). I seem to remember 
that the first uses postscript devices and does not need X11. Another 
options would be to use the Cairo package, 'Cairo' initializes a new 
graphics device that uses the cairo graphics library for rendering. See 
?bitmap and ?Cairo.

Hope this helps,

Paul

G. Allegri wrote:
> Thanks Marcelo,
> I've tried using the suexec module in apache2 (it permits to change
> userid and groupid on the base of the scripts called), but from
> documentation appears to work only for CGI and SSI, not with
> mod_python.
> So, I change mailing-list, since the problem is almost OT now in this one :-)
>
> Giovanni
>
> 2008/1/16, Marcelo Oliveira <moliveira at geostats.com>:
>   
>> Giovanni,
>>
>> This issue could be related to user permissions.  See if you can get
>> Apache running under a user with display access rights.
>>
>> Good Luck,
>>
>> Marcelo
>>
>> -----Original Message-----
>> From: r-sig-geo-bounces at stat.math.ethz.ch
>> [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of
>> r-sig-geo-request at stat.math.ethz.ch
>> Sent: Wednesday, January 16, 2008 6:00 AM
>> To: r-sig-geo at stat.math.ethz.ch
>> Subject: R-sig-Geo Digest, Vol 53, Issue 14
>>
>> Send R-sig-Geo mailing list submissions to
>>         r-sig-geo at stat.math.ethz.ch
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> or, via email, send a message with subject or body 'help' to
>>         r-sig-geo-request at stat.math.ethz.ch
>>
>> You can reach the person managing the list at
>>         r-sig-geo-owner at stat.math.ethz.ch
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of R-sig-Geo digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Re: Spatially Constrained Clustering (Elias T. Krainski)
>>    2. regression kriging in gstat with skewed distributions (G. Allegri)
>>    3. I Would Dream (vacates at patiencegroup.com)
>>    4. R from cgi and Xvfb (G. Allegri)
>>    5. Re: regression kriging in gstat with skewed       distributions
>>       (Tomislav Hengl)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 15 Jan 2008 10:51:48 -0300 (ART)
>> From: "Elias T. Krainski" <eliaskrainski at yahoo.com.br>
>> Subject: Re: [R-sig-Geo] Spatially Constrained Clustering
>> To: r-sig-geo at stat.math.ethz.ch
>> Message-ID: <569895.79461.qm at web50604.mail.re2.yahoo.com>
>> Content-Type: text/plain; charset=iso-8859-1
>>
>> Hello Carson,
>>
>> See the SKATER software at
>> http://www.est.ufmg.br/leste/skater.htm
>> The SKATER is a Spatial 'K'luster Analisys by Tree
>> Edge Removal. In future, this method also be available
>> in R.
>>
>> Best,
>> Elias.
>>
>> --- Carson Farmer <cfarmer at uvic.ca> escreveu:
>>
>>     
>>> Hello List,
>>>
>>> I am trying to find an R package that will
>>> accommodate spatially
>>> constrained clustering.  While I have been unable to
>>> find a package that
>>> is explicitly designed to do spatially constrained
>>> clustering, I was
>>> wondering if anyone had found a package that would
>>> do constrained
>>> clustering of any kind, and adapted this to spatial
>>> constraints?
>>> I have searched the R site extensively, and googled
>>> all night long, but
>>> to no avail! I HAVE found this post:
>>>
>>>       
>> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/56819.html
>>     
>>> but the replies did not help much.  They lead to
>>> several packages which
>>> perform spatial clustering (such that significant
>>> clusters of say a
>>> disease are located within a study region), however,
>>> what I would like
>>> to do is partition a spatial (grid) dataset based on
>>> multiple variables,
>>> taking into account their spatial locations (i.e.
>>> clustering is based on
>>> the variables, but constrained so that clusters are
>>> spatially
>>> contiguous).  I'm thinking mclust is probably the
>>> best way to go, but
>>> I'm not sure where to start.
>>>
>>> Any suggestions would be greatly appreciated.
>>>
>>> Thanks,
>>>
>>> Carson
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>>       
>> Elias T. Krainski
>>
>>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Tue, 15 Jan 2008 15:27:58 +0100
>> From: "G. Allegri" <giohappy at gmail.com>
>> Subject: [R-sig-Geo] regression kriging in gstat with skewed
>>         distributions
>> To: r-sig-geo at stat.math.ethz.ch
>> Message-ID:
>>         <e12429640801150627q7266a599g77a3df9744edb153 at mail.gmail.com>
>> Content-Type: text/plain; charset=WINDOWS-1252
>>
>> I'm trying to realize e regression kriging with gstat package on my
>> soil samples data. The response variable (ECe measuere) and covariates
>> appear positvely skewed.
>> As Tomislav Hengl suggests in its "framework for RK" [1], a logistic
>> transformation is proposed as a generic way to reduce the skeweness by
>> using the physical limits of the data.
>> Is it really a transformation that can be applied in the generic case
>> of skewed datas? I mean,in my case I have non-normal residuals (from
>> original data regression), and I'm trying to transform the residuals
>> (and not the original values) to do SK on them . Is this approach
>> correct?
>>
>> A related question is how to do normal score transformations (for my
>> residuals) in R and gstat. I know gstat doesn't manage transformations
>> and back-transformations, so it should be done previously in R... but
>> I can't find any package that permit it in a straisghtforward way.
>> I've found something with qqnorm(ppoints(data)) and the approx()
>> function. Is that all?
>>
>> Giovanni
>>
>>
>> [1] "A generic framework for spatial prediction of soil variables
>> based on regressionkriging" Geoderma 122 (1?2), 75?93.
>>
>>
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Tue, 15 Jan 2008 19:25:16 +0100
>> From: <vacates at patiencegroup.com>
>> Subject: [R-sig-Geo] I Would Dream
>> To: r-sig-geo at stat.math.ethz.ch
>> Message-ID: <478CFA8C.7030508 at patiencegroup.com>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Kisses Through E-mail http://86.123.21.76/
>>
>>
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Wed, 16 Jan 2008 11:04:53 +0100
>> From: "G. Allegri" <giohappy at gmail.com>
>> Subject: [R-sig-Geo] R from cgi and Xvfb
>> To: r-sig-geo at stat.math.ethz.ch
>> Message-ID:
>>         <e12429640801160204h3532ddb9t624b4f6ef658c975 at mail.gmail.com>
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> Hi everyone.
>> I'm sorry for the question maybe OT.
>> I'm trying to use R and Python to run some scripts via web interface.
>> I've successfully setup mod_python for Apache and the rpy module.
>> R needs X11 to use png() and jpeg() devices, so I have installed Xvfb
>> (X virtual framebuffer). I works correctly: if I set the DISPLAY
>> variable to point to this X server, rpy can create png files correctly
>> from command-line, but it doesn't work when the python script is run
>> from web browser.
>> I restarted Apache after setting the DISPLAY variable, but the
>> Traceback gives me always the same error, about being not able to open
>> the X11 device?
>>
>> Does anyone have made it work right?
>> How can tell Apache to run R script and forwarding X requests to my
>> Xvfb.
>>
>> Thanks,
>> Giovanni
>>
>>
>>
>> ------------------------------
>>
>> Message: 5
>> Date: Wed, 16 Jan 2008 11:08:28 +0100
>> From: "Tomislav Hengl" <hengl at science.uva.nl>
>> Subject: Re: [R-sig-Geo] regression kriging in gstat with skewed
>>         distributions
>> To: "'G. Allegri'" <giohappy at gmail.com>
>> Cc: r-sig-geo at stat.math.ethz.ch
>> Message-ID: <001401c85827$bdac65a0$3a871291 at pcibed193>
>> Content-Type: text/plain;       charset="windows-1250"
>>
>>
>> Dear Giovanni,
>>
>> Logit transformation can be automatically applied to any variables which
>> has a lower and upper
>> physical limits (e.g. 0-100%). In R, you can transform a variable to
>> logits by e.g.:
>>
>>     
>>> points = read.dbf("points.dbf")
>>> points$SANDt = log((points$SAND/100)/(1-(points$SAND/100)))
>>>       
>> After you interpolate your variable, you can back-transform the values
>> by using:
>>
>>     
>>> SAND.rk = krige(fsand$call$formula, points[sel,], SPC, sand.rvgm)
>>>       
>>> SAND.rk$pred=exp(SAND.rk$var1.pred)/(1+exp(SAND.rk$var1.pred))*100
>>>       
>> The prediction variance can not be back-transformed, but you can use the
>> normalized prediction
>> variance by dividing it with the sampled variance. See also section
>> 4.2.1 of my lecture notes
>> (http://geostat.pedometrics.org/).
>>
>> There are many transformations that can be applied to force a normality
>> of your target variable (see
>> e.g. http://en.wikipedia.org/wiki/Data_transformation_(statistics) ).
>> The most generic
>> transformation is to work with the probability density function values
>> (see e.g.
>> http://dx.doi.org/10.1016/j.jneumeth.2006.11.004 ), this way you do not
>> have to think about how the
>> histogram looks at all. But then the interpretation of the regression
>> plots becomes rather
>> difficult.
>>
>> In any case, you should apply the transformation already to the target
>> variable because also a
>> requirement for linear regression is that the residuals are normally
>> distributed around the
>> regression line.
>>
>>
>> see also:
>> FITTING DISTRIBUTIONS WITH R (by Vito Ricci)
>> http://cran.r-project.org/doc/contrib/Ricci-distributions-en.pdf
>>
>>
>> Tom Hengl
>> http://spatial-analyst.net
>>
>>
>> -----Original Message-----
>> From: r-sig-geo-bounces at stat.math.ethz.ch
>> [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of
>> G. Allegri
>> Sent: dinsdag 15 januari 2008 15:28
>> To: r-sig-geo at stat.math.ethz.ch
>> Subject: [R-sig-Geo] regression kriging in gstat with skewed
>> distributions
>>
>> I'm trying to realize e regression kriging with gstat package on my
>> soil samples data. The response variable (ECe measuere) and covariates
>> appear positvely skewed.
>> As Tomislav Hengl suggests in its "framework for RK" [1], a logistic
>> transformation is proposed as a generic way to reduce the skeweness by
>> using the physical limits of the data.
>> Is it really a transformation that can be applied in the generic case
>> of skewed datas? I mean,in my case I have non-normal residuals (from
>> original data regression), and I'm trying to transform the residuals
>> (and not the original values) to do SK on them . Is this approach
>> correct?
>>
>> A related question is how to do normal score transformations (for my
>> residuals) in R and gstat. I know gstat doesn't manage transformations
>> and back-transformations, so it should be done previously in R... but
>> I can't find any package that permit it in a straisghtforward way.
>> I've found something with qqnorm(ppoints(data)) and the approx()
>> function. Is that all?
>>
>> Giovanni
>>
>>
>> [1] "A generic framework for spatial prediction of soil variables
>> based on regressionkriging" Geoderma 122 (1?2), 75?93.
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
>> End of R-sig-Geo Digest, Vol 53, Issue 14
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>     
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: 	+31302535773
Fax:	+31302531145
http://intamap.geo.uu.nl/~paul




More information about the R-sig-Geo mailing list