Re: [R] Potencial bug in R.adjust (holm method)

2015-08-07 Thread peter dalgaard

On 06 Aug 2015, at 19:20 , Iker Vaquero Alba karrasp...@yahoo.es wrote:

Hello all,
I am doing some Bonferroni correction analyses with R.adjust function. I 
 have a spreadsheet with 24 columns, each with 5 values. When I use the holm 
 method, it gives me adjusted figures for all the original values except from 
 the ones in the 4th row of each column. I mean, the value on the 4th row for 
 every column is exactly the same either in the original data or in the 
 corrected one.   I've tried using another algorithm just to see what happens 
 (bonferroni, for example) and everything is fine, I get corrected figures 
 for all the values, even the ones on the 4th row.
 
Does anyone know whether this is any kind of known bug of the holm 
 algorithm of P.adjust function. If so, should I worry about it? If so, can 
 anybody suggest any possible solution?
Thank you very much.
Iker

p.adjust(), I presume?

The Holm procedure is essentially to sort p-values in decreasing order and 
mutiplying by 1:n plus a little fiddling to keep the order and prevent p  1. 
The logic is that if you reject the hypothesis corresponding to the smallest p 
after Bonferroni-correction by N, you only have N-1 simultaneous tests to 
consider, etc. The smallest multiplier will be 1, so it's not strange that one 
value appears uncorrected. It's curious that it is always in the 4th row, but 
it might be that the p-values in the 4 other rows are all considerably smaller.

You do realize that if you run p.adjust for each column, you are not actually 
adjusting for the total of 120 tests, only for 5 of them, effectively ignoring 
the 23 other columns every time?

-pd

 
 
 __
 
Dr. Iker Vaquero-Alba
Visiting Postdoctoral Research Associate
Laboratory of Evolutionary Ecology of Adaptations, 
School of Life Sciences, University of Lincoln,Riseholme Park Campus, 
 Lincoln
LN2 2LG,
UK.
 
https://eric.exeter.ac.uk/repository/handle/10036/3381
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] compare grupos dichotomus dependent variable

2015-08-07 Thread Bert Gunter
What does this have to do with R programming?

Bert

On Friday, August 7, 2015, AURORA GONZALEZ VIDAL aurora.gonzal...@um.es
wrote:

 Hello everybody. I have a statistics question:

 let's say that I want to compaire answers between men and women to a yes/no
 question but I have so much more women than men, then, it looks like I
 cannot use chi squared test. Would it be correct to use U test (or ranked
 Wilcoxon test)?? What do you think?? The code is below, than you so much!!

 men-rep( 0,12 )
 women - c( 0,1,0,0,0,1,0,0,0,rep( 0,114 ),1,rep( 0,199 ) )
 wilcox.test( men, women )
 chisq.test( men, women )


 --
 Aurora González Vidal

 Sección Apoyo Estadístico.
 Servicio de Apoyo a la Investigación (SAI).
 Vicerrectorado de Investigación.
 Universidad de Murcia
 Edif. SACE . Campus de Espinardo.
 30100 Murcia

 @. aurora.gonzal...@um.es javascript:;
 T. 868 88 7315
 F. 868 88 7302
 www.um.es/sai
 www.um.es/ae

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org javascript:; mailing list -- To UNSUBSCRIBE and
 more, see
 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.



-- 
Bert Gunter

Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom.
   -- Clifford Stoll

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Why does R start in wrong working directory despite R_USER setting?

2015-08-07 Thread Jim Lemon
Hi Mauricio,
You can also run a directory selection file by including something like this:

source(SelectAnalysis.R)

in the .First function (see An Introduction to R, section 10.8
Customizing the environment). Mine currently looks like this:

cat((A)custudy\n(I)nterval analysis\n(O)mbo
mapping\nR\n(C)ourse\nStressaly(Z)er\n)
answer-toupper(readline(Choose the project - ))
if(answer==A) setwd(/home/jim/research/im/acustudy)
if(answer==I) setwd(/home/jim/research/interval_analysis)
if(answer==O) setwd(/home/jim/research/ombo/mapping)
if(answer==R) setwd(/home/jim/R)
if(answer==C) setwd(/home/jim/bitwrit/R_programming_course)
if(answer==Z) setwd(/home/jim/research/stressalyser/naomi)
print(list.files(pattern=[.]R))
options(browser=konqueror,editor=kwrite,show.signif.stars=FALSE)

This should work on any system, regardless of your privileges.

Jim


On Sat, Aug 8, 2015 at 4:02 AM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote:
 Not really a question about R, but you can make a Windows shortcut that sets 
 the directory where you want it.

 My preference is to start in different working directories depending on which 
 project I am working on. R_USER is not a project directory. One way to do 
 that is to double-click on an RData file located where you want to start. 
 Another way is to create a new shortcut in each directory. Another way is to 
 add a line to your script that sets the directory appropriately, though that 
 makes sharing the scripts harder. Another way is to use RStudio projects.
 ---
 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 August 7, 2015 12:31:16 PM EDT, Mauricio Cornejo via R-help 
 r-help@r-project.org wrote:
Hi
After launching newly-installed R 3.2.1 (on Windows 7), I run the
following two commands:
 getwd()[1] C:/ProgramData/Microsoft/Windows/Start Menu/Programs/R
 Sys.getenv('R_USER')[1] C:\\Users\\my username\\Documents
I would like the startup working directory to be that pointed to by
R_USER.
I don't have administrative access to the machine.
Many thanks for any insight anyone can provide.
Mauricio
   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
 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 -- To UNSUBSCRIBE and more, see
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] compare grupos dichotomus dependent variable

2015-08-07 Thread Jim Lemon
Hi Aurora,
Perhaps what you are seeking is a test of proportions.

prop.test(c(sum(men),sum(women)),c(length(men),length(women)))

2-sample test for equality of proportions with continuity correction

data:  c(sum(men), sum(women)) out of c(length(men), length(women))
X-squared = 1.0378e-30, df = 1, p-value = 1
alternative hypothesis: two.sided
95 percent confidence interval:
 -0.02903701  0.01046116
sample estimates:
 prop 1  prop 2
0.0 0.009287926

Warning message:
In prop.test(c(sum(men), sum(women)), c(length(men), length(women))) :
  Chi-squared approximation may be incorrect

If the question was Have you had a baby in the past year? the answer
is not too far off, but your sample is a bit small.

Jim


On Sat, Aug 8, 2015 at 3:09 AM, AURORA GONZALEZ VIDAL
aurora.gonzal...@um.es wrote:
 Hello everybody. I have a statistics question:

 let's say that I want to compaire answers between men and women to a yes/no
 question but I have so much more women than men, then, it looks like I
 cannot use chi squared test. Would it be correct to use U test (or ranked
 Wilcoxon test)?? What do you think?? The code is below, than you so much!!

 men-rep( 0,12 )
 women - c( 0,1,0,0,0,1,0,0,0,rep( 0,114 ),1,rep( 0,199 ) )
 wilcox.test( men, women )
 chisq.test( men, women )


 --
 Aurora González Vidal

 Sección Apoyo Estadístico.
 Servicio de Apoyo a la Investigación (SAI).
 Vicerrectorado de Investigación.
 Universidad de Murcia
 Edif. SACE . Campus de Espinardo.
 30100 Murcia

 @. aurora.gonzal...@um.es
 T. 868 88 7315
 F. 868 88 7302
 www.um.es/sai
 www.um.es/ae

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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 -- To UNSUBSCRIBE and more, see
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] function ndq()

2015-08-07 Thread Uwe Ligges

Use an internet search engine.
The one I used told me that the book Statistics and Data with R: An 
Applied Approach Through Examples by Yosef Cohen, Jeremiah Y. Cohen 
contains a function definition of nqd in section 1.11.4.


Best,
Uwe Ligges




On 06.08.2015 23:31, kle...@sxmail.de wrote:

Hello everyone!I had to notice that it is better to be curious about packages and functions contained 
therein, as I (yet new to R) recognised that there is a number of 'convenient' R packages simplifying 
and possibilitating a lot. At the moment, I have 'retrofitted' (install packages not delivered with R's 
basic version) my R version (3.0.2); that number of packages already turned out to be more than 
helpful.Though, I have one problem lingering: It concerns a function that according to literature 
(Cohen  Cohen, ISBN-13 978-0-470-75805-2, 2008) is called nqd() and, as that reference 
put it, would enable the R user to print data (when working with matrices) without quotes and dimension 
names on the R console.I have but had difficulties getting to know to which package function 
nqd() belongs and would like to ask the R help community which package that was.Thanks a 
lot in advance yet!Best regards,Markus


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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] Potencial bug in R.adjust (holm method)

2015-08-07 Thread Uwe Ligges

Please send a reproducible example.

Best,
Uwe Ligges


On 06.08.2015 19:20, Iker Vaquero Alba wrote:

Hello all,
I am doing some Bonferroni correction analyses with R.adjust function. I have a spreadsheet 
with 24 columns, each with 5 values. When I use the holm method, it gives me adjusted 
figures for all the original values except from the ones in the 4th row of each column. I mean, the 
value on the 4th row for every column is exactly the same either in the original data or in the 
corrected one.   I've tried using another algorithm just to see what happens 
(bonferroni, for example) and everything is fine, I get corrected figures for all the 
values, even the ones on the 4th row.

Does anyone know whether this is any kind of known bug of the holm 
algorithm of P.adjust function. If so, should I worry about it? If so, can anybody 
suggest any possible solution?
Thank you very much.
Iker


__

Dr. Iker Vaquero-Alba
Visiting Postdoctoral Research Associate
Laboratory of Evolutionary Ecology of Adaptations,
School of Life Sciences, University of Lincoln,Riseholme Park Campus, 
Lincoln
LN2 2LG,
UK.

https://eric.exeter.ac.uk/repository/handle/10036/3381


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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 plotting glmm values

2015-08-07 Thread Luis Fernando García
Dear Fellows,

I´m sorry if my question is very basic, but I'm still new in the field of R
and the GLMM.

I have made a following glmm, and I need to plot the predicted mean values
from the model and the CI, with this barplot +/- the CI, using the prey as
explanatory factor.

 Although I have been looking for it, I have not found a website which show
the way to do this, so  I'm unsure about the right procedure. If any of you
could help me with the correct procedure I would really apprreciate it!

Sorry for attaching the dataset, but it is too long.

##GLMM

Lac=read.table(loxoacc10.txt,header=T)
library(lme4)
glmm1 - glmer(Acc ~ Prey + (1 | Sp), family=binomial)
summary(glmm1)
overdisp_fun - function(model) {
  ## number of variance parameters in
  ##   an n-by-n variance-covariance matrix
  vpars - function(m) {
nrow(m)*(nrow(m)+1)/2
  }
overdisp_fun(glmm1)#Check for overdispersal
Sp  Acc Prey
1   1   hormiga
1   1   termita
1   1   larva
1   0   cochinilla
2   0   hormiga
2   1   termita
2   0   larva
2   0   cochinilla
3   0   hormiga
3   1   termita
3   1   larva
3   1   cochinilla
4   1   hormiga
4   0   termita
4   0   larva
4   1   cochinilla
5   1   hormiga
5   0   termita
5   1   larva
5   0   cochinilla
6   1   hormiga
6   1   termita
6   1   larva
6   0   cochinilla
7   1   hormiga
7   1   termita
7   1   larva
7   1   cochinilla
8   1   hormiga
8   1   termita
8   1   larva
8   1   cochinilla
9   1   hormiga
9   1   termita
9   1   larva
9   0   cochinilla
10  1   hormiga
10  1   termita
10  0   larva
10  1   cochinilla
11  1   hormiga
11  1   termita
11  1   larva
11  0   cochinilla
12  1   hormiga
12  1   termita
12  1   larva
12  1   cochinilla
13  1   hormiga
13  1   termita
13  1   larva
13  1   cochinilla
14  1   hormiga
14  1   termita
14  1   larva
14  0   cochinilla
15  1   hormiga
15  1   termita
15  1   larva
15  0   cochinilla
16  1   hormiga
16  1   termita
16  1   larva
16  0   cochinilla
17  1   hormiga
17  0   termita
17  1   larva
17  0   cochinilla
18  1   hormiga
18  1   termita
18  1   larva
18  1   cochinilla
19  0   hormiga
19  1   termita
19  1   larva
19  0   cochinilla
20  0   hormiga
20  1   termita
20  1   larva
20  1   cochinilla
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] testing whether two character vectors contain (the same) items in the same order

2015-08-07 Thread Federico Calboli

 On 7 Aug 2015, at 01:59, Bert Gunter bgunter.4...@gmail.com wrote:
 
 Boris:
 
 You may be right, but it seems like esp to me based on the op's 
 non-description of likelihood of coming from the same noisy process. My 
 response would be: seek local statistical help, as your replies indicate a 
 good deal of statistical confusion.
 
 Cheers,
 Bert

Bert,

as this is R-help and not cross-validated I am looking for a precanned function 
that would test whether the order of characters in two character vectors comes 
from the same (noisy) process.  I would thus expect you to say something on the 
lines of:

function X uses method Y to do something like that
function W uses method Z to do something like that
…

look into those, figure out exactly what you are testing and use the most 
appropiate function.  

The whys and wherefores are for me to deal with, I just want to know whether 
someone has built a function that does, or seems to do, what I asked for.  As I 
said, this is R-help, and I seek help for R use.

I do concede that my original question might have left many wondering, but I 
guess my reply to Boris would have cleared any doubts.  I am therefore puzzled 
by the great deal of confusion on your part in understanding the purpose of my 
question and, in general, of this list.

Best wishes

F


 
 
 
 On Thursday, August 6, 2015, Boris Steipe boris.ste...@utoronto.ca wrote:
 You are looking for what is known as the Cayley distance between vectors - 
 an edit distance that allows only transpositions. RSeek mentions PerMallows 
 (https://cran.r-project.org/web/packages/PerMallows/PerMallows.pdf) and 
 Rankluster 
 (https://cran.r-project.org/web/packages/Rankcluster/Rankcluster.pdf) as 
 packages that support work with Cayley distances. It seems to me that 
 distCayley() in Rankcluster does what you want. From the examples:
 
 x=1:5
 y=c(2,3,1,4,5)
 distCayley(x,y)
 8
 
 
 Cheers,
 Boris
 
 
 
 
 
 On Aug 6, 2015, at 9:51 AM, Federico Calboli federico.calb...@helsinki.fi 
 wrote:
 
 
  On 6 Aug 2015, at 15:40, Bert Gunter bgunter.4...@gmail.com wrote:
 
  Define goodness of match .  For exact matches, see ?== , all.equal, 
  etc.
 
  Fair point.  I would define it as a number that tells me how likely it is 
  that the same (noisy) process produced both lists.
 
  BW
 
  F
 
 
 
 
 
  Bert
 
  On Thursday, August 6, 2015, Federico Calboli 
  federico.calb...@helsinki.fi wrote:
  Hi All,
 
  let’s assume I have a vector of letters drawn only once from the alphabet:
 
  x = sample(letters, 15, replace = F)
  x
  [1] z t g l u d w x a q k j f n “v
 
  y = x[c(1:7,9:8, 10:12, 14, 15, 13)]
 
  I would now like to test how good a match y is for x.  Obviously I can 
  transform the letters in numbers and use a rank test, but I was left 
  wondering whether this is the only solution and whether there are more 
  appropriate solutions that are already implemented in R (I am not going to 
  reinvent the wheel if I can avoid it).
 
  BW
 
  F
 
 
  --
  Federico Calboli
  Ecological Genetics Research Unit
  Department of Biosciences
  PO Box 65 (Biocenter 3, Viikinkaari 1)
  FIN-00014 University of Helsinki
  Finland
 
  federico.calb...@helsinki.fi
 
  __
  R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
  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.
 
 
  --
  Bert Gunter
 
  Data is not information. Information is not knowledge. And knowledge is 
  certainly not wisdom.
-- Clifford Stoll
 
 
 
  --
  Federico Calboli
  Ecological Genetics Research Unit
  Department of Biosciences
  PO Box 65 (Biocenter 3, Viikinkaari 1)
  FIN-00014 University of Helsinki
  Finland
 
  federico.calb...@helsinki.fi
 
  __
  R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
  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 -- To UNSUBSCRIBE and more, see
 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.
 
 
 -- 
 Bert Gunter
 
 Data is not information. Information is not knowledge. And knowledge is 
 certainly not wisdom.
-- Clifford Stoll
 


--
Federico Calboli
Ecological Genetics Research Unit
Department of Biosciences
PO Box 65 (Biocenter 3, Viikinkaari 1)
FIN-00014 University of Helsinki
Finland

federico.calb...@helsinki.fi

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Potencial bug in R.adjust (holm method)

2015-08-07 Thread peter dalgaard

On 07 Aug 2015, at 16:20 , Iker Vaquero Alba karrasp...@yahoo.es wrote:

 
 
Hello, Peter, and thank you for your clarifying reply. Actually, that was 
 another doubt I had. As I take my data from different files (every bunch of 
 5 values is taken from a different file), I assumed that, if I wanted to 
 adjust for the error due to repeated measures, it should be enough to do it 
 inside each file, right? I mean, the possible error due to repeated measures 
 shouldn't go beyond each file. Once you close one file, open and attach a new 
 one, the count, let's say, starts from scratch. 
 Am I right? And if I'm not, what is the reason why should I pool all the 
 p-values in a massive column and adjust them in bulk?
 


There's no clear answer to that kind of question. It depends on which kind of 
error rate you want to control, but in principle multiple response variables 
are not different than multiple comparisons. If you test 20 response variables 
at level 5%, on average 1 will come out significant even if there are no actual 
effects (if the variables are highly correlated, this may mean that all 20 come 
out significant with 5% probability, though).



Thank you very much for your help.
Iker
  
 __
 
Dr. Iker Vaquero-Alba
Visiting Postdoctoral Research Associate
Laboratory of Evolutionary Ecology of Adaptations, 
School of Life Sciences, University of Lincoln, 
Riseholme Park Campus, Lincoln
LN2 2LG,
UK.
 
https://eric.exeter.ac.uk/repository/handle/10036/3381
 
 
 De: peter dalgaard pda...@gmail.com
 Para: Iker Vaquero Alba karrasp...@yahoo.es 
 CC: r-help@r-project.org r-help@r-project.org 
 Enviado: Viernes 7 de agosto de 2015 14:40
 Asunto: Re: [R] Potencial bug in R.adjust (holm method)
 
 
 On 06 Aug 2015, at 19:20 , Iker Vaquero Alba karrasp...@yahoo.es wrote:
 
 Hello all,
 I am doing some Bonferroni correction analyses with R.adjust function. I 
  have a spreadsheet with 24 columns, each with 5 values. When I use the 
  holm method, it gives me adjusted figures for all the original values 
  except from the ones in the 4th row of each column. I mean, the value on 
  the 4th row for every column is exactly the same either in the original 
  data or in the corrected one.  I've tried using another algorithm just to 
  see what happens (bonferroni, for example) and everything is fine, I get 
  corrected figures for all the values, even the ones on the 4th row.
  
 Does anyone know whether this is any kind of known bug of the holm 
  algorithm of P.adjust function. If so, should I worry about it? If so, can 
  anybody suggest any possible solution?
 Thank you very much.
 Iker
 
 p.adjust(), I presume?
 
 The Holm procedure is essentially to sort p-values in decreasing order and 
 mutiplying by 1:n plus a little fiddling to keep the order and prevent p  1. 
 The logic is that if you reject the hypothesis corresponding to the smallest 
 p after Bonferroni-correction by N, you only have N-1 simultaneous tests to 
 consider, etc. The smallest multiplier will be 1, so it's not strange that 
 one value appears uncorrected. It's curious that it is always in the 4th row, 
 but it might be that the p-values in the 4 other rows are all considerably 
 smaller.
 
 You do realize that if you run p.adjust for each column, you are not actually 
 adjusting for the total of 120 tests, only for 5 of them, effectively 
 ignoring the 23 other columns every time?
 
 -pd
 
 
 
 
  
  
  __
  
 Dr. Iker Vaquero-Alba
 Visiting Postdoctoral Research Associate
 Laboratory of Evolutionary Ecology of Adaptations, 
 School of Life Sciences, University of Lincoln,Riseholme Park 
  Campus, Lincoln
 LN2 2LG,
 UK.
  
 https://eric.exeter.ac.uk/repository/handle/10036/3381
 
  
  
  [[alternative HTML version deleted]]
  
  __
  R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
  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.
 
 -- 
 Peter Dalgaard, Professor,
 Center for Statistics, Copenhagen Business School
 Solbjerg Plads 3, 2000 Frederiksberg, Denmark
 Phone: (+45)38153501
 Office: A 4.23
 Email: pd@cbs.dk  Priv: pda...@gmail.com
 
 
 
 
 
 
 
 
 
 
 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and 

[R] fpc package - computing silhouette value returns error

2015-08-07 Thread Ziqi Zhang

Hi
I am using R to do clustering and compute a number of cluster 
statistics. Below are my code. I do not understand why I get the error:


Error in summary(silhouette(clustering[ss[[i]]], dx)) : error in 
evaluating the argument 'object' in selecting a method for function 
'summary': Error in round(x) : non-numeric argument to mathematical 
function


Any suggestsion highly appreciated!
Code:
--
library(fpc)
require(graphics)
distance - dist(USArrests, euclidean)
hc -hclust(distance, average)
distcritmulti(USArrests, hc, criterion=asw, fun=dist, 
metric=euclidean)

-



--
Ziqi Zhang
Research Associate
Department of Computer Science
University of Sheffield


---
This email has been checked for viruses by Avast antivirus software.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Why does R start in wrong working directory despite R_USER setting?

2015-08-07 Thread Mauricio Cornejo via R-help
Hi
After launching newly-installed R 3.2.1 (on Windows 7), I run the following two 
commands:
 getwd()[1] C:/ProgramData/Microsoft/Windows/Start Menu/Programs/R
 Sys.getenv('R_USER')[1] C:\\Users\\my username\\Documents
I would like the startup working directory to be that pointed to by R_USER.
I don't have administrative access to the machine.
Many thanks for any insight anyone can provide.
Mauricio
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] fpc package - computing silhouette value returns error

2015-08-07 Thread William Dunlap
help(distcritmulti) says that its 2nd argument is
   clustering: vector of integers indicating the clustering
and you supplied the output of hclust, which is not a
vector of group identifiers.  You can make a group
identifier vector from hc with cutree(hc, k=4), where k is
the number of groups.



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Aug 7, 2015 at 7:40 AM, Ziqi Zhang ziqi.zh...@sheffield.ac.uk
wrote:

 Hi
 I am using R to do clustering and compute a number of cluster statistics.
 Below are my code. I do not understand why I get the error:

 Error in summary(silhouette(clustering[ss[[i]]], dx)) : error in
 evaluating the argument 'object' in selecting a method for function
 'summary': Error in round(x) : non-numeric argument to mathematical
 function

 Any suggestsion highly appreciated!
 Code:
 --
 library(fpc)
 require(graphics)
 distance - dist(USArrests, euclidean)
 hc -hclust(distance, average)
 distcritmulti(USArrests, hc, criterion=asw, fun=dist,
 metric=euclidean)
 -



 --
 Ziqi Zhang
 Research Associate
 Department of Computer Science
 University of Sheffield


 ---
 This email has been checked for viruses by Avast antivirus software.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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 -- To UNSUBSCRIBE and more, see
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] Potencial bug in R.adjust (holm method)

2015-08-07 Thread Iker Vaquero Alba


   Hello, Peter, and thank you for your clarifying reply. Actually, that was 
another doubt I had. As I take my data from different files (every bunch of 5 
values is taken from a different file), I assumed that, if I wanted to adjust 
for the error due to repeated measures, it should be enough to do it inside 
each file, right? I mean, the possible error due to repeated measures shouldn't 
go beyond each file. Once you close one file, open and attach a new one, the 
count, let's say, starts from scratch. 
Am I right? And if I'm not, what is the reason why should I pool all the 
p-values in a massive column and adjust them in bulk?
   Thank you very much for your help.   Iker 
__

   Dr. Iker Vaquero-Alba
   Visiting Postdoctoral Research Associate
   Laboratory of Evolutionary Ecology of Adaptations, 
   School of Life Sciences, University of Lincoln,    Riseholme Park Campus, 
Lincoln
   LN2 2LG,
   UK.

   https://eric.exeter.ac.uk/repository/handle/10036/3381


  De: peter dalgaard pda...@gmail.com

CC: r-help@r-project.org r-help@r-project.org 
 Enviado: Viernes 7 de agosto de 2015 14:40
 Asunto: Re: [R] Potencial bug in R.adjust (holm method)
   



    Hello all,
    I am doing some Bonferroni correction analyses with R.adjust function. I 
have a spreadsheet with 24 columns, each with 5 values. When I use the holm 
method, it gives me adjusted figures for all the original values except from 
the ones in the 4th row of each column. I mean, the value on the 4th row for 
every column is exactly the same either in the original data or in the 
corrected one.  I've tried using another algorithm just to see what happens 
(bonferroni, for example) and everything is fine, I get corrected figures 
for all the values, even the ones on the 4th row.
 
    Does anyone know whether this is any kind of known bug of the holm 
algorithm of P.adjust function. If so, should I worry about it? If so, can 
anybody suggest any possible solution?
    Thank you very much.
    Iker

p.adjust(), I presume?

The Holm procedure is essentially to sort p-values in decreasing order and 
mutiplying by 1:n plus a little fiddling to keep the order and prevent p  1. 
The logic is that if you reject the hypothesis corresponding to the smallest p 
after Bonferroni-correction by N, you only have N-1 simultaneous tests to 
consider, etc. The smallest multiplier will be 1, so it's not strange that one 
value appears uncorrected. It's curious that it is always in the 4th row, but 
it might be that the p-values in the 4 other rows are all considerably smaller.

You do realize that if you run p.adjust for each column, you are not actually 
adjusting for the total of 120 tests, only for 5 of them, effectively ignoring 
the 23 other columns every time?

-pd



 
 
 __
 
    Dr. Iker Vaquero-Alba
    Visiting Postdoctoral Research Associate
    Laboratory of Evolutionary Ecology of Adaptations, 
    School of Life Sciences, University of Lincoln,    Riseholme Park Campus, 
Lincoln
    LN2 2LG,
    UK.
 
    https://eric.exeter.ac.uk/repository/handle/10036/3381
 
 
     [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com










  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Treemap error - missing value where TRUE/FALSE needed

2015-08-07 Thread Alicia Pérez-Porro
Dear R users,

I am trying to generate a treemap using the package Treemap on R and I'm
encountering the subsequent error:


*Error in if (rec[3]  rec[4]) { : missing value where TRUE/FALSE needed*

I did traceback() and I got:

*5: pivotSize(numeric(0), c(NA_real_, NA_real_, NA_real_, NA_real_*
*   ))*
*4: do.call(algorithm, list(value, rec))*
*3: subTM(datlist[datlist$l == 1])*
*2: tmGenerateRect(datlist, vps, indexList, algorithm)*
*1: treemap(stuff, index = c(representative, description), vSize =
value, *
*   type = categorical, vColor = representative, title = REVIGO
Gene Ontology treemap, *
*   inflate.labels = FALSE, lowerbound.cex.labels = 0, bg.labels =
#CCAA, *
*   position.legend = none)*

My script is attached.

I have no idea about how to fix it. Can anyone please help me?
Thanks in advance,

Alicia
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Why does R start in wrong working directory despite R_USER setting?

2015-08-07 Thread Jeff Newmiller
Not really a question about R, but you can make a Windows shortcut that sets 
the directory where you want it.

My preference is to start in different working directories depending on which 
project I am working on. R_USER is not a project directory. One way to do that 
is to double-click on an RData file located where you want to start. Another 
way is to create a new shortcut in each directory. Another way is to add a line 
to your script that sets the directory appropriately, though that makes sharing 
the scripts harder. Another way is to use RStudio projects.
---
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 August 7, 2015 12:31:16 PM EDT, Mauricio Cornejo via R-help 
r-help@r-project.org wrote:
Hi
After launching newly-installed R 3.2.1 (on Windows 7), I run the
following two commands:
 getwd()[1] C:/ProgramData/Microsoft/Windows/Start Menu/Programs/R
 Sys.getenv('R_USER')[1] C:\\Users\\my username\\Documents
I would like the startup working directory to be that pointed to by
R_USER.
I don't have administrative access to the machine.
Many thanks for any insight anyone can provide.
Mauricio
   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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] help plotting glmm values

2015-08-07 Thread Ben Bolker
Luis Fernando García luysgarcia at gmail.com writes:

 
 Dear Fellows,
 
 I´m sorry if my question is very basic, but I'm still new in the field of R
 and the GLMM.

  In future, you might consider posting to r-sig-mixed-mod...@r-project.org
instead ...

 I have made a following glmm, and I need to plot the predicted mean values
 from the model and the CI, with this barplot +/- the CI, using the prey as
 explanatory factor.
 
  Although I have been looking for it, I have not found 
 a website which show
 the way to do this, so  I'm unsure about the right procedure. 
 If any of you
 could help me with the correct procedure I would really apprreciate it!

See:

http://glmm.wikidot.com/faq#predconf
http://ms.mcmaster.ca/~bolker/R/misc/foxchapter/  

Some modified analysis:

library(lme4)
glmm1 - glmer(Acc ~ Prey + (1 | Sp), data=Lac, family=binomial)
summary(glmm1)
deviance(glmm1)/df.residual(glmm1)
glmm2 - update(glmm1,nAGQ=10)

## aggregate
library(plyr)
Lac_agg - ddply(Lac,c(Prey,Sp),
 summarise,
 N=length(Acc),
 p=mean(Acc))
Lac_agg - aggregate(Acc~Prey*Sp,FUN=function(x) c(k=sum(x),N=length(x)),
 data=Lac)
glmm3 - glmer(p ~ Prey + (1 | Sp), weights=N,
   data=Lac_agg, family=binomial)
deviance(glmm3)/df.residual(glmm3)
## model with ind-level obs blows up: leave it alone ...
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] compare grupos dichotomus dependent variable

2015-08-07 Thread AURORA GONZALEZ VIDAL
Hello everybody. I have a statistics question:

let's say that I want to compaire answers between men and women to a yes/no
question but I have so much more women than men, then, it looks like I
cannot use chi squared test. Would it be correct to use U test (or ranked
Wilcoxon test)?? What do you think?? The code is below, than you so much!!

men-rep( 0,12 )
women - c( 0,1,0,0,0,1,0,0,0,rep( 0,114 ),1,rep( 0,199 ) )
wilcox.test( men, women )
chisq.test( men, women )


--
Aurora González Vidal

Sección Apoyo Estadístico.
Servicio de Apoyo a la Investigación (SAI).
Vicerrectorado de Investigación.
Universidad de Murcia
Edif. SACE . Campus de Espinardo.
30100 Murcia

@. aurora.gonzal...@um.es
T. 868 88 7315
F. 868 88 7302
www.um.es/sai
www.um.es/ae

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Why does R start in wrong working directory despite R_USER setting?

2015-08-07 Thread Michael Dewey
Assuming you are using the GUI you can use the Properties of the 
shortcut to tell R where to start.


On 07/08/2015 17:31, Mauricio Cornejo via R-help wrote:

Hi
After launching newly-installed R 3.2.1 (on Windows 7), I run the following two 
commands:

getwd()[1] C:/ProgramData/Microsoft/Windows/Start Menu/Programs/R
Sys.getenv('R_USER')[1] C:\\Users\\my username\\Documents

I would like the startup working directory to be that pointed to by R_USER.
I don't have administrative access to the machine.
Many thanks for any insight anyone can provide.
Mauricio
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] testing whether two character vectors contain (the same) items in the same order

2015-08-07 Thread David Winsemius

On Aug 7, 2015, at 12:22 AM, Federico Calboli wrote:

 
 On 7 Aug 2015, at 01:59, Bert Gunter bgunter.4...@gmail.com wrote:
 
 Boris:
 
 You may be right, but it seems like esp to me based on the op's 
 non-description of likelihood of coming from the same noisy process. My 
 response would be: seek local statistical help, as your replies indicate a 
 good deal of statistical confusion.
 
 Cheers,
 Bert
 
 Bert,
 
 as this is R-help and not cross-validated I am looking for a precanned 
 function that would test whether the order of characters in two character 
 vectors comes from the same (noisy) process.  I would thus expect you to say 
 something on the lines of:
 
 function X uses method Y to do something like that
 function W uses method Z to do something like that
 …
 
 look into those, figure out exactly what you are testing and use the most 
 appropiate function.  
 
 The whys and wherefores are for me to deal with, I just want to know whether 
 someone has built a function that does, or seems to do, what I asked for.  As 
 I said, this is R-help, and I seek help for R use.

 findFn(levenshtein)
found 57 matches;  retrieving 3 pages
2 3 
Downloaded 44 links in 17 packages.


 stringdist::stringdist( paste0(x, collapse=), paste0(letters[y], 
collapse=) )
[1] 30

-- 
HTH;
David.

 
 I do concede that my original question might have left many wondering, but I 
 guess my reply to Boris would have cleared any doubts.  I am therefore 
 puzzled by the great deal of confusion on your part in understanding the 
 purpose of my question and, in general, of this list.
 
 Best wishes
 
 F
 
 
 
 
 
 On Thursday, August 6, 2015, Boris Steipe boris.ste...@utoronto.ca wrote:
 You are looking for what is known as the Cayley distance between vectors - 
 an edit distance that allows only transpositions. RSeek mentions PerMallows 
 (https://cran.r-project.org/web/packages/PerMallows/PerMallows.pdf) and 
 Rankluster 
 (https://cran.r-project.org/web/packages/Rankcluster/Rankcluster.pdf) as 
 packages that support work with Cayley distances. It seems to me that 
 distCayley() in Rankcluster does what you want. From the examples:
 
 x=1:5
 y=c(2,3,1,4,5)
 distCayley(x,y)
 8
 
 
 Cheers,
 Boris
 
 
 
 
 
 On Aug 6, 2015, at 9:51 AM, Federico Calboli federico.calb...@helsinki.fi 
 wrote:
 
 
 On 6 Aug 2015, at 15:40, Bert Gunter bgunter.4...@gmail.com wrote:
 
 Define goodness of match .  For exact matches, see ?== , all.equal, 
 etc.
 
 Fair point.  I would define it as a number that tells me how likely it is 
 that the same (noisy) process produced both lists.
 
 BW
 
 F
 
 
 
 
 
 Bert
 
 On Thursday, August 6, 2015, Federico Calboli 
 federico.calb...@helsinki.fi wrote:
 Hi All,
 
 let’s assume I have a vector of letters drawn only once from the alphabet:
 
 x = sample(letters, 15, replace = F)
 x
 [1] z t g l u d w x a q k j f n “v
 
 y = x[c(1:7,9:8, 10:12, 14, 15, 13)]
 
 I would now like to test how good a match y is for x.  Obviously I can 
 transform the letters in numbers and use a rank test, but I was left 
 wondering whether this is the only solution and whether there are more 
 appropriate solutions that are already implemented in R (I am not going to 
 reinvent the wheel if I can avoid it).
 
 BW
 
 F
 
 
 --
 Federico Calboli
 Ecological Genetics Research Unit
 Department of Biosciences
 PO Box 65 (Biocenter 3, Viikinkaari 1)
 FIN-00014 University of Helsinki
 Finland
 
 federico.calb...@helsinki.fi
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.
 
 
 --
 Bert Gunter
 
 Data is not information. Information is not knowledge. And knowledge is 
 certainly not wisdom.
  -- Clifford Stoll
 
 
 
 --
 Federico Calboli
 Ecological Genetics Research Unit
 Department of Biosciences
 PO Box 65 (Biocenter 3, Viikinkaari 1)
 FIN-00014 University of Helsinki
 Finland
 
 federico.calb...@helsinki.fi
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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 -- To UNSUBSCRIBE and more, see
 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.
 
 
 -- 
 Bert Gunter
 
 Data is not information. Information is not knowledge. And knowledge is 
 certainly not wisdom.
   -- Clifford Stoll
 
 
 
 --
 Federico Calboli
 Ecological Genetics Research Unit
 Department of Biosciences
 PO Box 65 (Biocenter 3, 

Re: [R] Piecewise (segmented) linear regression with center section slope constraint

2015-08-07 Thread Adams, Jean
This posting on StackOverflow might be useful to you.
http://stackoverflow.com/questions/13810607/in-r-package-segmented-how-could-i-set-the-slope-of-one-of-lines-in-the-model

Jean

On Thu, Aug 6, 2015 at 3:01 PM, Drew Morrison dmorri...@seventhwave.org
wrote:

 Hi,

 I'm working on a way to predict the electricity consumption of electrically
 heated buildings as a function of outdoor air temperature. I've identified
 a
 three-segment linear model as a candidate for a good fit, with the slope of
 the center section constrained to zero. I'm working with the segmented
 package. I've searched some of the other posts on this forum and they've
 been very helpful, but they don't address my big sticking point: how do I
 constrain the slope of the center section of the model to 0, rather than
 the
 left or right section?

 Below is a script with simulated data and my first attempt at fitting the
 model. You should be able to copy, paste, and run it. Thanks in advance.
 Drew

 # three-piece segmented regression
 # center section constrained to slope of 0.


 # simulate and plot data
 T- 1:100
 energy- 100+75*pmax(55-T,0)+25*pmax(T-70,0)+150*rnorm(50)
 plot(T, energy)

 # create a linear model
 model - lm(energy~T)
 #print(summary(model))

 # start segmented regression
 library(segmented)
 seg_model - segmented(model, seg.Z = ~ T, psi = list(T = c(52, 71)))
 print(summary(seg_model))
 print(seg_model$psi)
 print(slope(seg_model))

 # plot regression lines
 fitted_energy - fitted(seg_model)
 regression_model - data.frame(Temperature = T, kWh = fitted_energy)
 lines(x = T, y = fitted_energy, col = 1)

 # try constrained regression
 TT- -T   # change signs of independent variable
 model - lm(energy~1)  # constrain slope
 seg_model - segmented(model, seg.Z = ~ TT, psi = list(TT = c(-71, -52)))
 print(summary(seg_model))
 print(seg_model$psi)
 print(slope(seg_model))

 # plot constrained regression
 fitted_energy - fitted(seg_model)
 regression_model - data.frame(Temperature = T, kWh = fitted_energy)
 lines(x = T, y = fitted_energy, col = 2)



 --
 View this message in context:
 http://r.789695.n4.nabble.com/Piecewise-segmented-linear-regression-with-center-section-slope-constraint-tp4710839.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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 -- To UNSUBSCRIBE and more, see
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] TVP-ECM modelling in R

2015-08-07 Thread mrrox
Hello,

I want to estimate a TVP-ECM model in R. Is there a specific package in R
that can handle TVP-ECM models?

Thank you



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

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Piecewise (segmented) linear regression with center section slope constraint

2015-08-07 Thread Drew Morrison
Thanks, Jean. I've actually looked at that source before. The issue is that I
can't constrain the slope of the /center/ section to be zero - in fact, I've
applied similar code to a three-segment regression and I can get a zero
slope either of the two sides, but not in the middle.

Here's a list of the main resources I've consulted so far:

https://climateecology.wordpress.com/2012/08/19/r-for-ecologists-putting-together-a-piecewise-regression/

http://www.stackoverflow.dluat.com/questions/30060278/creating-piecewise-linear-regression-with-flat-slope-in-r

https://rpubs.com/MarkusLoew/12164



--
View this message in context: 
http://r.789695.n4.nabble.com/Piecewise-segmented-linear-regression-with-center-section-slope-constraint-tp4710839p4710875.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Error with predict and newdata

2015-08-07 Thread kira taylor
Hi!

I am trying to use predict to apply my model to data from one time period to
see what might be the values for another time period.  I did this
successfully for one dataset, and then tried on another with identical code
and got the following error:

Error in eval(predvars, data, env) :
  numeric 'envir' arg not of length one

The only difference between the two datasets was that my predictor model for
the first dataset had two predictor variables and my model for the second
dataset had only one.  Why would this make a difference?

My dougfir.csv contains just two columns with thirty numbers in each,
labeled height and dryshoot.

my lm is: fitdougfir - lm(dryshoot~height,data=dougfir)

It gets a little complicated (and messy, sorry!  I am new to R) because I
then made a second .csv - the one I used to make my model contained values
from just June.  My new .csv (called alldatadougfir.csv) includes values
from October as well, and also contains a date column that labels the
values either june or october.

I did the following to separate the height data by date:

alldatadougfir[alldatadougfir$date==june,c(height)]-junedatadougfir
alldatadougfir[alldatadougfir$date==october,c(height)]-
octoberdatadougfir

I then want to use my June model to predict my October dryshoots using
height as my variable and I did the following:

predict(fitdougfir, newdata=junedatadougfir)
predict(fitdougfir, newdata=octoberdatadougfir)

Again, I did this with an identical dataset successfully - the only
difference was that my model in the successful dataset had two predictor
variables instead of the one variable (height) I have in this dataset.

Sorry again for my messy code!

Thank you very much,

Kira

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 funct

2015-08-07 Thread Jose Betancourt B.
Dear

i am develeping a function, first  I attach r command and later r executer
script, the conection fails and I do not realize why

best regards
100 38  1
80  19  5
90  31  2
70  21  6
85  30  3
75  22  5
99  37  1
100 38  1
80  19  5
90  31  2
70  21  6
85  30  3
75  22  5
99  37  1__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] creating a funct

2015-08-07 Thread Jeff Newmiller
I think the readers of this mailing list would have to be psychic to know what 
went wrong given that description. This kind of situation usually requires 
in-person help, so I recommend looking for an educational environment that 
offers such assistance... a seminar, university class, tutor, or users group, 
for example.

---
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 August 7, 2015 6:23:23 PM EDT, Jose Betancourt B. betans...@gmail.com 
wrote:
Dear

i am develeping a function, first  I attach r command and later r
executer
script, the conection fails and I do not realize why

best regards




__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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] Cant upgrade R in ubuntu 14.04

2015-08-07 Thread boredstoog via R-help

I am trying to install R programming language and able to install rbase
using this code without adding repository in *source.list*

sudo apt-get install r-base

After that i tried to upgrade it using this code

sudo add-apt-repository ‘deb
http://star-www.st-andrews.ac.uk/cran/bin/linux/ubuntu/trusty/’
sudo apt-get update
sudo apt-get upgrade

But when i tried the first code

sudo add-apt-repository ‘deb
http://star-www.st-andrews.ac.uk/cran/bin/linux/ubuntu/trusty/’

its giving this error

Error: need a single repository as argument





--
View this message in context: 
http://r.789695.n4.nabble.com/Cant-upgrade-R-in-ubuntu-14-04-tp4710885.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.