[R] Tinn-R: new website under https protocol

2019-01-18 Thread Jose Claudio Faria
Dears,

The Tinn-R projetc has a new website under the https protocol:
https://nbcgib.uesc.br/tinnr/en/

Best,
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
Jose Claudio Faria
UESC/DCET/Brasil
joseclaudio.faria at gmail.com
Telefones:
55(73)3680.5545 - UESC
55(73)99966.9100 - VIVO
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\

If you have software to deal with statistics, you have arms;
if you have good software, you have arms and legs;
if you have software like R, you have arms, legs and wings...
the height of your flight depends only on you!

[[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] CRAN package NlcOptim query

2019-01-18 Thread Hans W Borchers
The maintainer of the *NlcOptim* package told me that he has fixed the
problem and already submitted a new version to CRAN. Thanks, XianYan,
for this prompt reaction.

__
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] A priori contrast for binomial GLM

2019-01-18 Thread Michael Dewey

Dear Rula

That is really a statistical question not one for this list but the 
answer is that the fact that they are all zero for that category 
explains it. Search on-line for separation for more details.


Michael

On 18/01/2019 09:56, Rula Domínguez wrote:

Hello to everyone,

after much reading I decided to write because I cannot find a solution to
my question.

I already did a priori contrasts before for a continuous variable with
normal distribution. Now I have another variable (burrow), which is
binomial, and I can do the GLM for it. But when I do the a priori
contrasts, it has no result in the cases where all data are 0 (is not that
there are no data, they are just all 0 in a category (treat 30-30), and I
want to compare this with others that have ones).
  Data sructure is like this:


head(burrow)

   date day treat psu  sp  burrow
13   0 30-30  36B  0
23   0 30-30  36B  0
33   0 15-30  36B  1
43   0 15-30  36B  1
53   0 15-30  36B  1
63   0 10-25  36B  1

My model is this:

model4B2<-glm(burrow~ treat, family=binomial(link="logit"), data=D4B)


And I did the contrast like this:


require(multcomp)

#Test contrastes 30 vs all (there are 4 categories to compare)
k3010R1<-matrix(c(3,-1,-1,-1),1)
k3010R1
t3010<-glht(model4B3.2,linfct=k3010R1)
summary(t3010)

But is not working and I am sure it should work.

Could it be because my explanatory variable is cathegorical?
Or is just not possible to do contrasts for binomial when you have all 0 in
some cathegory?

Thank you in advance,



--
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] importing data error question

2019-01-18 Thread Fox, John
Dear Jihee,

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of ???
> Sent: Wednesday, January 16, 2019 7:02 PM
> To: Fox, John 
> Cc: r-help@r-project.org
> Subject: Re: [R] importing data error question
> 
> Thanks for your help!
> 
> I was having trouble with finding how to use english...
> 
> Even though I try to use english language, I couldn't change language of R
> commander. (it is still korean)
> 
> Sorry but.. do you know how to change language of "R commander"? I have
> no idea why it doesn't change.

But the screenshots you sent in previous messages *did* show the Rcmdr in 
English, so you apparently successfully changed the language, I assume via the 
command Sys.setenv(LANGUAGE="en") that I suggested.

John

> 
> Best,
> 
> Jihee
> 
> From:  "Fox, John" 
> 
> Sent: Thursday, January 17, 2019 1:59:03 AM
> 
> To:"우지희" 
> 
> Cc:"r-help@r-project.org" 
> 
> Subject:Re: [R] importing data error question
> 
>   Dear jihee,
> 
>  I've looked into this problem further, using my Mac where it's easier to
> temporarily change languages and character sets than on Windows, and I
> discovered the following:
> 
>  I was able to duplicate your problem with importing Excel files when working
> in Korean. There's a similar problem with the import SAS b7dat files but not
> with the other file-import dialogs.
> 
>  I observed a similar problem when working in Chinese (LANG="zh") but not in
> simplified Chinese (zh_CN) or Japanese (ja), so the problem isn't simply with
> non-Latin character sets. There is no problem in English, Spanish (es), or
> French (fr), and I didn't check the other languages into which the Rcmdr is
> translated.
> 
>  I think that the problem originates in the Korean and Chinese translation 
> files
> and I'll contact the translators to see whether they can fix it.
> 
>  Thank you for reporting this issue.
> 
>  John
> 
>  > On Jan 14, 2019, at 11:36 PM, Fox, John  wrote:
>  >
>  > Dear jihee,
>  >
>  >> On Jan 14, 2019, at 9:00 PM, 우지희  wrote:
>  >>
>  >> You said previously that you were using a Mac, so I'm surprised that you
> now say that you're using Windows. I don't have a Windows 7 system, but I
> can confirm that importing from Excel files works perfectly fine under
> Windows 10, as I just verified, and I'd be surprised if the Windows version
> matters.
>  >>
>  >> --> no, I never said i was using a Mac.
>  >
>  > Sorry, I guess I got that from the error message you originally reported,
> which was "Error in structure(.External(.C_dotTclObjv, objv), class = 
> "tclObj") :
> [tcl] bad Macintosh file type "“*”"." I've never seen that error and it seems
> peculiar that it would occur on a Windows system.
>  >
>  >>
>  >> You still haven't reported the versions of R, the Rcmdr package, and the
> other packages that you're using. The easiest way to do this is to show the
> output of the sessionInfo() command.
>  >>
>  >> --> sessionInfo()
>  >> R version 3.5.2 (2018-12-20)
>  >> Platform: x86_64-w64-mingw32/x64 (64-bit)  >> Running under: Windows
> 7 x64 (build 7601) Service Pack 1  >>  >> Matrix products: default  >>  >>
> locale:
>  >> [1] LC_COLLATE=Korean_Korea.949 LC_CTYPE=Korean_Korea.949  >> [3]
> LC_MONETARY=Korean_Korea.949 LC_NUMERIC=C  >> [5]
> LC_TIME=Korean_Korea.949  >>  >> attached base packages:
>  >> [1] tcltk splines stats graphics grDevices utils datasets methods  >> [9] 
> base
> >>  >> other attached packages:
>  >> [1] RcmdrPlugin.SensoMineR_1.11-01 RcmdrPlugin.FactoMineR_1.6-0  >>
> [3] Rcmdr_2.5-1 effects_4.1-0  >> [5] RcmdrMisc_2.5-1 sandwich_2.5-0  >> [7]
> car_3.0-2 carData_3.0-2  >> [9] SensoMineR_1.23 FactoMineR_1.41  >>  >>
> loaded via a namespace (and not attached):
>  >> [1] gtools_3.8.1 Formula_1.2-3 latticeExtra_0.6-28  >> [4] 
> cellranger_1.1.0
> pillar_1.3.1 backports_1.1.3  >> [7] lattice_0.20-38 digest_0.6.18
> RColorBrewer_1.1-2  >> [10] checkmate_1.8.5 minqa_1.2.4 colorspace_1.3-2
> >> [13] survey_3.35 htmltools_0.3.6 Matrix_1.2-15  >> [16] plyr_1.8.4
> pkgconfig_2.0.2 haven_2.0.0  >> [19] scales_1.0.0 openxlsx_4.1.0 rio_0.5.16
> >> [22] lme4_1.1-19 htmlTable_1.13.1 tibble_1.4.2  >> [25] relimp_1.0-5
> ggplot2_3.1.0 nnet_7.3-12  >> [28] lazyeval_0.2.1 survival_2.43-3 magrittr_1.5
> >> [31] crayon_1.3.4 readxl_1.2.0 nlme_3.1-137  >> [34] MASS_7.3-51.1
> forcats_0.3.0 foreign_0.8-71  >> [37] class_7.3-14 tools_3.5.2
> data.table_1.11.8  >> [40] hms_0.4.2 tcltk2_1.2-11 stringr_1.3.1  >> [43]
> munsell_0.5.0 cluster_2.0.7-1 zip_1.0.0  >> [46] flashClust_1.01-2
> compiler_3.5.2 e1071_1.7-0  >> [49] rlang_0.3.1 grid_3.5.2 nloptr_1.2.1  >>
> [52] rstudioapi_0.9.0 htmlwidgets_1.3 leaps_3.0  >> [55] base64enc_0.1-3
> gtable_0.2.0 abind_1.4-5  >> [58] curl_3.2 reshape2_1.4.3 AlgDesign_1.1-7.3
> >> [61] gridExtra_2.3 zoo_1.8-4 knitr_1.21  >> [64] nortest_1.0-4 Hmisc_4.1-1
> KernSmooth_2.23-15  >> [67] stringi_1.2.4 Rcpp_1.0.0 rpart_4.1-13  >> [70]
> acepack_1.4.1 scatterplot3d_0.3-41 xfun_0.4  >>  >> This was the 

Re: [R] Printing a list of simultaneous equations

2019-01-18 Thread Sorkin, John
Steve,

Thank you,

John


John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric 
Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)




From: S Ellison 
Sent: Friday, January 18, 2019 9:52 AM
To: Sorkin, John; r-help@r-project.org
Subject: RE: Printing a list of simultaneous equations

You can drop the quote marks by calling print() explicitly with quote=FALSE, by 
using as.data.frame round your cbind, or - perhaps best - by constructing your 
output matrix as a data frame in the first place.  (print.data.frame defaults 
to quote=FALSE). And if you suppress name checking in a data.frame call you can 
get away with a space for variable names:

a  <- data.frame(y=c(c(0.5,4.0)), " "="=",x=c(1,2), z=c(2,3),
row.names=sprintf("eq%d", 1:2), check.names=FALSE)

a


Steve E



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

__
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] I can't get seq to behave how I think it should

2019-01-18 Thread Martin Maechler
> PIKAL Petr 
> on Thu, 17 Jan 2019 13:52:39 + writes:

> Hi
> Or you could use rounding.

yes.

> which(round(lut, 3)==1.8)
> [1] 401

no!   This may work accidentally here, but in principle still
suffers for the same reasons as
the infamous FAQ 7.31 "Why doesn’t R think these numbers are equal?"
(link below) gives.

To be sure you should round to *integer*s (or other multiples of
2 ^{-k}, k \in {0,1,...,31}).

1.8 is not exactly representable as a (double precision)
floating point number in binary representation.
Your example here works because the rounding typically happens
to end up with the same binary repr ... this all relies on too
many details to be recommendable.

Martin Maechler
ETH Zurich and R Core team


>> -Original Message-
>> From: R-help  On Behalf Of Ben Tupper
>> Sent: Thursday, January 17, 2019 2:43 PM
>> To: POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS
>> FOUNDATION TRUST) 
>> Cc: r-help@r-project.org
>> Subject: Re: [R] I can't get seq to behave how I think it should
>> 
>> Hi,
>> 
>> This looks like a floating point reality bump - see
>> 
>> https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-
>> these-numbers-are-equal_003f > FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f>
>> 
>> You can use other methods to finding your row - I would opt for 
findInterval()
>> 
>> > lut = seq(1.4, 2.1, by=0.001)
>> > findInterval(1.8, lut)
>> [1] 401
>> 
>> findInterval() uses a rapid search to find the index in the look up 
table (lut) that
>> is just less than  or equal to the search value (in your example 1.8).
>> 
>> Cheers,
>> Ben
>> 
>> > On Jan 17, 2019, at 8:33 AM, POLWART, Calum (COUNTY DURHAM AND
>> DARLINGTON NHS FOUNDATION TRUST) via R-help 
>> wrote:
>> >
>> > I am using seq with the expression seq(1.4, 2.1, by=0.001) to create a
>> > sequence of references from 1.4 to 2.1 in 0.001 increments.  They
>> > appear to be created correctly.  They have a related pair of data
>> > which for the purposes of this we will call val.  I'm interested in
>> > the content on the row with seq = 1.8. But I can't seem to get it
>> > returned.  I can get other values but not 1.8!  yet looking at row 401
>> > there is nothing to indicate an issue
>> >
>> >> a = 1.4
>> >> b = 2.1
>> >> seq = seq(a, b, by=0.001)
>> >> val = ceiling(seq * 50)
>> >> s=data.frame(seq, val)
>> >> s$val[seq==1.799]
>> > [1] 90
>> >> s$val[s$seq==1.8]
>> > numeric(0)
>> >> s$val[seq==1.8]
>> > numeric(0)
>> >> s$val[s$seq==1.800]
>> > numeric(0)
>> >> s$val[s$seq==1.801]
>> > [1] 91
>> >> head(s[s$seq>1.798,])
>> >  seq val
>> > 400 1.799  90
>> > 401 1.800  90
>> > 402 1.801  91
>> > 403 1.802  91
>> > 404 1.803  91
>> > 405 1.804  91
>> >
>> >
>> > Can anyone explain what's going on here and how I would correctly find 
the
>> content of row 401 by using an expression to equal the seq column?
>> >
>> >
>> >
>> >
>> >
>> >
>> ***
>> ***
>> > **
>> >
>> > This message may contain confidential information. If
>> > ...{{dropped:25}}
>> 
>> __
>> 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.
> Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
partnerů PRECHEZA a.s. jsou zveřejněny na: 
https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
processing and protection of business partner’s personal data are available on 
website: https://www.precheza.cz/en/personal-data-protection-principles/
> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou 
důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení 
odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any 
documents attached to it may be confidential and are subject to the legally 
binding disclaimer: https://www.precheza.cz/en/01-disclaimer/

> __
> 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 mor

Re: [R] importing data error question

2019-01-18 Thread 우지희
Thanks for your help! 

I was having trouble with finding how to use english... 

Even though I try to use english language, I couldn't change language of R 
commander. (it is still korean) 

Sorry but.. do you know how to change language of "R commander"? I have no idea 
why it doesn't change. 

Best, 

Jihee 

From:  "Fox, John"  

Sent: Thursday, January 17, 2019 1:59:03 AM 

To:"우지희"  

Cc:"r-help@r-project.org"  

Subject:Re: [R] importing data error question 

  Dear jihee,

 I've looked into this problem further, using my Mac where it's easier to 
temporarily change languages and character sets than on Windows, and I 
discovered the following:

 I was able to duplicate your problem with importing Excel files when working 
in Korean. There's a similar problem with the import SAS b7dat files but not 
with the other file-import dialogs.

 I observed a similar problem when working in Chinese (LANG="zh") but not in 
simplified Chinese (zh_CN) or Japanese (ja), so the problem isn't simply with 
non-Latin character sets. There is no problem in English, Spanish (es), or 
French (fr), and I didn't check the other languages into which the Rcmdr is 
translated.

 I think that the problem originates in the Korean and Chinese translation 
files and I'll contact the translators to see whether they can fix it.

 Thank you for reporting this issue.

 John

 > On Jan 14, 2019, at 11:36 PM, Fox, John  wrote:
 > 
 > Dear jihee,
 > 
 >> On Jan 14, 2019, at 9:00 PM, 우지희  wrote:
 >> 
 >> You said previously that you were using a Mac, so I'm surprised that you 
 >> now say that you're using Windows. I don't have a Windows 7 system, but I 
 >> can confirm that importing from Excel files works perfectly fine under 
 >> Windows 10, as I just verified, and I'd be surprised if the Windows version 
 >> matters. 
 >> 
 >> --> no, I never said i was using a Mac. 
 > 
 > Sorry, I guess I got that from the error message you originally reported, 
 > which was "Error in structure(.External(.C_dotTclObjv, objv), class = 
 > "tclObj") : [tcl] bad Macintosh file type "“*”"." I've never seen that error 
 > and it seems peculiar that it would occur on a Windows system.
 > 
 >> 
 >> You still haven't reported the versions of R, the Rcmdr package, and the 
 >> other packages that you're using. The easiest way to do this is to show the 
 >> output of the sessionInfo() command. 
 >> 
 >> --> sessionInfo()
 >> R version 3.5.2 (2018-12-20)
 >> Platform: x86_64-w64-mingw32/x64 (64-bit)
 >> Running under: Windows 7 x64 (build 7601) Service Pack 1
 >> 
 >> Matrix products: default
 >> 
 >> locale:
 >> [1] LC_COLLATE=Korean_Korea.949 LC_CTYPE=Korean_Korea.949 
 >> [3] LC_MONETARY=Korean_Korea.949 LC_NUMERIC=C 
 >> [5] LC_TIME=Korean_Korea.949 
 >> 
 >> attached base packages:
 >> [1] tcltk splines stats graphics grDevices utils datasets methods 
 >> [9] base 
 >> 
 >> other attached packages:
 >> [1] RcmdrPlugin.SensoMineR_1.11-01 RcmdrPlugin.FactoMineR_1.6-0 
 >> [3] Rcmdr_2.5-1 effects_4.1-0 
 >> [5] RcmdrMisc_2.5-1 sandwich_2.5-0 
 >> [7] car_3.0-2 carData_3.0-2 
 >> [9] SensoMineR_1.23 FactoMineR_1.41 
 >> 
 >> loaded via a namespace (and not attached):
 >> [1] gtools_3.8.1 Formula_1.2-3 latticeExtra_0.6-28 
 >> [4] cellranger_1.1.0 pillar_1.3.1 backports_1.1.3 
 >> [7] lattice_0.20-38 digest_0.6.18 RColorBrewer_1.1-2 
 >> [10] checkmate_1.8.5 minqa_1.2.4 colorspace_1.3-2 
 >> [13] survey_3.35 htmltools_0.3.6 Matrix_1.2-15 
 >> [16] plyr_1.8.4 pkgconfig_2.0.2 haven_2.0.0 
 >> [19] scales_1.0.0 openxlsx_4.1.0 rio_0.5.16 
 >> [22] lme4_1.1-19 htmlTable_1.13.1 tibble_1.4.2 
 >> [25] relimp_1.0-5 ggplot2_3.1.0 nnet_7.3-12 
 >> [28] lazyeval_0.2.1 survival_2.43-3 magrittr_1.5 
 >> [31] crayon_1.3.4 readxl_1.2.0 nlme_3.1-137 
 >> [34] MASS_7.3-51.1 forcats_0.3.0 foreign_0.8-71 
 >> [37] class_7.3-14 tools_3.5.2 data.table_1.11.8 
 >> [40] hms_0.4.2 tcltk2_1.2-11 stringr_1.3.1 
 >> [43] munsell_0.5.0 cluster_2.0.7-1 zip_1.0.0 
 >> [46] flashClust_1.01-2 compiler_3.5.2 e1071_1.7-0 
 >> [49] rlang_0.3.1 grid_3.5.2 nloptr_1.2.1 
 >> [52] rstudioapi_0.9.0 htmlwidgets_1.3 leaps_3.0 
 >> [55] base64enc_0.1-3 gtable_0.2.0 abind_1.4-5 
 >> [58] curl_3.2 reshape2_1.4.3 AlgDesign_1.1-7.3 
 >> [61] gridExtra_2.3 zoo_1.8-4 knitr_1.21 
 >> [64] nortest_1.0-4 Hmisc_4.1-1 KernSmooth_2.23-15 
 >> [67] stringi_1.2.4 Rcpp_1.0.0 rpart_4.1-13 
 >> [70] acepack_1.4.1 scatterplot3d_0.3-41 xfun_0.4 
 >> 
 >> This was the status that I tried to import Excel data. 
 > 
 > These packages seem up-to-date.
 > 
 >> 
 >> Also, have you tried importing an Excel file in the Rcmdr *without* the two 
 >> plug-in packages loaded, as I suggested in my original response? 
 >> 
 >> --> I tried without plug-in packages, but It didn't work. 
 > 
 > OK, so you tried the setup that works for me and, I assume from the lack of 
 > similar error reports, for others.
 > 
 >> 
 >> It occurs to me that the problem may be produced by using the Rcmdr under R 
 >> with a non-Latin set, but if that wer

Re: [R] Printing a list of simultaneous equations

2019-01-18 Thread Jeff Newmiller
Don't use the default print method then. When you type an expression alone at 
the console it uses a print function to convert the result to characters for 
output. The default print method for matrices of character uses quotes to show 
the exact contents of each character string.

Convert the matrix to a single string using  paste for each line, then paste 
the lines together with newlines, then cat the string to the console. You will 
probably find that converting the individual elements into strings with uniform 
string length (using sprintf?) as you add them into the matrix makes the final 
output look better.

On January 18, 2019 4:02:09 AM PST, "Sorkin, John"  
wrote:
>I am trying to print a list of equations in an easily readable form. At
>this time all I can get is  a series of characters enclosed in
>quotation marks rather than equations with numbers and equal signs.
>What I get is
>
>
>y equalsigns x   z
>eq1 "0.5" "=""1" "2"
>eq2 "4"   "=""2" "3"
>
>
>When what I want is
>
>  y x   z
>
>eq1  0.5  =  1   2
>eq2  4.0  =  2   3
>
>
>I am enclosing my R code below:
>
># Create matrix of  coefficients of independent variables.
>a  <- matrix(c(1,2,2,3),nrow=c(2,2),byrow=TRUE)
>dimnames(a)<-list(c("eq1","eq2"),c("x","z"))
>cat("Matrix of independent variables\n")
>a
>
># Create vector of dependent variables.
>b <- matrix(c(0.5,4.0),nrow=c(2,1))
>
>dimnames(b)<-list(c("eq1","eq2"),c("y"))
>cat("Vector of dependent variables","\n")
>b
>
>cat("System of equations to be solved")
>equalsigns <- c("=","=")
>cbind(b,equalsigns,a)
>
>
>
>
>Thank you,
>
>John
>
>
>
>
>
>John David Sorkin M.D., Ph.D.
>Professor of Medicine
>Chief, Biostatistics and Informatics
>University of Maryland School of Medicine Division of Gerontology and
>Geriatric Medicine
>Baltimore VA Medical Center
>10 North Greene Street
>GRECC (BT/18/GR)
>Baltimore, MD 21201-1524
>(Phone) 410-605-7119
>(Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
>
>   [[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.

-- 
Sent from my phone. Please excuse my brevity.

__
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] Nested mixed effectts question

2019-01-18 Thread Caroline
Great! Your suggestions made perfect sense and worked well. Thank you so much. 

> On Jan 18, 2019, at 3:33 AM, Phillip Alday  wrote:
> 
> (once again with the list)
> 
> Hi Caroline,
> 
> This question is probably better suited to r-sig-mixed-models
> (https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models). Some things
> are hard to tell without better understanding your design (I am not an
> ecologist/relevant type of biologist), but I'll give it a go.
> 
> I suspect that your model is over-parameterized. It's very rare to see a
> factor occur both as a fixed effect and as a grouping variable (the
> stuff behind the | ) in the random effects.
> 
> If you don't care about particular sites but rather only the general
> pattern across sites, then I would start with the model:
> 
> wrack.biomass ~ year  + (1 + year | site/trans)
> 
> This treats site as a known source of variance, but not one that you
> care about estimating particular effects for. You can still extract
> predictions for them, i.e. the BLUPs, via coef(wrackbio), but their
> theoretical interpretation is a bit different than the other option below.
> 
> If you do care about particular sites, I would use the model
> 
> # if your transects are uniquely labeled across sites
> wrack.biomass ~ year * site + (1 | trans)
> # if the transect labels are only unique within sites
> wrack.biomass ~ year * site + (1 | sites:trans)
> 
> This will give you fixed effects as in your model, but models the
> transects as a source of repetition and hence variance due to that
> grouping. The choice of exact specification depends on the labeling in
> your dataset; the sites:trans just guarantees unique labelling. The
> random effect in this case would estimate the average variance across
> all sites due to transects.
> 
> Best,
> Phillip
> 
> 
> 
> 
> On 16/01/19 12:00, r-help-requ...@r-project.org wrote:
>> Send R-help mailing list submissions to
> 
>> Today's Topics:
>> 
>>   6. Nested mixed effectts question (Caroline)
>> --
>> Hi,
>> 
>> I am helping a friend with an analysis for a study where she sampled
> wrack biomass in 15 different sites across three years. At each site,
> she sampled from three different transects. She is trying to estimate
> the effect of year*site on biomass while accounting for the nested
> nature (site/transcet) and repeated measure study design.
>> 
>> wrack.biomass ~ year * site + (1 | site/trans)
>> 
>> However she gets the following warning messages:
>> Warning messages:
>> 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>>  unable to evaluate scaled gradient
>> 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>>   Hessian is numerically singular: parameters are not uniquely determined
>> 
>> And her model output is:
>> 
>>> summary(wrackbio)
>> Linear mixed model fit by REML
>> t-tests use  Satterthwaite approximations to degrees of freedom
> ['lmerMod']
>> Formula: (actual.mean.biomass.m2.50.m.transect) ~ year * site + (1 |
> site/trans)
>>   Data: wrack_resp_allyrs_transname
>> 
>> REML criterion at convergence: 691
>> 
>> Scaled residuals:
>>Min  1Q  Median  3Q Max
>> -3.3292 -0.2624 -0.0270  0.1681  3.8024
>> 
>> Random effects:
>> Groups NameVariance Std.Dev.
>> trans:site (Intercept)  0.  0.
>> site   (Intercept)  0.5531  0.7437
>> Residual   94.6453  9.7286
>> Number of obs: 132, groups:  trans:site, 44; site, 15
>> 
>> Fixed effects:
>>Estimate Std. Error df t value Pr(>|t|)
>> (Intercept)9.692e+00  5.666e+00  1.119e-04   1.7110.999
>> year2016   1.256e+01  7.943e+00  8.700e+01   1.5820.117
>> year2017   2.395e+00  7.943e+00  8.700e+01   0.3020.764
>> siteCL 5.672e+01  8.013e+00  1.119e-04   7.0790.999
>> siteDO-4.315e+00  8.013e+00  1.119e-04  -0.5390.999
>> siteFL 7.872e+00  8.013e+00  1.119e-04   0.9820.999
>> siteFS-7.619e+00  8.013e+00  1.119e-04  -0.9510.999
>> siteGH 4.369e+00  8.013e+00  1.119e-04   0.5450.999
>> siteLB-3.747e+00  8.013e+00  1.119e-04  -0.4680.999
>> siteLBP   -5.298e+00  8.943e+00  1.736e-04  -0.5920.999
>> siteNB-2.953e+00  8.013e+00  1.119e-04  -0.3691.000
>> siteNS 1.005e+00  8.013e+00  1.119e-04   0.1251.000
>> sitePC-5.238e+00  8.013e+00  1.119e-04  -0.6540.999
>> siteSB-7.649e+00  8.013e+00  1.119e-04  -0.9550.999
>> siteSILT  -4.734e+00  8.013e+00  1.119e-04  -0.5910.999
>> siteSL-7.890e+00  8.013e+00  1.119e-04  -0.9850.999
>> siteUD-8.230e+00  8.013e+00  1.119e-04  -1.0270.999
>> year2016:siteCL   -6.359e+01  1.123e+01  8.700e+01  -5.660 1.91e-07 ***
>> year2017:siteCL   -5.210e+01  1.123e+01  8.700e+01  -4.638 1.23e-05 ***
>> year2016:sit

Re: [R] Printing a list of simultaneous equations

2019-01-18 Thread S Ellison
You can drop the quote marks by calling print() explicitly with quote=FALSE, by 
using as.data.frame round your cbind, or - perhaps best - by constructing your 
output matrix as a data frame in the first place.  (print.data.frame defaults 
to quote=FALSE). And if you suppress name checking in a data.frame call you can 
get away with a space for variable names:

a  <- data.frame(y=c(c(0.5,4.0)), " "="=",x=c(1,2), z=c(2,3),  
row.names=sprintf("eq%d", 1:2), check.names=FALSE)

a


Steve E



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

__
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] importing data error question

2019-01-18 Thread Fox, John
Dear Jihee,

> On Jan 17, 2019, at 7:00 PM, 우지희  wrote:
> 
> Dear John,
>  
> (1) I noticed that you loaded the FactoMineR and SensoMineR plug-ins. Try 
> again without loading these plug-ins.
> not worked :(
>  
> 

OK. I don't understand why that doesn't work. There is likely some peculiarity 
in your system, but I have no idea what it is, and I can't think what else I 
might do without access to your computer.

>  
>  
> (2) Download and try reading the plain-text data file from 
> , 
> using "Data > Import data > From text file, clipboard, or URL"; you can take 
> all of the defaults in the resulting dialog box.
>  
> I think importing is working but I can't view data set. it says ERROR: DATA 
> FRAME TOO WIDE
>  
> 

You tried to read the Excel file Prestige.xlsx as if it were a plain-text file, 
which produces nonsense. This was my fault: I sent the wrong link; the correct 
file is at 
.

Best,
 John

>  
>  
>  
> I have no idea neither. ;(
> I might give up from now,,
>  
>  
> Thanks again!
>  
> Best,
> Jihee
>  
>  
>  
> From: "Fox, John" 
> Sent: Friday, January 18, 2019 12:02:42 AM
> To:"우지희" 
> Cc:"" 
> Subject:Re: [R] importing data error question
>  
>  
> Dear Jihee,
> 
> Your latest attempt has gotten farther than the previous one but has produced 
> a different error. The command to read the data set was generated properly. 
> You can see whether the data set was in fact read by typing prestige (the 
> name you gave to the data set) at the > command prompt in the R console. 
> Assuming that the data set was read, an error occurred when the Rcmdr tried 
> to make it the active data set. I'm afraid that I don't understand how this 
> could happen because this procedure works correctly for me and for others. 
> The underlying code is invoked whenever the Rcmdr reads a dara set.
> 
> I suggest that you try two additional things:
> 
> (1) I noticed that you loaded the FactoMineR and SensoMineR plug-ins. Try 
> again without loading these plug-ins.
> 
> (2) Download and try reading the plain-text data file from 
> , 
> using "Data > Import data > From text file, clipboard, or URL"; you can take 
> all of the defaults in the resulting dialog box.
> 
> If neither of these works then I'm afraid that I'm out of ideas. There's 
> something peculiar about your R installation that I can't detect.
> 
> Best,
> John
> 
> 
> 
> > On Jan 17, 2019, at 12:24 AM, 우지희  wrote:
> > 
> > Dear John,
> >  
> > I tried with your file. R commander could read the file but there's still 
> > no active dataset
> >  
> > Anyway I'll send my file, too
> >  
> > Jihee
> >  
> > <528c421a382d426895f6446b32fbc6f0.png>
> >  
> > From: "Fox, John" 
> > Sent: Thursday, January 17, 2019 2:09:52 PM
> > To:"우지희" 
> > Cc:"" 
> > Subject:Re: [R] importing data error question
> >  
> >  
> > Dear Jihee,
> > 
> > This appears to be a different problem. You were apparently able to access 
> > the spreadsheet file, but the R Commander didn't find a suitable worksheet 
> > in it.
> > 
> > Try downloading and reading the file at 
> > . If 
> > that works, send me privately (i.e., directly) your Excel spreadsheet file 
> > and I'll take a look at it.
> > 
> > Best,
> > John
> > 
> > > On Jan 16, 2019, at 9:49 PM, 우지희  wrote:
> > > 
> > > Dear John,
> > >  
> > > now i can use english thank you very much!!
> > >  
> > > um.. but nothing's changed... with that {r} message at R Markdown.
> > >  
> > > There's no dataset.
> > >  
> > > i tried both .xls and .xlsx .
> > >  
> > >  
> > > Jihee
> > >  
> > >  
> > >  
> > > 
> > >  
> > >  
> > >  
> > > From: "Fox, John" 
> > > Sent: Thursday, January 17, 2019 10:59:44 AM
> > > To:"우지희" 
> > > Cc:"" 
> > > Subject:Re: [R] importing data error question
> > >  
> > >  
> > > Dear Jihee,
> > > 
> > > Probably the easiest way to change the language to English temporarily in 
> > > R is to enter the command
> > > 
> > > Sys.setenv(LANGUAGE="en")
> > > 
> > > at the R command prompt prior to loading the Rcmdr package.
> > > 
> > > I hope that this helps,
> > > John
> > > 
> > > 
> > > > On Jan 16, 2019, at 7:02 PM, 우지희  wrote:
> > > > 
> > > > Thanks for your help!
> > > >  
> > > > I was having trouble with finding how to use english...
> > > >  
> > > > Even though I try to use english language, I couldn't change language 
> > > > of R commander. (it is still korean)
> > > >  
> > > > Sorry but.. do you know how to change language of "R commander"? I have 
> > > > no idea why it doesn't change.
> > > >  
> > > > Best,
> > > > Jihee
> > > >  
> > > > From: "Fox, John" 
> > > > Sent: Thursday, January 17, 2019 1:59:03 AM
> > > > To:"우지희" 
> > > > Cc:"r-help@r-project.org" 
> > > > Subject:Re: [R] importing data 

[R] A priori contrast for binomial GLM

2019-01-18 Thread Rula Domínguez
Hello to everyone,

after much reading I decided to write because I cannot find a solution to
my question.

I already did a priori contrasts before for a continuous variable with
normal distribution. Now I have another variable (burrow), which is
binomial, and I can do the GLM for it. But when I do the a priori
contrasts, it has no result in the cases where all data are 0 (is not that
there are no data, they are just all 0 in a category (treat 30-30), and I
want to compare this with others that have ones).
 Data sructure is like this:

>head(burrow)
  date day treat psu  sp  burrow
13   0 30-30  36B  0
23   0 30-30  36B  0
33   0 15-30  36B  1
43   0 15-30  36B  1
53   0 15-30  36B  1
63   0 10-25  36B  1

My model is this:
>model4B2<-glm(burrow~ treat, family=binomial(link="logit"), data=D4B)

And I did the contrast like this:

>require(multcomp)
#Test contrastes 30 vs all (there are 4 categories to compare)
k3010R1<-matrix(c(3,-1,-1,-1),1)
k3010R1
t3010<-glht(model4B3.2,linfct=k3010R1)
summary(t3010)

But is not working and I am sure it should work.

Could it be because my explanatory variable is cathegorical?
Or is just not possible to do contrasts for binomial when you have all 0 in
some cathegory?

Thank you in advance,

-- 
Rula Domínguez Fernández
PhD Student
*Departamento de Ecoloxía e Bioloxía Animal*
*Faculdade de Ciencias do Mar*
*Universidade de Vigo*

www.researchgate.net/profile/Rula_Dominguez

EcoCost

Móvil: +34 646521205

[[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] Printing a list of simultaneous equations

2019-01-18 Thread Sorkin, John
I am trying to print a list of equations in an easily readable form. At this 
time all I can get is  a series of characters enclosed in quotation marks 
rather than equations with numbers and equal signs. What I get is


y equalsigns x   z
eq1 "0.5" "=""1" "2"
eq2 "4"   "=""2" "3"


When what I want is

  y x   z

eq1  0.5  =  1   2
eq2  4.0  =  2   3


I am enclosing my R code below:

# Create matrix of  coefficients of independent variables.
a  <- matrix(c(1,2,2,3),nrow=c(2,2),byrow=TRUE)
dimnames(a)<-list(c("eq1","eq2"),c("x","z"))
cat("Matrix of independent variables\n")
a

# Create vector of dependent variables.
b <- matrix(c(0.5,4.0),nrow=c(2,1))

dimnames(b)<-list(c("eq1","eq2"),c("y"))
cat("Vector of dependent variables","\n")
b

cat("System of equations to be solved")
equalsigns <- c("=","=")
cbind(b,equalsigns,a)




Thank you,

John





John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric 
Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)


[[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] Colors on box plots in ggplot

2019-01-18 Thread S Ellison



> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David
> I'm trying to set different boxes to different colors the following page
> shows


> http://www.sthda.com/english/wiki/ggplot2-box-plot-quick-start-guide-r-
> software-and-data-visualization
> 
> 
> I've tried the code
> ToothGrowth$dose <- as.factor(ToothGrowth$dose)
> head(ToothGrowth)
> library(ggplot2)
> # Basic box plot
> p <- ggplot(ToothGrowth, aes(x=dose, y=len))  +
>   geom_boxplot()
> p+scale_color_manual(values=c("#99", "#E69F00", "#56B4E9"))
> p

You have not mapped an aesthetic to colour, so the scale (which applies to an 
aesthetic) is not being used at all.

Try
( p <- ggplot(ToothGrowth, aes(x=dose, y=len))  + 
geom_boxplot(aes(colour=dose)) )

which uses default colours. Once you have an aes  mapping you can change the 
scale, so 
 ( p + scale_colour_manual(values = c("red", "blue", "green")) )

gives you the colour ordering you want.

( p + scale_colour_manual(values = c("red", "blue", "green"), guide=FALSE) )
also removes the redundant colour key.



S Ellison



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

__
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] Nested mixed effectts question

2019-01-18 Thread Phillip Alday
(once again with the list)

Hi Caroline,

This question is probably better suited to r-sig-mixed-models
(https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models). Some things
are hard to tell without better understanding your design (I am not an
ecologist/relevant type of biologist), but I'll give it a go.

I suspect that your model is over-parameterized. It's very rare to see a
factor occur both as a fixed effect and as a grouping variable (the
stuff behind the | ) in the random effects.

If you don't care about particular sites but rather only the general
pattern across sites, then I would start with the model:

wrack.biomass ~ year  + (1 + year | site/trans)

This treats site as a known source of variance, but not one that you
care about estimating particular effects for. You can still extract
predictions for them, i.e. the BLUPs, via coef(wrackbio), but their
theoretical interpretation is a bit different than the other option below.

If you do care about particular sites, I would use the model

# if your transects are uniquely labeled across sites
wrack.biomass ~ year * site + (1 | trans)
# if the transect labels are only unique within sites
wrack.biomass ~ year * site + (1 | sites:trans)

This will give you fixed effects as in your model, but models the
transects as a source of repetition and hence variance due to that
grouping. The choice of exact specification depends on the labeling in
your dataset; the sites:trans just guarantees unique labelling. The
random effect in this case would estimate the average variance across
all sites due to transects.

Best,
Phillip




On 16/01/19 12:00, r-help-requ...@r-project.org wrote:
> Send R-help mailing list submissions to

> Today's Topics:
>
>6. Nested mixed effectts question (Caroline)
> --
> Hi,
>
> I am helping a friend with an analysis for a study where she sampled
wrack biomass in 15 different sites across three years. At each site,
she sampled from three different transects. She is trying to estimate
the effect of year*site on biomass while accounting for the nested
nature (site/transcet) and repeated measure study design.
>
> wrack.biomass ~ year * site + (1 | site/trans)
>
> However she gets the following warning messages:
> Warning messages:
> 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>   unable to evaluate scaled gradient
> 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>Hessian is numerically singular: parameters are not uniquely determined
>
> And her model output is:
>
>> summary(wrackbio)
> Linear mixed model fit by REML
> t-tests use  Satterthwaite approximations to degrees of freedom
['lmerMod']
> Formula: (actual.mean.biomass.m2.50.m.transect) ~ year * site + (1 |
site/trans)
>Data: wrack_resp_allyrs_transname
>
> REML criterion at convergence: 691
>
> Scaled residuals:
> Min  1Q  Median  3Q Max
> -3.3292 -0.2624 -0.0270  0.1681  3.8024
>
> Random effects:
>  Groups NameVariance Std.Dev.
>  trans:site (Intercept)  0.  0.
>  site   (Intercept)  0.5531  0.7437
>  Residual   94.6453  9.7286
> Number of obs: 132, groups:  trans:site, 44; site, 15
>
> Fixed effects:
> Estimate Std. Error df t value Pr(>|t|)
> (Intercept)9.692e+00  5.666e+00  1.119e-04   1.7110.999
> year2016   1.256e+01  7.943e+00  8.700e+01   1.5820.117
> year2017   2.395e+00  7.943e+00  8.700e+01   0.3020.764
> siteCL 5.672e+01  8.013e+00  1.119e-04   7.0790.999
> siteDO-4.315e+00  8.013e+00  1.119e-04  -0.5390.999
> siteFL 7.872e+00  8.013e+00  1.119e-04   0.9820.999
> siteFS-7.619e+00  8.013e+00  1.119e-04  -0.9510.999
> siteGH 4.369e+00  8.013e+00  1.119e-04   0.5450.999
> siteLB-3.747e+00  8.013e+00  1.119e-04  -0.4680.999
> siteLBP   -5.298e+00  8.943e+00  1.736e-04  -0.5920.999
> siteNB-2.953e+00  8.013e+00  1.119e-04  -0.3691.000
> siteNS 1.005e+00  8.013e+00  1.119e-04   0.1251.000
> sitePC-5.238e+00  8.013e+00  1.119e-04  -0.6540.999
> siteSB-7.649e+00  8.013e+00  1.119e-04  -0.9550.999
> siteSILT  -4.734e+00  8.013e+00  1.119e-04  -0.5910.999
> siteSL-7.890e+00  8.013e+00  1.119e-04  -0.9850.999
> siteUD-8.230e+00  8.013e+00  1.119e-04  -1.0270.999
> year2016:siteCL   -6.359e+01  1.123e+01  8.700e+01  -5.660 1.91e-07 ***
> year2017:siteCL   -5.210e+01  1.123e+01  8.700e+01  -4.638 1.23e-05 ***
> year2016:siteDO   -1.550e+01  1.123e+01  8.700e+01  -1.3800.171
> year2017:siteDO   -3.022e+00  1.123e+01  8.700e+01  -0.2690.789
> year2016:siteFL   -7.522e+00  1.123e+01  8.700e+01  -0.6700.505
> year2017:siteFL   -1.167e+01  1.123e+01  8.700e+01  -1.0390.302
> year2016:siteFS   -1.391e+01  1.