Re: [R] metafor package

2014-02-12 Thread Michael Dewey

At 22:11 11/02/2014, Nathan Pace wrote:

Hi,

I have a random effects meta analysis of a proportion (logit 
transformation) using rma.glmm.


I have created a forest plot of the proportion (inverse logic 
transformation) using forest.rma.


I have added the credibility interval.

The forest plot is saved as a pdf.

The dotted line and whiskers of the credibility interval are too faint.

I need help on the argument(s) to widen the credibility interval 
dots and whiskers.


I have looked at the forest.default function, but don't see anything 
obvious to me.


Dear Nathan
I think you need to look at forest.rma. There is a fairly obvious 
section (search for addcred). If worst comes to worst you can always 
hack it and save as nathansforest.rma.




Nathan

--
Nathan Pace, MD, MStat
Department of Anesthesiology
University of Utah
801.581.6393
n.l.p...@utah.edu

[[alternative HTML version deleted]]


Michael Dewey
i...@aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] metafor package

2014-02-12 Thread S Ellison
Like most plotting routines in R, forest has a ... argument that passes names 
arguments through to other routines.
In forest's case, ... passes (at least) to abline, axis and segments, so all 
the lines and axes in the plot are affected by any argument that is valid for 
those.
In your case, specifying lwd=2 in your forest call will give all the lines 
width 2 instead of the default.

S Ellison

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Nathan Pace
 Sent: 11 February 2014 22:11
 To: r-help@R-project.org
 Subject: [R] metafor package
 
 Hi,
 
 I have a random effects meta analysis of a proportion (logit transformation)
 using rma.glmm.
 
 I have created a forest plot of the proportion (inverse logic transformation)
 using forest.rma.
 
 I have added the credibility interval.
 
 The forest plot is saved as a pdf.
 
 The dotted line and whiskers of the credibility interval are too faint.
 
 I need help on the argument(s) to widen the credibility interval dots and
 whiskers.
 
 I have looked at the forest.default function, but don't see anything obvious
 to me.
 
 Nathan
 
 --
 Nathan Pace, MD, MStat
 Department of Anesthesiology
 University of Utah
 801.581.6393
 n.l.p...@utah.edu
 
   [[alternative HTML version deleted]]



***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] r hepl

2014-02-12 Thread PIKAL Petr
Hi

I do not understand what do you want? You have continuous variable, from which 
you made 2 interval variables. If you want that in those variables intervals to 
be named in particular way, make them factor and name them as you wish.

factor(bins_age, labels=letters[1:7])
 [1] e e c f c b g a f d c b g c b f f e e b c f e b d a d a b f g a g a e b f a
[39] c f d d a a g d d d f b
Levels: a b c d e f g

Regards
Petr

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Amaleswara Rao
 Sent: Wednesday, February 12, 2014 7:06 AM
 To: r-help@r-project.org
 Subject: [R] r hepl

 Hi guye's if u don't mind solve this problem please



 Data-
 data.frame(Age=sample(10:75,50),Income=sample(6000:5,50),Profit=sa
 mple(2000:4,50),stringsAsFactors=F)



 uniq1-unique(quantile(Data[[1]],seq(0,1,0.01)))



 Interval_age-findInterval(Data[[1]],uniq1)

 bins_age-cut(Data$Age,seq(9,80,by=10),labels=F)



 uniq2-unique(quantile(Data[[2]],seq(0,1,0.01)))



 Interval_income-findInterval(Data[[2]],uniq2)

 bins_income-cut(Data$Income,seq(6000,54000,by=4000),labels=F)



 uniq3-unique(quantile(Data[[3]],seq(0,1,0.01)))



 Interval_profit-findInterval(Data[[3]],uniq3)

 bins_profit-cut(Data$Profit,seq(1999,43000,by=5000),labels=F)



 l-cbind(Data,Interval_age)

 m-cbind(Data,Interval_income)

 n-cbind(Data,Interval_profit)

 ll-l[,c(-2,-3)]

 mm-m[,c(-1,-3)]

 nn-n[,c(-1,-2)]

 AG-cbind(ll,bins_age)

 IN-cbind(mm,bins_income)

 PF-cbind(nn,bins_profit)



 Final-cbind(AG,IN,PF)



 Final result in this program coming intervals and bin's corresponding
 variables But I Want Interval Columns Arranging = or = or ,  for
 exp:-0=10 10=20 20=30 this type


   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by 

Re: [R] metafor package

2014-02-12 Thread Viechtbauer Wolfgang (STAT)
Good advice already from Michael and S Ellison.

I must apologize for the 'hack-job of a function' called forest() in metafor. I 
realized a while ago that people would prefer more fine-grained control over 
the various elements of the plot (this has come up a few times before). I think 
Paul Murrell described the issue best in his R Journal article:

http://journal.r-project.org/archive/2012-2/RJournal_2012-2_Murrell.pdf

But it is what it is at this point.

I noticed the problem with the dotted line of the credibility interval myself a 
while back. In an updated version of the metafor package (to be released at 
some point in the near future), there will at least be the possibility to 
control the color of that line. Maybe also the line type (a dotted line is 
indeed often too faint).

You can try changing efac=2 (or something larger than 1) to at least make the 
whiskers longer.

Best,
Wolfgang

--   
Wolfgang Viechtbauer, Ph.D., Statistician   
Department of Psychiatry and Psychology   
School for Mental Health and Neuroscience   
Faculty of Health, Medicine, and Life Sciences   
Maastricht University, P.O. Box 616 (VIJV1)   
6200 MD Maastricht, The Netherlands   
+31 (43) 388-4170 | http://www.wvbauer.com   


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Michael Dewey
 Sent: Wednesday, February 12, 2014 12:50
 To: Nathan Pace; r-help@R-project.org
 Subject: Re: [R] metafor package
 
 At 22:11 11/02/2014, Nathan Pace wrote:
 Hi,
 
 I have a random effects meta analysis of a proportion (logit
 transformation) using rma.glmm.
 
 I have created a forest plot of the proportion (inverse logic
 transformation) using forest.rma.
 
 I have added the credibility interval.
 
 The forest plot is saved as a pdf.
 
 The dotted line and whiskers of the credibility interval are too faint.
 
 I need help on the argument(s) to widen the credibility interval
 dots and whiskers.
 
 I have looked at the forest.default function, but don't see anything
 obvious to me.
 
 Dear Nathan
 I think you need to look at forest.rma. There is a fairly obvious
 section (search for addcred). If worst comes to worst you can always
 hack it and save as nathansforest.rma.
 
 Nathan
 
 --
 Nathan Pace, MD, MStat
 Department of Anesthesiology
 University of Utah
 801.581.6393
 n.l.p...@utah.edu
 
  [[alternative HTML version deleted]]
 
 Michael Dewey
 i...@aghmed.fsnet.co.uk
 http://www.aghmed.fsnet.co.uk/home.html

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] creating a figure with different shades in R?

2014-02-12 Thread Wei Ding

Hello, everyone, I have following csv-file(simplified) as instance:


0.29,2,50
0.32,3,10
0.28,4,71
0.27,1,62
0.53,1,33
0.83,5,100

with the first column for x-axis (proportion shared), the second for  
y-axis (number of shared segments), the shades for 'number of pairs'.



I wonder how to realize that the number of pairs are denoted by  
different shades as shown in the attachment ? So far, I can plot a  
histogram by these codes, but have no idea how to correctly add  
information of shades to it.


df-read.csv(file=c-all-prop-test.csv,head=F,sep=,)
require(ggplot2)
qplot(x=df[,1],weight=df[,2],geom=histogram,xlab=proportion  
shared,ylab=number of shared segments,colour = I(darkgreen), fill  
= I(blue))


It seems that d + stat_bin2d() may help. Or maybe heatmap?

Could you give me some suggestions? Best regards
attachment: R.png__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] metafor package

2014-02-12 Thread S Ellison


 -Original Message-
 I must apologize for the 'hack-job of a function' called forest() in metafor. 
Well, certainly no apology needed there!

 I realized a while ago that people would prefer more fine-grained control over
 the various elements of the plot (this has come up a few times before). 
Ploting functions should ideally never have hard-coded defaults. 
Having said that, it's an absolute pain to do anything else.

I've tinkered a fair bit with the problem in my own package, which for at least 
some plots tries to match graphical arguments in ... with those applicable to 
specific plotting functions so as to avoid the frequent 'duplicate parameters' 
or 'xxx is not a recognised parameter in some_plotting_function'

Another useful approach I've toyed with is to allow a list like 
this.special.line.pars=list(lwd=2, col=3, lty=2) to be provided, and then use 
do.call with functions like line, axis etc. That avoids a plot function full of 
things like like this.special.line.lwd, like this.special.line.col, like 
this.special.line.lty 

But there's no really simple answer; at some point we have to give up and point 
out that if saomeone really wants that much control, they can always hack the 
code!

S Ellison


***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] metafor package

2014-02-12 Thread William Shadish

If your command looks something like this:

 forest(x,xlim=c(-6,7),cex=.8,order=prec, xlab=Effect Size, 
alim=c(-.5,4),mlab=RE Average for All Studies)


In  alim=c(-.5,4), increase the numbers.  Make them higher than your 
highest confidence interval upper bound and lower than your lowest 
confidence interval lower bound. The bars may run into the text, but 
that may be fixed by stretching the output window in R.


Will Shadish
**

Date: Tue, 11 Feb 2014 22:11:20 +
From: Nathan Pace n.l.p...@utah.edu
To: r-help@R-project.org r-help@r-project.org
Subject: [R] metafor package
Message-ID: cf1fef68.2490a%n.l.p...@utah.edu
Content-Type: text/plain

Hi,

I have a random effects meta analysis of a proportion (logit 
transformation) using rma.glmm.


I have created a forest plot of the proportion (inverse logic 
transformation) using forest.rma.


I have added the credibility interval.

The forest plot is saved as a pdf.

The dotted line and whiskers of the credibility interval are too faint.

I need help on the argument(s) to widen the credibility interval dots 
and whiskers.


I have looked at the forest.default function, but don?t see anything 
obvious to me.


Nathan

--
Nathan Pace, MD, MStat
Department of Anesthesiology
University of Utah
801.581.6393
n.l.p...@utah.edu
--
William R. Shadish
Distinguished Professor
Founding Faculty

Mailing Address:
William R. Shadish
University of California
School of Social Sciences, Humanities and Arts
5200 North Lake Rd
Merced CA  95343

Physical/Delivery Address:
University of California Merced
ATTN: William Shadish
School of Social Sciences, Humanities and Arts
Facilities Services Building A
5200 North Lake Rd.
Merced, CA 95343

209-228-4372 voice
209-228-4007 fax (communal fax: be sure to include cover sheet)
wshad...@ucmerced.edu
http://faculty.ucmerced.edu/wshadish/index.htm
http://psychology.ucmerced.edu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Actual code for LDA

2014-02-12 Thread ben1983
Hi All,
I've been trying to write my own code for LDA (linear discrim) so I
can modify it to be weighted LDA since some of my groups are outliers. 

However, the code I write for standard LDA gives me slightly different
results to those from R (slightly different LDAs.and not just scalar
differences. 

Does R simply invert the pooled within groups scatter matrix e.g. solve(Sw)
and multiply it by the between groups scatter Sb, then take the eigen
vectors?

This is the approach that I use, yet get slightly different
results..does R by default use a slightly more robust inverse or
estimate of Sw?? 

I've looked at the source code, and I find it very hard to follow. 

If anyone has any ideas that would be great!!
Thanks,
Ben



--
View this message in context: 
http://r.789695.n4.nabble.com/Actual-code-for-LDA-tp4685194.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] plot with 3 axes and different shades

2014-02-12 Thread Wei Ding


Hello, everyone, I have following csv-file(simplified) as instance:

Greetings,

I have following csv-file:
0.29,2,50
0.32,3,10
0.28,4,71
0.27,1,62
0.53,1,33
0.83,5,100

with the first column for x-axis (proportion shared), the second for y-axis
(number of shared segments), the shades for 'number of pairs'.

In the attachment, you can find the figure.

I wonder how to realize that the number of pairs are denoted by different
shades as shown in the attachment ? So far, I can plot a histogram by these
codes, but have no idea how to correctly add information of shades to it.

df-read.csv(file=c-all-prop-test.csv,head=F,sep=,)
require(ggplot2)
qplot(x=df[,1],weight=df[,2],geom=histogram,xlab=proportion
shared,ylab=number of shared segments,colour = I(darkgreen), fill =
I(blue))

It seems that d + stat_bin2d() may help. Or maybe heatmap?

Could you give me some suggestions? Best regards


attachment: R.png__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] SDM using BIOMOD2 error message

2014-02-12 Thread Matthew Bayly


 I think it is a problem with your directory setting  changing your 
 directory. 



When you make your enviro stack you set your directory to: 
setwd(V:/BIOCLIM) 

Then when you import your species coordinates and presence/absence status 
you change your directory to:
setwd(C:/Users/Lindsie/Documents/R) 

Then you try to run your model  R says  'pred' is missing ~ because it 
cannot find your raster stacks. 

CHANGE YOUR  R DIRECTORY BACK TO WHERE YOU STORED YOUR ENVIRONMENTAL LAYERS 
PRIOR TO RUNNING THE MODEL!
myBiomodModelOut - BIOMOD_Modeling(myBiomodDa...
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Biomod model access

2014-02-12 Thread Matthew Bayly
I have been struggling with this same problem. I always have to re-run. 
PLEASE HELP!!

I have however figured out the whole data-format issue  am now able to 
save grid files for use in other GIS programs after they are re-exported.

On Thursday, August 15, 2013 1:32:31 AM UTC-7, Jenny Williams wrote:

 I am still trying to get my head around biomod2. I have run through the 
 tutorial a few times, which works really well in a linear format. 

 But, I want to see the models and assess them at every part of the 
 process. So, I need to: 

 1: be able to re-access all the files from /.BIOMOD_DATA/ once R is closed 
 and all the file links are lost. 
 e.g myBiomodModelOut 

 2: call the summary parameters for the models e.g GLM, I can see the files 
 but not sure how to access them. 
 e.g 
 myGLMs - BIOMOD_LoadModels(myBiomodModelOut, models='GLM') 
 #just produces a list 
 summary(myGLMs[1]) 
Length Class  Mode 
1 character character 
 #summary(GLM) doesn't work, but is the output that I am looking to find. 

 3. find the split datasets used for each of the iterations BIOMOD_Modeling 
 options; NbRunEval for DataSplit 

 Any help or pointers in the right direction would be greatly appreciated. 
 FYI the vignette does not seem to work: 
 http://127.0.0.1:15505/library/biomod2/doc/index.html 


 ** 
 Jenny Williams 
 Spatial Information Scientist, GIS Unit 
 Herbarium, Library, Art  Archives Directorate 
 Royal Botanic Gardens, Kew 
 Richmond, TW9 3AB, UK 

 Tel: +44 (0)208 332 5277 
 email: jenny.w...@kew.org 
 javascript:mailto:jenny.willi...@kew.orgjavascript: 

 ** 

 Film: The Forgotten Home of Coffee - Beyond the Gardens
 http://www.youtube.com/watch?v=-uDtytKMKpAsns=tw 
 Stories: Coffee Expedition - Ethiopia
 http://storify.com/KewGIS/coffee-expedition-ethiopia 
  Kew in Harapan Rainforest Sumatra
 http://storify.com/KewGIS/kew-in-harapan-rainforest 
 Articles: Seeing the wood for the trees
 http://www.kew.org/ucm/groups/public/documents/document/kppcont_060602.pdf 

 How Kew's GIS team and South East Asia botanists are working to help 
 conserve and restore a rainforest in Sumatra. Download a pdf of this 
 article here.
 http://www.kew.org/ucm/groups/public/documents/document/kppcont_060602.pdf 



  
 The Royal Botanic Gardens, Kew is a non-departmental public body with 
 exempt charitable status, whose principal place of business is at Royal 
 Botanic Gardens, Kew, Richmond, Surrey TW9 3AB, United Kingdom. 

 The information contained in this email and any attachments is intended 
 solely for the addressee(s) and may contain confidential or legally 
 privileged information. If you have received this message in error, please 
 return it immediately and permanently delete it. Do not use, copy or 
 disclose the information contained in this email or in any attachment. 

 Any views expressed in this email do not necessarily reflect the opinions 
 of RBG Kew. 

 Any files attached to this email have been inspected with virus detection 
 software by RBG Kew before transmission, however you should carry out your 
 own virus checks before opening any attachments. RBG Kew accepts no 
 liability for any loss or damage which may be caused by software viruses. 

 [[alternative HTML version deleted]] 

 __ 
 r-h...@r-project.org javascript: mailing list 
 https://stat.ethz.ch/mailman/listinfo/r-help 
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html 
 and provide commented, minimal, self-contained, reproducible code. 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] mean help?

2014-02-12 Thread frankreynolds
Hey everyone, I need help getting the mean, standard deviation, median, etc. 
I'm just not sure how to write those codes in r and if someone could also
help me out with the table command that would be great too. same issue just
not really sure how to write it out. thanks for your time everyone!



--
View this message in context: 
http://r.789695.n4.nabble.com/mean-help-tp4685212.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] simple linear regression

2014-02-12 Thread frankreynolds
okay so how do you run a simple linear regression, obtain the summary of
that, and then put it in an object?



--
View this message in context: 
http://r.789695.n4.nabble.com/simple-linear-regression-tp4685213.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] simple linear regression

2014-02-12 Thread Sarah Goslee
On Wed, Feb 12, 2014 at 2:22 PM, frankreynolds mz1...@txstate.edu wrote:
 okay so how do you run a simple linear regression, obtain the summary of
 that, and then put it in an object?

You start by reading the Introduction to R that came with your
installation, and then using some common sense and basic statistical
knowledge.

 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

This bit is also a good idea.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plot with 3 axes and different shades

2014-02-12 Thread Jim Lemon

On 02/13/2014 02:49 AM, Wei Ding wrote:


Hello, everyone, I have following csv-file(simplified) as instance:

Greetings,

I have following csv-file:
0.29,2,50
0.32,3,10
0.28,4,71
0.27,1,62
0.53,1,33
0.83,5,100

with the first column for x-axis (proportion shared), the second for y-axis
(number of shared segments), the shades for 'number of pairs'.

In the attachment, you can find the figure.

I wonder how to realize that the number of pairs are denoted by different
shades as shown in the attachment ? So far, I can plot a histogram by these
codes, but have no idea how to correctly add information of shades to it.

df-read.csv(file=c-all-prop-test.csv,head=F,sep=,)
require(ggplot2)
qplot(x=df[,1],weight=df[,2],geom=histogram,xlab=proportion
shared,ylab=number of shared segments,colour = I(darkgreen), fill =
I(blue))

It seems that d + stat_bin2d() may help. Or maybe heatmap?

Could you give me some suggestions? Best regards



Hi Wei,
You can do something like this with color2D.matplot (plotrix).

x-matrix(sample(1:100,100),nrow=10)
x[sample(1:10,20,TRUE),sample(1:10,20,TRUE)]-NA
library(plotrix)
color2D.matplot(x,
 cellcolors=color.scale(x,extremes=c(lightgray,blue)))

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] mean help?

2014-02-12 Thread Don McKenzie
Frank — you need to read the R tutorial that came with your installation. If 
you don’t have the answers to your VERY BASIC questions after that, let us know.

On Feb 12, 2014, at 10:20 AM, frankreynolds mz1...@txstate.edu wrote:

 Hey everyone, I need help getting the mean, standard deviation, median, etc. 
 I'm just not sure how to write those codes in r and if someone could also
 help me out with the table command that would be great too. same issue just
 not really sure how to write it out. thanks for your time everyone!
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/mean-help-tp4685212.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

Don McKenzie
Research Ecologist
Pacific Wildland Fire Sciences Lab
US Forest Service

Affiliate Professor 
School of Environmental and Forest Sciences 
University of Washington 
 
d...@uw.edu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] mean help?

2014-02-12 Thread Rui Barradas

Hello,

At an R prompt type

?mean
?sd
?median

And read the file R-intro.pdf that comes with your installation of R.

Hope this helps,

Rui Barradas

Em 12-02-2014 18:20, frankreynolds escreveu:

Hey everyone, I need help getting the mean, standard deviation, median, etc.
I'm just not sure how to write those codes in r and if someone could also
help me out with the table command that would be great too. same issue just
not really sure how to write it out. thanks for your time everyone!



--
View this message in context: 
http://r.789695.n4.nabble.com/mean-help-tp4685212.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Biomod model access

2014-02-12 Thread Sarah Goslee
Accessing BIOMOD2 model output is possible, but a bit convoluted.
Here's a whole chunk of code that creates a reproducible example; the
most important part is at the end.

I hope this is enough to let you get going.

Sarah

### First use a slightly modified version of the example from the help file
 # species occurrences
 DataSpecies -
read.csv(system.file(external/species/mammals_table.csv,
package=biomod2))
 # the name of studied species
 myRespName - 'GuloGulo'

 # the presence/absences data for our species
 myResp - as.numeric(DataSpecies[,myRespName])

 # the XY coordinates of species data
 myRespXY - DataSpecies[,c(X_WGS84,Y_WGS84)]


 # Environmental variables extracted from BIOCLIM (bio_3, bio_4,
bio_7, bio_11  bio_12)
 myExpl = stack( system.file( external/bioclim/current/bio3.grd,
package=biomod2),
 system.file( external/bioclim/current/bio4.grd,
package=biomod2),
 system.file( external/bioclim/current/bio7.grd,
package=biomod2),
 system.file(
external/bioclim/current/bio11.grd, package=biomod2),
 system.file(
external/bioclim/current/bio12.grd, package=biomod2))

 # 1. Formatting Data
 myBiomodData - BIOMOD_FormatingData(resp.var = myResp,
  expl.var = myExpl,
  resp.xy = myRespXY,
  resp.name = myRespName)

 # 2. Defining Models Options using default options.
 myBiomodOption - BIOMOD_ModelingOptions()

 # 3. Doing Modelisation

 myBiomodModelOut - BIOMOD_Modeling( myBiomodData,
models = c('SRE','RF', 'GAM'),
models.options = myBiomodOption,
NbRunEval=2,
DataSplit=80,
VarImport=0,
models.eval.meth = c('ROC'),
do.full.models=FALSE,
modeling.id=test)

### assume we quit without saving the workspace, since everything is
on disk anyway
### q(no) ## commented out for your protection

### here's the access code

### come back later
### everything is stored in GuloGulo, and all thing are R objects
R
 library(biomod2)
# R objects can be imported with load()
R load(GuloGulo/models/test/GuloGulo_AllData_RUN1_GAM)
R ls()
[1] GuloGulo_AllData_RUN1_GAM
R GuloGulo_AllData_RUN1_GAM
# various outputs deleted

## here's how to get the GAM itself
R get_formal_model(GuloGulo_AllData_RUN1_GAM)

Family: binomial
Link function: logit

Formula:
GuloGulo ~ 1 + s(bio3, k = -1) + s(bio4, k = -1) + s(bio7, k = -1) +
s(bio11, k = -1) + s(bio12, k = -1)
environment: 0x9a5e918

Estimated degrees of freedom:
3.04 6.51 6.07 5.78 5.08  total = 27.47

UBRE score: -0.6562

## and it can be summarized
R summary(get_formal_model(GuloGulo_AllData_RUN1_GAM))

Family: binomial
Link function: logit

Formula:
GuloGulo ~ 1 + s(bio3, k = -1) + s(bio4, k = -1) + s(bio7, k = -1) +
s(bio11, k = -1) + s(bio12, k = -1)
environment: 0x9a5e918

Parametric coefficients:
Estimate Std. Error z value Pr(|z|)
(Intercept)   -11.14   4.23   -2.63   0.0085

Approximate significance of smooth terms:
  edf Ref.df Chi.sq p-value
s(bio3)  3.04   3.74   15.9  0.0027
s(bio4)  6.51   6.98  151.1  2e-16
s(bio7)  6.07   6.77  107.6  2e-16
s(bio11) 5.78   6.46  130.5  2e-16
s(bio12) 5.08   6.06   59.2 7.3e-11

R-sq.(adj) =  0.738   Deviance explained = 72.2%
UBRE score = -0.65625  Scale est. = 1 n = 2488

On Wed, Feb 12, 2014 at 12:22 PM, Matthew Bayly matt.j.ba...@gmail.com wrote:
 I have been struggling with this same problem. I always have to re-run.
 PLEASE HELP!!

 I have however figured out the whole data-format issue  am now able to
 save grid files for use in other GIS programs after they are re-exported.

 On Thursday, August 15, 2013 1:32:31 AM UTC-7, Jenny Williams wrote:

 I am still trying to get my head around biomod2. I have run through the
 tutorial a few times, which works really well in a linear format.

 But, I want to see the models and assess them at every part of the
 process. So, I need to:

 1: be able to re-access all the files from /.BIOMOD_DATA/ once R is closed
 and all the file links are lost.
 e.g myBiomodModelOut

 2: call the summary parameters for the models e.g GLM, I can see the files
 but not sure how to access them.
 e.g
 myGLMs - BIOMOD_LoadModels(myBiomodModelOut, models='GLM')
 #just produces a list
 summary(myGLMs[1])
Length Class  Mode
1 character character
 #summary(GLM) doesn't work, but is the output that I am looking to find.

 3. find the split datasets used for each of the iterations BIOMOD_Modeling
 options; NbRunEval for DataSplit

 Any help or pointers 

Re: [R] Urgent Inquiry

2014-02-12 Thread Jeff Newmiller
You might consider reading 
http://cran.r-project.org/doc/contrib/Hiebeler-matlabR.pdf. I strongly 
recommend reading the Introduction to R document that comes with the R software.

As to where to ask questions, this mailing list is fine as long as you follow 
the Posting Guide recommendations (see the bottom of this email) and stay on 
topic (Matlab is off topic, R is on-topic). Note that most attachments are 
stripped by the mailing list.. you are expected to communicate in plain text.

Some people prefer the website experience... you might try 
http://stackoverflow.com/questions/tagged/r for that.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 12, 2014 1:09:33 PM PST, Woo Young Kang eric...@hotmail.com wrote:


Hi, my name is Woo Young Kang and I am a current user of R-programming.
 
I am looking for an R-programming online questioning community and was
having difficulty finding it.
 
I wonder what webaddress I can use to ask question regarding the
R-programming.
 
Before that, I do have one critical question that I would like to ask
regarding the R-programming.
 
I am trying to make about 10 lines of MATLAB code into the equivalent
R-programming code.
 
The backgroud for this is to produce initial parameters for the
Cox-Ross-Ingersoll short rate model using the
 
OLS method.

I found out the MATLAB code for OLS initial parameter estimation for
the CIR interest rate model from 
 
one of the literature but have a bit difficulty in understanding 100%
of the code since I was trying to convert 
 
this code in terms of R-programming code.
 
The code itself is as follows:
 
% Initial parameters using OLS
Nobs = length(Model.Data);
x = Model.Data(1:end-1);
dx = diff(Model.Data);   
dx = dx./x.^0.5;
regressors = [Model.TimeStep./x.^0.5, Model.TimeStep*x.^0.5];
drift = regressors\dx;
res = regressors*drift - dx;
alpha = -drift(2);
mu = -drift(1)/drift(2);
sigma = sqrt(var(res, 1)/Model.TimeStep);
InitialParams = [alpha mu sigma];
if ~isfield(Model, 'Disp'), Model.Disp = 'y'; end;
if strcmp(Model.Disp, 'y')
fprintf('\n initial alpha = %+3.6f\n initial mu= %+3.6f\n initial
sigma = %+3.6f\n', alpha, mu, sigma);
end

% where
%Model.Data   = Time series of interest rates observations
% Model.TimeStep   = Delta t; recommended: 1/250 for daily data, 1/12
for monthly data  

I am attaching also the source of this code to this email as well which
is one of the literature that I found recently.
 
The relavent source in the literature for your reference is in the
section 2.2. initial estimates.
 
Since my main purpose of this is to convert this into the R-programming
code,
 
it would be great if I could know the equivalent R-programming code for
this MATLAB code,
 
and also the online R-programming questioning website address as well.
 
 
Thank you very much!
 
 
Sincerely,
Woo Young Kang
 

 



 



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Urgent Inquiry

2014-02-12 Thread Kevin Wright
You may find http://stackoverflow.com/ to be a useful website to ask R
questions.

Kevin



On Wed, Feb 12, 2014 at 3:09 PM, Woo Young Kang eric...@hotmail.com wrote:



 Hi, my name is Woo Young Kang and I am a current user of R-programming.

 I am looking for an R-programming online questioning community and was
 having difficulty finding it.

 I wonder what webaddress I can use to ask question regarding the
 R-programming.

 Before that, I do have one critical question that I would like to ask
 regarding the R-programming.

 I am trying to make about 10 lines of MATLAB code into the equivalent
 R-programming code.

 The backgroud for this is to produce initial parameters for the
 Cox-Ross-Ingersoll short rate model using the

 OLS method.

 I found out the MATLAB code for OLS initial parameter estimation for the
 CIR interest rate model from

 one of the literature but have a bit difficulty in understanding 100% of
 the code since I was trying to convert

 this code in terms of R-programming code.

 The code itself is as follows:

 % Initial parameters using OLS
 Nobs = length(Model.Data);
 x = Model.Data(1:end-1);
 dx = diff(Model.Data);
 dx = dx./x.^0.5;
 regressors = [Model.TimeStep./x.^0.5, Model.TimeStep*x.^0.5];
 drift = regressors\dx;
 res = regressors*drift - dx;
 alpha = -drift(2);
 mu = -drift(1)/drift(2);
 sigma = sqrt(var(res, 1)/Model.TimeStep);
 InitialParams = [alpha mu sigma];
 if ~isfield(Model, 'Disp'), Model.Disp = 'y'; end;
 if strcmp(Model.Disp, 'y')
 fprintf('\n initial alpha = %+3.6f\n initial mu= %+3.6f\n
 initial sigma = %+3.6f\n', alpha, mu, sigma);
 end

 % where
 %Model.Data   = Time series of interest rates observations
 % Model.TimeStep   = Delta t; recommended: 1/250 for daily data, 1/12 for
 monthly data

 I am attaching also the source of this code to this email as well which is
 one of the literature that I found recently.

 The relavent source in the literature for your reference is in the section
 2.2. initial estimates.

 Since my main purpose of this is to convert this into the R-programming
 code,

 it would be great if I could know the equivalent R-programming code for
 this MATLAB code,

 and also the online R-programming questioning website address as well.


 Thank you very much!


 Sincerely,
 Woo Young Kang







 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Kevin Wright

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regression of complex-valued functions

2014-02-12 Thread Andrea Graziani
Dear Rolf,

Thank you for your suggestion.
Based on your remarks I solved my problem using nlm().

Actually there are two quite straightforward ways to split the complex-valued 
problem into two “linked” real-valued problems.

### 1. Real part and Imaginary part

# Experimental data
E1_data - Re(E)
E2_data - Im(E)

# Model function (same of my previous post only different notations)
E_2S2P1D - function(f,logaT,logEg,logEe,k,h,delta,logbeta,logtau) 
  10^logEe+(10^logEg-10^logEe)*(
1+delta*(2i*pi*10^(logtau)*f*10^logaT)^-k +
  (2i*pi*10^(logtau)*f*10^logaT)^-h +
  (2i*pi*10^(logtau)*f*10^logaT*10^(logbeta))^-1
  )^-1 

# Distance function
dist - function(p)
sum( ( (E1_data - 
Re(E_2S2P1D(f_data,c(rep(p[1],5),rep(p[2],5),rep(p[3],5),rep(0,5),rep(p[4],5)), 
p[5],p[6],p[7],p[8],p[9],p[10],p[11])) ) / 
E1_data )^2 ) + 
sum( ( (E2_data - 
Im(E_2S2P1D(f_data,c(rep(p[1],5),rep(p[2],5),rep(p[3],5),rep(0,5),rep(p[4],5)), 
p[5],p[6],p[7],p[8],p[9],p[10],p[11])) ) / 
E2_data )^2 )

# fitting
fit - nlm(dist, p = 
c(-3.76,-2.63,-1.39,1.68,log10(27000),log10(200),0.16,0.47,1.97,2.2,0.02))


### 2. Modulus and argument

# Experimental data
Emod_data - Mod(E)
Earg_data - Arg(E)

# Model function: same as above

# Distance function
dist - function(p)
sum(((Emod_data - 
log10(Mod(E_2S2P1D(f_data,c(rep(p[1],5),rep(p[2],5),rep(p[3],5),rep(0,5),rep(p[4],5)),

p[5],p[6],p[7],p[8],p[9],p[10],p[11])) ) / Emod_data )^2 ) + 
sum( ( (Earg_data - 
Arg(E_2S2P1D(f_data,c(rep(p[1],5),rep(p[2],5),rep(p[3],5),rep(0,5),rep(p[4],5)),
 p[5],p[6],p[7],p[8],p[9],p[10],p[11])) ) / 
Earg_data )^2 )

# fitting: same as above

Using the same starting values, the two approaches bring to slightly different 
solutions:

### 1. Real part and Imaginary part
 fit$estimate
 [1] -3.8519181 -2.7342861 -1.4823740  1.7173982  4.4529298  1.4383334  
0.1564904  0.4856774  2.2789567  3.9011926  0.1227758

### 2. Modulus and argument
 fit$estimate
 [1] -3.8674680 -2.7250640 -1.4574350  1.6447868  4.4355748  1.2400092  
0.1574215  0.4731295  2.0624878  3.7526197  0.1161640

Do you believe this is due only to “numerical reasons linked to how the nls() 
function works?

Anyway...Thanks again!
Andrea




Il giorno 11/feb/2014, alle ore 09:42, Rolf Turner r.tur...@auckland.ac.nz ha 
scritto:

 
 
 I have not the mental energy to go through your somewhat complicated example, 
 but I suspect that your problem is simply the following:  The function nls() 
 is trying to minimize a sum of squares, and that does not make sense in the 
 context of complex observations.  That is, nls() is trying to minimize a sum 
 of terms of the form
 
   (f(x_i,theta) - z_i)^2
 
 where f(x_i,theta) and z_i are complex quantities (and theta is the vector of 
 parameters with respect to which minimization is trying to be done.  But as 
 I said, this makes no sense.  Not that
 (f(x_i,theta) - z_i)^2 is a complex quantity and *not* a positive real 
 quantity.
 
 You need to minimize a sum of terms of the form
 
   |f(x_i,theta) - z_i|^2
 
 where |w|^2 equal to w times the complex conjugate of w.  You get this in R 
 via the Mod() function, i.e. |w|^2 is (Mod(w))^2.
 
 Thus it seems to me that nls() cannot handle what you want handled.  You need 
 to code up the function to be minimized yourself, using Mod() and then use 
 optim() or nlm() to minimize it that function with respect to theta.
 
 HTH
 
 cheers,
 
 Rolf Turner
 
 
 On 10/02/14 11:45, Andrea Graziani wrote:
 Hi everyone,
 
 I previously posted this question but my message was not well written and 
 did not contain any code so I will try to do a better job this time.
 
 The goal is to perform a non-linear regression on complex-valued data.
 I will first give a short description of the data and then describe the 
 complex-valued non-linear function.
 
 ***The Data
 Obtained from mechanical tests performed at 5 loading frequencies 0.1, 0.25, 
 1, 0.4 and 12 Hz, and at 5 temeperatures.
 The independent variable used in the regression is:
 f_data - rep(c(0.1,0.25,1,4,12),5)
 
 The measured values of the response variable are:
 E - c(289.7411+ 225.0708i , 386.4417+ 303.5021i ,  671.5132+ 521.1253i , 
 1210.8638+ 846.6253i , 1860.9623+1155.4139i ,
 862.8984+ 636.2637i , 1159.0436+ 814.5609i , 1919.0369+1186.5679i , 
 3060.7207+1573.6088i  , 4318.1781+1868.4761i  ,
 2760.7782+1418.5450i , 3306.3013+1612.2712i , 4746.6958+1923.8662i , 
 6468.5769+2148.9502i , 8072.2642+2198.5344i  ,
 6757.7680+2061.3110i , 7591.9787+2123.9168i , 9522.9471+2261.8489i , 
 11255.0952+2166.6411i , 12601.3970+2120.7178i ,
 11913.6543+2016.0828i , 12906.8294+2030.0610i , 14343.7693+1893.4877i , 
 15942.7703+1788.0910i , 16943.2261+1665.9847i)
 
 To visualize the data:
 plot(f_data,Re(E),log=xy)
 plot(f_data,Im(E),log=xy)
 plot(E)
 
 ***Non-linear regression function:
 Obtained from an analytical model
 
 

Re: [R] Regression of complex-valued functions

2014-02-12 Thread Andrea Graziani
Hi Frede,

Thank you for your accurate answer!

If I understand well, your way to use nls() solves the problem using too many 
physical parameters.
I solved the problem following the other way that you and Rolf Turner suggested 
(i.e. splitting the complex-valued problem into two real-valued problems and 
using nlm() ).
If you are interested in more details, please see my answer to Rolf’s mail.

  Why are loga40, loga30, loga20, 0 (zero value), and loga0 not independent 
 variables that you control? If so you don't want to estimate those.
 
 If the logaT parameters are not under your control do you still really want 
 to estimate the same set of values of the parameters of the model for each 
 set of your data? And not separate estimates for each curve?

You noticed a key point of the mechanical problem!
However I’m looking for a “single curve”, so-called “master curve”, to fit all 
experimental data!

 
 However (putting my head under my shoulder) you can do something like this 
 (Having just noticed Rolf Turner's answer you should absolutely explore that 
 solutions. That would probably the best way to go).
;)

Thanks again!
Andrea



 
 ## this seems to run
 fit.re - nls(Re(E) ~ 
 Re(E_2S2P1D(f,c(rep(loga40,5),rep(loga30,5),rep(loga20,5),rep(0,5),rep(loga0,5)),
  Eg,Ee,k,h,delta,logbeta,logtau)),
  data = myE, na.action = na.exclude,  
  start=list(loga40=-3.76,loga30=-2.63,loga20=-1.39,loga0=1.68,
  
 Eg=27000,Ee=200,k=0.16,h=0.47,delta=1.97,logbeta=2.2,logtau=-0.02) )
 
 fit.re
 
 ## plot fit overlayed observations
 png(fitted-Re.png)
 plot(f_data, Re(E), type = p, col = mycol)# log=xy)
 lines(f_data, fitted(fit.re), col = grey80) #, log = xy
 dev.off()
 
 ## this gives an error
 ## probably due to the 5 curves do not share parameters. See 3rd panel in 
 attached plot-raw-data.png
 fit.im - nls(Im(E) ~ 
 Im(E_2S2P1D(f,c(rep(loga40,5),rep(loga30,5),rep(loga20,5),rep(0,5),rep(loga0,5)),
  Eg,Ee,k,h,delta,logbeta,logtau)),
  data = myE, na.action = na.exclude,
  start=list(loga40=-3.76,loga30=-2.63,loga20=-1.39,loga0=1.68,
   
 Eg=27000,Ee=200,k=0.16,h=0.47,delta=1.97,logbeta=2.2,logtau=-0.02) )
 
 
 ## Now try abs()
 ## which works and gives allmost same estimates as for fit.re
 fit.abs - nls(abs(E) ~ 
 abs(E_2S2P1D(f,c(rep(loga40,5),rep(loga30,5),rep(loga20,5),rep(0,5),rep(loga0,5)),
  Eg,Ee,k,h,delta,logbeta,logtau)),
  data = myE, na.action = na.exclude,
  start=list(loga40=-3.76,loga30=-2.63,loga20=-1.39,loga0=1.68,
  
 Eg=27000,Ee=200,k=0.16,h=0.47,delta=1.97,logbeta=2.2,logtau=-0.02))
 
 fit.abs
 
 png(fitted-abs.png)
 plot(f_data, abs(E), type = p, col = mycol)# log=xy)
 lines(f_data, predict(fit.abs), col = grey80) #, log = xy
 dev.off()
 
 
 
 
 
 
 
 
 
 
 Yours sincerely / Med venlig hilsen
 
 
 Frede Aakmann Tøgersen
 Specialist, M.Sc., Ph.D.
 Plant Performance  Modeling
 
 Technology  Service Solutions
 T +45 9730 5135
 M +45 2547 6050
 fr...@vestas.com
 http://www.vestas.com
 
 Company reg. name: Vestas Wind Systems A/S
 This e-mail is subject to our e-mail disclaimer statement.
 Please refer to www.vestas.com/legal/notice
 If you have received this e-mail in error please contact the sender. 
 
 
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Andrea Graziani
 Sent: 9. februar 2014 23:46
 To: r-help@r-project.org
 Subject: [R] Regression of complex-valued functions
 
 Hi everyone,
 
 I previously posted this question but my message was not well written and
 did not contain any code so I will try to do a better job this time.
 
 The goal is to perform a non-linear regression on complex-valued data.
 I will first give a short description of the data and then describe the 
 complex-
 valued non-linear function.
 
 ***The Data
 Obtained from mechanical tests performed at 5 loading frequencies 0.1, 0.25,
 1, 0.4 and 12 Hz, and at 5 temeperatures.
 The independent variable used in the regression is:
 f_data - rep(c(0.1,0.25,1,4,12),5)
 
 The measured values of the response variable are:
 E - c(289.7411+ 225.0708i , 386.4417+ 303.5021i ,  671.5132+ 521.1253i ,
 1210.8638+ 846.6253i , 1860.9623+1155.4139i ,
 862.8984+ 636.2637i , 1159.0436+ 814.5609i , 1919.0369+1186.5679i ,
 3060.7207+1573.6088i  , 4318.1781+1868.4761i  ,
 2760.7782+1418.5450i , 3306.3013+1612.2712i , 4746.6958+1923.8662i ,
 6468.5769+2148.9502i , 8072.2642+2198.5344i  ,
 6757.7680+2061.3110i , 7591.9787+2123.9168i , 9522.9471+2261.8489i ,
 11255.0952+2166.6411i , 12601.3970+2120.7178i ,
 11913.6543+2016.0828i , 12906.8294+2030.0610i , 14343.7693+1893.4877i ,
 15942.7703+1788.0910i , 16943.2261+1665.9847i)
 
 To visualize the data:
 plot(f_data,Re(E),log=xy)
 plot(f_data,Im(E),log=xy)
 plot(E)
 
 ***Non-linear regression function:
 Obtained 

Re: [R] Regression of complex-valued functions

2014-02-12 Thread Rolf Turner

On 13/02/14 12:03, Andrea Graziani wrote:

SNIP


Using the same starting values, the two approaches bring to slightly different 
solutions:

### 1. Real part and Imaginary part

fit$estimate

  [1] -3.8519181 -2.7342861 -1.4823740  1.7173982  4.4529298  1.4383334  
0.1564904  0.4856774  2.2789567  3.9011926  0.1227758

### 2. Modulus and argument

fit$estimate

  [1] -3.8674680 -2.7250640 -1.4574350  1.6447868  4.4355748  1.2400092  
0.1574215  0.4731295  2.0624878  3.7526197  0.1161640

Do you believe this is due only to “numerical reasons linked to how the nls() 
function works?


I find it a bit surprising that there are differences in the third 
decimal place here.  I would have thought that the results would be 
exactly the same, or ***very*** close to it.


If you have done it right (I have not checked your code at all) the two 
approaches should amount to the same approach.  I.e. Mod(z)^2 is

equal to Re(z)^2 + Im(z)^2.

Check your code carefully.

Also it would be a good idea to try a toy example, something much less 
complicated than your real problem, and see what happens there.


cheers,

Rolf Turner

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] John M. Chambers Statistical Software Award 2014

2014-02-12 Thread Munjal, Aarti
The Statistical Computing Section of the American Statistical Association 
announces the competition for the John M. Chambers Statistical Software Award. 
In 1998 the Association for Computing Machinery presented its Software System 
Award to John Chambers for the design and development of S. Dr. Chambers 
generously donated his award to the Statistical Computing Section to endow an 
annual prize for statistical software written by, or in collaboration with, an 
undergraduate or graduate student. The prize carries with it a cash award of 
$1000, plus a substantial allowance for travel to the annual Joint Statistical 
Meetings (JSM) where the award will be presented.
Teams of up to 3 people can participate in the competition, with the cash award 
being split among team members. The travel allowance will be given to just one 
individual in the team, who will be presented the award at JSM. To be eligible, 
the team must have designed and implemented a piece of statistical software. 
The individual within the team indicated to receive the travel allowance must 
have begun the development while a student, and must either currently be a 
student, or have completed all requirements for her/his last degree after 
January 1, 2013. To apply for the award, teams must provide the following 
materials:
* Current CV's of all team members.
* A letter from a faculty mentor at the academic institution of the 
individual indicated to receive the travel award. The letter should confirm 
that the individual had substantial participation in the development of the 
software, certify her/his student status when the software began to be 
developed (and either the current student status or the date of degree 
completion), and briefly discuss the importance of the software to statistical 
practice.
* A brief, one to two page description of the software, summarizing 
what it does, how it does it, and why it is an important contribution. If the 
team member competing for the travel allowance has continued developing the 
software after finishing her/his studies, the description should indicate what 
was developed when the individual was a student and what has been added since.
* An installable software package with its source code for use by the 
award committee. It should be accompanied by enough information to allow the 
judges to effectively use and evaluate the software (including its design 
considerations.) This information can be provided in a variety of ways, 
including but not limited to a user manual (paper or electronic), a paper, a 
URL, and online help to the system.
All materials must be in English. We prefer that electronic text be submitted 
in Postscript or PDF. The entries will be judged on a variety of dimensions, 
including the importance and relevance for statistical practice of the tasks 
performed by the software, ease of use, clarity of description, elegance and 
availability for use by the statistical community. Preference will be given to 
those entries that are grounded in software design rather than calculation. The 
decision of the award committee is final.
All application materials must be received by 5:00pm EST, Tuesday, February 18, 
2014 at the address below. The winner will be announced in May and the award 
will be given at the 2014 Joint Statistical Meetings.
Student Paper Competition
c/o Aarti Munjal
Colorado School of Public Health
University of Colorado Denver
aarti.mun...@ucdenver.edumailto:aarti.mun...@ucdenver.edu


--
Aarti Munjal, Ph.D.
Research Assistant Professor
Department of Biostatistics and Informatics
Colorado School of Public Health
University of Colorado Denver
Office Phone: 303-724-6273


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Java 7.51 broke rJava?

2014-02-12 Thread Yury V Bukhman

Hi,

after I updated Java to 7.51 on my Windows system, rJava can no longer load:

 library(rJava)
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: No CurrentVersion entry in Software/JavaSoft registry! Try 
re-installing Java and make sure R and Java have matching architectures.

Error: package or namespace load failed for ‘rJava’

My session info:

 sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United 
States.1252 LC_MONETARY=English_United States.1252

[4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] limma_3.18.11 gage_2.12.1 Rcolombos_1.4.1 RJSONIO_1.0-3 
RCurl_1.95-4.1 bitops_1.0-6


loaded via a namespace (and not attached):
[1] BiocGenerics_0.8.0 Biostrings_2.30.1 digest_0.6.4 graph_1.40.1 
httr_0.2 IRanges_1.20.6
[7] KEGGREST_1.2.0 parallel_3.0.2 png_0.1-7 stats4_3.0.2 stringr_0.6.2 
tools_3.0.2

[13] XVector_0.2.0

Anyone knows how to fix this?

Thanks.

Yury

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help on best way to calculate and plot overall mean from dataset with two treatment groups

2014-02-12 Thread Rewarp
I am working on a dataset which has multiple species over several plots,
categorised into two treatment groups.

For example

group_xy group_op plot species value
x o 1 A 3
x o 1 A 5
x o 1 B 4
x o 2 A 3
x o 2 A 6
x o 2 A 3
y o 1 A 3
y o 1 A 5
y o 1 B 4
y o 2 A 3
y o 2 A 6
y o 2 A 3
x p 1 A 3
x p 1 A 5
x p 1 B 4
x p 2 A 3
x p 2 A 6
x p 2 A 3
y p 1 A 3
y p 1 A 5
y p 1 B 4
y p 2 A 3
y p 2 A 6
y p 2 A 3

What I would like to do is to take the mean of the species within each plot
in each treatment group, then generate the mean for the species based upon
the average of the values between plots.

Thus the intermediate output would be

group_xy group_op plot species mean_value standard_deviation
x o 1 A 3 sd
x o 1 B 4 sd
x o 2 A 4 sd
y o 1 A 3 sd
y o 1 B 4 sd
y o 2 A 4 sd
x p 1 A 3 sd
x p 1 B 4 sd
x p 2 A 4 sd
y p 1 A 3 sd
y p 1 B 4 sd
y p 2 A 4 sd

Then eventually
group_xy group_op species total_mean_value standard_deviation
x o A 3.5 sd
x o B 4 sd
y o A 3.5 sd
y o B 4 sd
x p A 3.5 sd
x p B 4 sd
y p A 3.5 sd
y p B 4 sd

I am looking for an elegant code which would allow me to do this and
generate plots. for all species for all treatment groups.

Any help would be appreciated!

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Java 7.51 broke rJava?

2014-02-12 Thread Jeff Newmiller
Have you investigated the suggestion in the error message yet?  Architecture 
means 32bit vs 64bit...
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 12, 2014 3:09:33 PM PST, Yury V Bukhman ybukh...@glbrc.wisc.edu 
wrote:
Hi,

after I updated Java to 7.51 on my Windows system, rJava can no longer
load:

  library(rJava)
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: No CurrentVersion entry in Software/JavaSoft registry! Try 
re-installing Java and make sure R and Java have matching
architectures.
Error: package or namespace load failed for ‘rJava’

My session info:

  sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United 
States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] limma_3.18.11 gage_2.12.1 Rcolombos_1.4.1 RJSONIO_1.0-3 
RCurl_1.95-4.1 bitops_1.0-6

loaded via a namespace (and not attached):
[1] BiocGenerics_0.8.0 Biostrings_2.30.1 digest_0.6.4 graph_1.40.1 
httr_0.2 IRanges_1.20.6
[7] KEGGREST_1.2.0 parallel_3.0.2 png_0.1-7 stats4_3.0.2 stringr_0.6.2 
tools_3.0.2
[13] XVector_0.2.0

Anyone knows how to fix this?

Thanks.

Yury

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] impossible to install package

2014-02-12 Thread Eve Dupierrix
Hi,
I want to install languageR but is doesn't work.

I tried it by two ways:
(1) by writing the following command but there is a warning message in response:

 install.packages (LanguageR)
Warning message:
package ‘LanguageR’ is not available (for R version 2.15.2) 

This problem appeared some weeks ago, but I was still able to install the 
package with the R package Installer
with CRAN (binaries).

(2) with the R package Installer
which does not work since today.
I tried different packages repository but it does not find LanguageR when I 
click on get list.
The list remains empty.


Could you please help me?

Many thanks,
Eve


--
Eve Dupierrix
Marie-Curie Research Fellow

Queensland Brain Institute
The University of Queensland
St Lucia 4072 QLD Australia
phone: +61 7 3346 3305
http://www.qbi.uq.edu.au/group-leader-mattingley
http://webu2.upmf-grenoble.fr/LPNC/membre_eve_dupierrix


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Inquiry

2014-02-12 Thread Kei_Takeuchi
Dear R users,

Hello, this is Kei Takeuchi in Japan.

I have started to use R(windows, version3.0.2) and have a problem. I 
think it is not difficlut but since I am beginner of R, I have no way to 
solve it.

Where can I post my question?

Thank you in advance.

Kei Takeuchi

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] impossible to install package

2014-02-12 Thread Jorge I Velez
Dear Eve,

See http://cran.r-project.org/web/packages/languageR/index.html  The name
of the package is languageR, not LanguageR.

Best,
Jorge.-


On Thu, Feb 13, 2014 at 3:39 PM, Eve Dupierrix evedupier...@gmail.comwrote:

 Hi,
 I want to install languageR but is doesn't work.

 I tried it by two ways:
 (1) by writing the following command but there is a warning message in
 response:

  install.packages (LanguageR)
 Warning message:
 package 'LanguageR' is not available (for R version 2.15.2)

 This problem appeared some weeks ago, but I was still able to install the
 package with the R package Installer
 with CRAN (binaries).

 (2) with the R package Installer
 which does not work since today.
 I tried different packages repository but it does not find LanguageR when
 I click on get list.
 The list remains empty.


 Could you please help me?

 Many thanks,
 Eve


 --
 Eve Dupierrix
 Marie-Curie Research Fellow

 Queensland Brain Institute
 The University of Queensland
 St Lucia 4072 QLD Australia
 phone: +61 7 3346 3305
 http://www.qbi.uq.edu.au/group-leader-mattingley
 http://webu2.upmf-grenoble.fr/LPNC/membre_eve_dupierrix


 [[alternative HTML version deleted]]


 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Inquiry

2014-02-12 Thread Pascal Oettli
Hi Kei,

Welcome.

I think you can first read an Introduction to R
(http://cran.r-project.org/doc/manuals/R-intro.pdf)

Then read the posting guide
http://www.R-project.org/posting-guide.html and provide commented,
minimal, self-contained, reproducible code, as requested when you ask
a question to the R-help mailing list.

Also, some specific questions have to be asked to specific mailing
list: http://www.r-project.org/mail.html

Hope this helps,
Pascal

On 13 February 2014 11:01, Kei_Takeuchi kt...@jari.or.jp wrote:
 Dear R users,

 Hello, this is Kei Takeuchi in Japan.

 I have started to use R(windows, version3.0.2) and have a problem. I
 think it is not difficlut but since I am beginner of R, I have no way to
 solve it.

 Where can I post my question?

 Thank you in advance.

 Kei Takeuchi

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.