[R] “Error in if (abs(x - oldx) ftol)” when using “lognormal” distribution in mixed logit

2015-07-23 Thread Dera
Hi, I have a question about how to use the mlogit package in R to do analysis
of discrete choice survey data. Our survey is about asking people to choose
from different insurance policies(with two attributes of deductible and
premium).

The code I used to fit mixed logit is:


[1] ml - mlogit.data (mydata, choice=choice, shape = wide, id =
individual, 
   opposite =c ('deductible', 'premium'),varying = 5:10)

[2] ml.w5 - mlogit (choice~deductible+premium|0, ml, panel = TRUE, 
 rpar = c(deductible='ln', premium='ln'), 
 R = 100, halton = NA, print.level=0)

I try to use lognormal because we hope the coefficients for both deductible
and premium are negative. And I use opposite in [1] to reverse the sign
because lognormal is always positive.

But I always get the error warning:

Error in if (abs(x - oldx)  ftol) { : missing value where TRUE/FALSE
needed
In addition: Warning message: In log(start[ln]) : NaNs produced
I double check the data and am sure there isn't any missing data. And if I
change the lognormal ln to n or cn, it will work without any warning.

Does anyone know how to deal with this? Thank you for your help.



--
View this message in context: 
http://r.789695.n4.nabble.com/Error-in-if-abs-x-oldx-ftol-when-using-lognormal-distribution-in-mixed-logit-tp4710284.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] shift by one column given rows in a dataframe

2015-07-23 Thread Sarah Goslee
On Thu, Jul 23, 2015 at 3:56 PM, maxbre mbres...@arpa.veneto.it wrote:
 Hi

 thank you for your reply: it's a neat solution but unfortunately not
 applicable to my specific case;

I'm going to assume you're replying to me, although there's no context
whatsoever in your response (this is the R-help email list, not
Nabble).

 in fact as I specified in my first post (I may have been not enough clear,
 sorry for that!) I can not rely on any search method grep-like because the
 value xxx in the rows of df_start can be anything (string or numeric and
 always different) so that I necessarely need to apply by row index position
 (i.e. in my reproducible example rows: 2, 3, 5);

Then how do you know which positions? Do you have another R object
that specifies row and column number? Or do you guess? I can easily
remove a random element from each row... If you aren't removing based
on value, then you didn't provide a reproducible example after all,
and you need to supply the index for removal.

Always different? Different within a single data frame? Different
between data frames? (Then you can simply change xxx to whatever.)
Is telepathy required? Or perhaps precognition?

 thank you again for your kind help but still searching for a solution...

 best

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

__
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] shift by one column given rows in a dataframe

2015-07-23 Thread Marissa Fahlberg
Turns out my column and row names were too long to fit in the console and
when I widened the window the table didn't automatically adjust and widen
as well. I had to widen the console first and then retype the same command
so it fit. Silly mistake. I usually keep the console pretty narrow on my
laptop and never considered that would change the format.

Thanks for all the help - I'm sure I'll be back again very soon with more
questions!!
On Jul 23, 2015 4:53 PM, Bert Gunter bgunter.4...@gmail.com wrote:

 Oops, Bill's reply and mine crossed in the email. His is essentially
 the same as mine except probably more efficient.


 -- Bert
 Bert Gunter

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


 On Thu, Jul 23, 2015 at 2:44 PM, William Dunlap wdun...@tibco.com wrote:
  You could do something like the following
 rowsToShiftLeft - c(2,4,5) # 4, not the 3 that was in the original
 post
 mat - as.matrix(df_start)
 mat[rowsToShiftLeft, 1:3] - mat[rowsToShiftLeft, 2:4]
 result - data.frame(mat[, 1:3], stringsAsFactors=FALSE)
 str(result)
'data.frame':   5 obs. of  3 variables:
 $ v0: chr  a b c d ...
 $ v1: chr  1 2 3 4 ...
 $ v2: chr  6 7 8 9 ...
  You will then have to convert the columns which ought to be numeric
  to numeric.  (All the columns in df_start were factors because of the
  extra xxx that offset some of them.)
 
 
  Bill Dunlap
  TIBCO Software
  wdunlap tibco.com
 
  On Thu, Jul 23, 2015 at 1:19 PM, maxbre mbres...@arpa.veneto.it wrote:
 
  sorry but honestly I do not get your point
 
  I need to shift to left by one position (i.e. one column) the entire
 rows
  2,4,5 of df_start so that to obtain as final result the structure
  indicated in df_end
 
  I know in advance the rows that I need to shift
 
  hope it clears a bit, now
 
 
 
 
  --
  View this message in context:
 
 http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710276.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-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] interactive Map: Popups

2015-07-23 Thread daniel
Marie-Louise,

As long sa I know you have to gie googleVis the ISO code for provinces.

GR - data.frame( ISO = c(DE-BW,
DE-BY,
DE-BE,
DE-BB,
DE-HB,
DE-HH,
DE-HE,
DE-MV,
DE-NI,
DE-NW,
DE-RP,
DE-SL,
DE-SN,
DE-ST,
DE-SH,
DE-TH),
name = c(Baden-Württemberg,
Bayern,
Berlin,
Brandenburg,
Bremen,
Hamburg,
Hessen,
Mecklenburg-Vorpommern,
Niedersachsen,
Nordrhein-Westfalen,
Rheinland-Pfalz,
Saarland,
Sachsen,
Sachsen-Anhalt,
Schleswig-Holstein,
Thüringen), value = 1:16)

G3 - gvisGeoMap(GR, locationvar='ISO',
numvar='value', options=list(region=DE,
displayMode=regions, resolution=provinces,))
plot(G3)

Daniel Merino


2015-07-23 17:00 GMT-03:00 Erich Neuwirth erich.neuwi...@univie.ac.at:

 Some shapefiles for Germany can be found here

 http://www.statsilk.com/maps/download-free-shapefile-maps 
 http://www.statsilk.com/maps/download-free-shapefile-maps

  On Jul 23, 2015, at 21:36, Erin Hodgess erinm.hodg...@gmail.com wrote:
 
  Hello Erich:
 
  I just looked at your leaflet package and its examples.  It is awesome!
 
  Thanks,
  Erin
 
 
  On Thu, Jul 23, 2015 at 6:28 AM, Erich Neuwirth 
 erich.neuwi...@univie.ac.at mailto:erich.neuwi...@univie.ac.at wrote:
  I am quite happy with that package leaflet which is not yet on CRAN
  but available on Githib.
 
  https://github.com/rstudio/leaflet https://github.com/rstudio/leaflet
 https://github.com/rstudio/leaflet https://github.com/rstudio/leaflet
 
 
  __
  R-help@r-project.org mailto:R-help@r-project.org mailing list -- To
 UNSUBSCRIBE and more, see
  https://stat.ethz.ch/mailman/listinfo/r-help 
 https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html 
 http://www.r-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
  --
  Erin Hodgess
  Associate Professor
  Department of Mathematical and Statistics
  University of Houston - Downtown
  mailto: erinm.hodg...@gmail.com mailto:erinm.hodg...@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.




-- 
Daniel

[[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-es] Fw: web RSelenium

2015-07-23 Thread javier.ruben.marcuzzi
Estimados


Pude encontrar uno de mis errores, el cuál está en el XPath, en rvest funciona 
y comparto el código, pero por alguna causa solucionando el XPath RSelenium 
falla informando el mismo error.


library(rvest)
# Cargo la página
Pagina.R - html(x = http://www.r-project.org;)
## mirar bien los XPath- los modifico, quitar el [1], no me interesa el 
primero, quiero todos
#   /html/body/div/div[1]/div[1]/div/div[1]/ul/li[1]
#   /html/body/div/div[1]/div[1]/div/div[1]/ul/li[1]/a


# tomar link URLs
urls - Pagina.R %% # desde Pagina.R realizar el siguiente paso
  html_nodes(xpath='/html/body/div/div[1]/div[1]/div/div[1]/ul/li/a') %%
  html_attr(href) # extraer URLs
# Get link text
links - Pagina.R %% # desde Pagina.R realizar el siguiente paso
  html_nodes(xpath='/html/body/div/div[1]/div[1]/div/div[1]/ul/li') %%
  html_text() # extraer link texto
# Combinar `links` y `urls` en un data.frame
Resultado - data.frame(links = links, urls = urls, stringsAsFactors = FALSE)
Resultado






Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario





De: Javier Ruben Marcuzzi
Enviado el: ‎miércoles‎, ‎22‎ de ‎julio‎ de ‎2015 ‎11‎:‎56‎ ‎p.m.
Para: R-help-es@r-project.org





Estimados, les envío un código, el cuál me da error, aunque dudo si está 
escrito correctamente puesto que muchos ejemplos me están fallando.




Agradezco si alguno me informa un error al igual que el informado por mi 
computadora, no creo que el inconveniente sea por la opción de R que instalé en 
Windows 8.1, ya me perdí buscando mi error.




Revolution R Open 8.0.3
Using CRAN snapshot taken on 2015-04-01







library(RSelenium)
checkForServer()
startServer()





remDr - remoteDriver()
remDr$open()
remDr$navigate(http://www.r-project.org;)




webElems - remDr$findElement(using = 'css selector',  body  div  div.row  
div.col-xs-12.col-sm-offset-1.col-sm-2.sidebar  div  div:nth-child(1)  ul)




resHeaders - unlist(lapply(webElems, function(x){x$getElementText()}))

#Error in x$getElementText : object of type 'closure' is not subsettable







Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] R: Re: Differences in output of lme() when introducing interactions

2015-07-23 Thread John Maindonald
Do you have legal advice that suing the University (if that is the right 
context)
would actually be a fruitful way forwards, that it would achieve anything
useful within reasonable time and without causing the student severe
financial risk?

What may work in that context is for students to collectively complain that
important aspects of their training and support are being neglected.
With the rapidity of recent technological change, the issue is widespread.
To an extent, able post-docs and PhDs have to lead the charge in getting
training and support updated and brought into the modern world.


John Maindonald email: 
john.maindon...@anu.edu.aumailto:john.maindon...@anu.edu.au

On 22/07/2015, at 22:00, 
r-help-requ...@r-project.orgmailto:r-help-requ...@r-project.org wrote:

Da: li...@dewey.myzen.co.ukmailto:li...@dewey.myzen.co.uk
Data: 21-lug-2015 11.58
A: 
angelo.arc...@virgilio.itmailto:angelo.arc...@virgilio.itangelo.arc...@virgilio.itmailto:angelo.arc...@virgilio.it,
 bgunter.4...@gmail.commailto:bgunter.4...@gmail.com
Cc: r-help@r-project.orgmailto:r-help@r-project.org
Ogg: Re: R: Re: [R] R: Re: Differences in output of lme() when introducing 
interactions

Dear Angelo

I suggest you do an online search for marginality which may help to
explain the relationship between main effects and interactions. As I
said in my original email this is a complicated subject which we are not
going to retype for you.

If you are doing this as a student I suggest you sue your university for
failing to train you appropriately and if it is part of your employment
I suggest you find a better employer.

On 21/07/2015 10:04, 
angelo.arc...@virgilio.itmailto:angelo.arc...@virgilio.it wrote:
Dear Bert,
thank you for your feedback. Can you please provide some references
online so I can improve my ignorance?
Anyways, please notice that it is not true that I do not know statistics
and regressions at all, and I am strongly
convinced that my question can be of interest for some one else in the
future.

This is what forums serve for, isn't it? This is why people help each
other, isn't it?

Moreover, don't you think that I would not have asked to this R forum if
I had the possibility to ask or pay a statician?
Don't you think I have done already my best to study and learn before
posting this message? Trust me, I have read different
online tutorials on lme and lmer, and I am confident that I have got the
basic concepts. Still I have not found the answer
to solve my problem, so if you know the answer can you please give me
some suggestions that can help me?

I do not have a book where to learn and unfortunately I have to analyze
the results soon. Any help? Any online reference to-the-point
that can help me in solving this problem?

Thank you in advance

Best regards

Angelo


[[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] Contr.sum and coefficient tests

2015-07-23 Thread Ben Bolker
François Collin stxfc at nottingham.ac.uk writes:

 
 Dear all,
 
 I would like to run a linear model which includes two factors:

 - The first one has two levels, including a reference level. Thus I
 have to use the treatment contrast (contr.treatment, reference level
 effect = 0, then the intercept).

 - The second is a 6-level factor without reference contrast nor
 order. So, I would like to use sum contrat: sum of the effects = 0.

 The problem arises when it comes to the coefficient test. I
 understand it is not relevant to test the reference level for the
 first factor as the reference level is set to 0. However, using sum
 contrast for the second factor, I would have expected the test of
 each level to be included in the classical summary print of the lm
 function result but it is not. And here is my problem, how can I
 have every coefficients tested and printed in the summary output
 when my factor is studied from this sum.contrast standpoint?

  [some context snipped to make gmane happy -- sorry ]

  I think you should look at the effects package or the lsmeans
package (or possibly the multcomp package, if you want to be careful
about the number of (non-orthogonal) tests) -- the issue is that
summary.lm always reports on the *parameters* estimated.  If some
parameters are not independently estimable (e.g. the effect corresponding
to the last level can be reconstructed from the parameter values
for all of the preceding levels), then summary.lm() won't give
them to you.

  In fact, these packages will (probably) give you the results you
want even if the original model uses default treatment contrasts.
__
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] shift by one column given rows in a dataframe

2015-07-23 Thread William Dunlap
You could do something like the following
   rowsToShiftLeft - c(2,4,5) # 4, not the 3 that was in the original post
   mat - as.matrix(df_start)
   mat[rowsToShiftLeft, 1:3] - mat[rowsToShiftLeft, 2:4]
   result - data.frame(mat[, 1:3], stringsAsFactors=FALSE)
   str(result)
  'data.frame':   5 obs. of  3 variables:
   $ v0: chr  a b c d ...
   $ v1: chr  1 2 3 4 ...
   $ v2: chr  6 7 8 9 ...
You will then have to convert the columns which ought to be numeric
to numeric.  (All the columns in df_start were factors because of the
extra xxx that offset some of them.)


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Jul 23, 2015 at 1:19 PM, maxbre mbres...@arpa.veneto.it wrote:

 sorry but honestly I do not get your point

 I need to shift to left by one position (i.e. one column) the entire rows
 2,4,5 of df_start so that to obtain as final result the structure
 indicated in df_end

 I know in advance the rows that I need to shift

 hope it clears a bit, now




 --
 View this message in context:
 http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710276.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.


Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread Bert Gunter
Oops, Bill's reply and mine crossed in the email. His is essentially
the same as mine except probably more efficient.


-- Bert
Bert Gunter

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


On Thu, Jul 23, 2015 at 2:44 PM, William Dunlap wdun...@tibco.com wrote:
 You could do something like the following
rowsToShiftLeft - c(2,4,5) # 4, not the 3 that was in the original post
mat - as.matrix(df_start)
mat[rowsToShiftLeft, 1:3] - mat[rowsToShiftLeft, 2:4]
result - data.frame(mat[, 1:3], stringsAsFactors=FALSE)
str(result)
   'data.frame':   5 obs. of  3 variables:
$ v0: chr  a b c d ...
$ v1: chr  1 2 3 4 ...
$ v2: chr  6 7 8 9 ...
 You will then have to convert the columns which ought to be numeric
 to numeric.  (All the columns in df_start were factors because of the
 extra xxx that offset some of them.)


 Bill Dunlap
 TIBCO Software
 wdunlap tibco.com

 On Thu, Jul 23, 2015 at 1:19 PM, maxbre mbres...@arpa.veneto.it wrote:

 sorry but honestly I do not get your point

 I need to shift to left by one position (i.e. one column) the entire rows
 2,4,5 of df_start so that to obtain as final result the structure
 indicated in df_end

 I know in advance the rows that I need to shift

 hope it clears a bit, now




 --
 View this message in context:
 http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710276.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-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] Table Looks Funny

2015-07-23 Thread Marissa Fahlberg
Hey, I can't seem to import my csv file in such a way that the table looks
normal. The dimensions are correct, 4x7, and I set my header =TRUE, but
it still looks weird. Attached is the picture. Any ideas??

Thanks!!

-Marissa
__
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] Infinite Series

2015-07-23 Thread Janh Anni
Dear All,

Does anyone know of any R functions that compute partial sums of series?

Thanks in advance!

Janh

[[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] Infinite Series

2015-07-23 Thread Jeff Newmiller
?cumsum
---
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 July 23, 2015 8:23:39 PM PDT, Janh Anni annij...@gmail.com wrote:
Dear All,

Does anyone know of any R functions that compute partial sums of
series?

Thanks in advance!

Janh

   [[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] Differences in output of lme() when introducing interactions

2015-07-23 Thread Rolf Turner

On 24/07/15 07:07, Therneau, Terry M., Ph.D. wrote:

The following are in parody (but like all good parody correct wrt the
salient features). The musings of
Guernsey McPhearson
http://www.senns.demon.co.uk/wprose.html#Mixed
http://www.senns.demon.co.uk/wprose.html#FDA


In formal publication:
  Senn, Statistical Issues in Drug Development, second edition, Chapter
14: Multicentre Trials
  Senn, The many modes of meta, Drug information journal, 34:535-549, 2000.

The second points out that in a meta analysis no one would ever consider
giving both large and small trials equal weights, and relates that to
several other bits of standard practice.  The 'equal weights' notion
embedded in a fixed effects model + SAS type 3 is an isolated backwater.

Terry T.

PS. The Devils' Drug Development Dictionary at the same source has
some gems. Three rather random choices:

Bayesian - One who, vaguely expecting a horse and catching a glimpse of
a donkey, strongly concludes he has seen a mule.

Medical Statistician - One who won't accept that Columbus discovered
America because he said he was looking for India in the trial Plan.

Trend Towards Significance - An ever present help in times of trouble.



On 07/22/2015 06:02 PM, Rolf Turner wrote:

On 23/07/15 01:15, Therneau, Terry M., Ph.D. wrote:

SNIP


3. Should you ever use it [i.e. Type III SS]?  No.  There is a very
strong inverse
correlation between understand what it really is and recommend its
use.   Stephen Senn has written very intellgently on the issues.


Terry --- can you please supply an explicit citation?  Ta.


Thanks Terry!

cheers,

Rolf

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
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] Confidence intervals of GK gamma statistics using bootstrap

2015-07-23 Thread varin sacha
Dear R-Experts,

I am trying to calculate the confidence intervals of the Goodman  Kruskal 
gamma statistics using bootstrap. There is no gamma function in the boot 
package. There is a gamma function in the base package, but it is the usual 
mathematical function.


So, I decide to try to calculate the confidence intervals using this site : 
http://www.statmethods.net/advstats/bootstrapping.html

I get a normal warning message, but my R code is not working and I don't 
understand where my mistake(s) is (are).
Here is the reproducible example with imaginary/fake data.

install.packages(ryouready) 
library(ryouready) 
a=c(satisfait, pas satisfait, tres satisfait,satisfait,tres 
satisfait,pas satisfait,satisfait,satisfait,tres satisfait,pas 
satisfait) 
b=c(grand, petit, petit, grand, petit, grand, grand, petit, 
petit, grand)
x=table(a,b) 
ord.gamma(x) 
# calculate Goodman  Kruskal gamma using bootstrap 
library(boot) 
GK - function(formula, data, indices) { 
d - data[indices,] # allows boot to select sample 
tab - xtabs(formula, data=d) 
stat - ord.gamma(tab) 
return(stat)
} 
# bootstrapping with 2000 replications 
results - boot(data=d, statistic=GK,R=2000) 
# view results 
results
plot(results) 
# get 95% confidence interval 
boot.ci(results, type=all) 

Best Regards, thanks for your precious help!

SV

__
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] shift by one column given rows in a dataframe

2015-07-23 Thread maxbre
Hi

thank you for your reply: it's a neat solution but unfortunately not
applicable to my specific case;

in fact as I specified in my first post (I may have been not enough clear,
sorry for that!) I can not rely on any search method grep-like because the
value xxx in the rows of df_start can be anything (string or numeric and
always different) so that I necessarely need to apply by row index position
(i.e. in my reproducible example rows: 2, 3, 5); 

thank you again for your kind help but still searching for a solution...

best



--
View this message in context: 
http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710271.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] interactive Map: Popups

2015-07-23 Thread Erich Neuwirth
Some shapefiles for Germany can be found here

http://www.statsilk.com/maps/download-free-shapefile-maps 
http://www.statsilk.com/maps/download-free-shapefile-maps

 On Jul 23, 2015, at 21:36, Erin Hodgess erinm.hodg...@gmail.com wrote:
 
 Hello Erich:
 
 I just looked at your leaflet package and its examples.  It is awesome!
 
 Thanks,
 Erin
 
 
 On Thu, Jul 23, 2015 at 6:28 AM, Erich Neuwirth erich.neuwi...@univie.ac.at 
 mailto:erich.neuwi...@univie.ac.at wrote:
 I am quite happy with that package leaflet which is not yet on CRAN
 but available on Githib.
 
 https://github.com/rstudio/leaflet https://github.com/rstudio/leaflet 
 https://github.com/rstudio/leaflet https://github.com/rstudio/leaflet
 
 
 __
 R-help@r-project.org mailto:R-help@r-project.org mailing list -- To 
 UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
 http://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 
 --
 Erin Hodgess
 Associate Professor
 Department of Mathematical and Statistics
 University of Houston - Downtown
 mailto: erinm.hodg...@gmail.com mailto:erinm.hodg...@gmail.com


signature.asc
Description: Message signed with OpenPGP using GPGMail
__
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] shift by one column given rows in a dataframe

2015-07-23 Thread Bert Gunter
Ah, so apparently you require some sort of psychic abilities...

For how else would one choose which three values to keep in a row that was:

a  2   b  5

based on your specification that xxx could be anything.

Cheers,

Bert
Bert Gunter

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


On Thu, Jul 23, 2015 at 12:56 PM, maxbre mbres...@arpa.veneto.it wrote:
 Hi

 thank you for your reply: it's a neat solution but unfortunately not
 applicable to my specific case;

 in fact as I specified in my first post (I may have been not enough clear,
 sorry for that!) I can not rely on any search method grep-like because the
 value xxx in the rows of df_start can be anything (string or numeric and
 always different) so that I necessarely need to apply by row index position
 (i.e. in my reproducible example rows: 2, 3, 5);

 thank you again for your kind help but still searching for a solution...

 best



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710271.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-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] shift by one column given rows in a dataframe

2015-07-23 Thread maxbre
sorry but honestly I do not get your point

I need to shift to left by one position (i.e. one column) the entire rows
2,4,5 of df_start so that to obtain as final result the structure
indicated in df_end

I know in advance the rows that I need to shift

hope it clears a bit, now




--
View this message in context: 
http://r.789695.n4.nabble.com/shift-by-one-column-given-rows-in-a-dataframe-tp4710256p4710276.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-es] Método S3 paquete

2015-07-23 Thread Guillermo.Vinue
Hola,

Estoy tratando de crear un método S3 llamado anthr dentro del paquete
que estoy desarrollando, cuyo argumento principal es res que
básicamente es una lista con un solo componente. Pero si el segundo
argumento llamado oneSize es FALSE, res es una lista de listas.

Lo que he escrito hasta el momento es lo siguiente:

anthr - function(res, oneSize, nsizes){
  UseMethod(anthr)
}

anthr.tri - function(res, oneSize, nsizes){
  
  if(oneSize){
cases - c() 
cases - res$meds
  }else{
cases - list()
for (i in 1 : (nsizes - 1)){
  cases[[i]] - res[[i]]$meds
}
  }
  return(cases)
} 

El problema cuando instalo el paquete y utilizo este método, es que R no
me reconoce que res sea una lista. En concreto, me aparece este error:

Error in UseMethod(anthr) : 
  no applicable method for 'anthr' applied to an object of class list

He tratado de añadir esto:

tri - function(x){
 value - list(meds = x$meds)  
 attr(value, class) - tri   
 value
}

pero sigue sin funcionarme. ¿Alguien puede ofrecerme alguna ayuda?.

Muchas gracias de antemano.

Un saludo,

Guillermo

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Statistical distribution not fitting

2015-07-23 Thread Amelia Marsh via R-help
Dear Sir,

Thanks for your great guidance. Made me realize that I need to think out of 
box. 

As regards the low losses, BASEL guidelines do say to get rid of such low 
losses which create noise in analysing the losses caused by Operational Loss 
events. 
Its the right tail events do matter which represent low frequency high 
magnitude nature losses.
But my client is so adamant about it, that although we have shown them research 
papers about threshold limits which need to apply to arrive at some meaningful 
analyses, he is insisting that we do include these low losses too and fit some 
distribution.

Lastly using the command 



rsnorm(1, mean = m, sd = s, xi = x) 

where m, s and x are the estimated parameters obtained from loss data. The 
usual procedure is to arrange these simulated values in descending order and 
select an observation representing (say 99.9%) and this is Value at Risk (VaR) 
which is say 'p'. 

My understanding is to this value 'p', I need to apply the transformation 10^p 
to arrive at the value which is in line with my original loss data. Am I right? 

Thanks again sir for your great help. I have something to look ahead now. 


Regards

Amelia

_



On Thursday, 23 July 2015 2:20 AM, Boris Steipe boris.ste...@utoronto.ca 
wrote:
So - as you can see, your data can be modelled.

Now the interesting question is: what do you do with that knowledge. I know 
nearly nothing about your domain, but given that the data looks log-normal, I 
am curious abut the following:

- Most of the events are in the small-loss category. But most of the damage is 
done by the rare large losses. Is it even meaningful to guard against a single 
1/1000 event? Shouldn't you be saying: my contingency funds need to be large 
enough to allow survival of, say, a fiscal year with 99.9 % probability? This 
is a very different question.

- If a loss occurs, in what time do the funds need to be replenished? Do you 
need to take series of events into account?

- The model assumes that the data are independent. This is probably a poor (and 
dangerous) assumption.

Cheers,
B.






On Jul 22, 2015, at 3:56 PM, Ben Bolker bbol...@gmail.com wrote:

 Amelia Marsh amelia_marsh08 at yahoo.com writes:
 
 
 Hello!  (I dont know if I can raise this query here on this forum,
 but I had already raised on teh finance forum, but have not received
 any sugegstion, so now raising on this list. Sorry for the same. The
 query is about what to do, if no statistical distribution is fitting
 to data).
 
 I am into risk management and deal with Operatioanl risk. As a part
 of BASEL II guidelines, we need to arrive at the capital charge the
 banks must set aside to counter any operational risk, if it
 happens. As a part of Loss Distribution Approach (LDA), we need to
 collate past loss events and use these loss amounts. The usual
 process as being practised in the industry is as follows -
 
 Using these historical loss amounts and using the various
 statistical tests like KS test, AD test, PP plot, QQ plot etc, we
 try to identify best statistical (continuous) distribution fitting
 this historical loss data. Then using these estimated parameters
 w.r.t. the statistical distribution, we simulate say 1 miliion loss
 anounts and then taking appropriate percentile (say 99.9%), we
 arrive at the capital charge.
 
 However, many a times, loss data is such that fitting of
 distribution to loss data is not possible. May be loss data is
 multimodal or has significant variability, making the fitting of
 distribution impossible.  Can someone guide me how to deal with such
 data and what can be done to simulate losses using this historical
 loss data in R.
 
 A skew-(log)-normal fit doesn't look too bad ... (whenever you
 have positive data that are this strongly skewed, log-transforming
 is a good step)
 
 hist(log10(mydat),col=gray,breaks=FD,freq=FALSE)
 ## default breaks are much coarser:
 ## hist(log10(mydat),col=gray,breaks=Sturges,freq=FALSE)
 lines(density(log10(mydat)),col=2,lwd=2)
 library(fGarch)
 ss - snormFit(log10(mydat))
 xvec - seq(2,6.5,length=101)
 lines(xvec,do.call(dsnorm,c(list(x=xvec),as.list(ss$par))),
  col=blue,lwd=2)
 ## or try a skew-Student-t: not very different:
 ss2 - sstdFit(log10(mydat))
 lines(xvec,do.call(dsstd,c(list(x=xvec),as.list(ss2$estimate))),
  col=purple,lwd=2)
 
 There are more flexible distributional families (Johnson,
 log-spline ...)
 
 Multimodal data are a different can of worms -- consider
 fitting a finite mixture model ...
 
 __
 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 

Re: [R] interactive Map: Popups

2015-07-23 Thread Greg Snow
You might be interested in the HWidentify and HTKidentify functions in
the TeachingDemos package.  They currently don't do maps, but since
the functions are pure R code it would not be hard to modify them.

On Wed, Jul 22, 2015 at 5:35 PM, Marie-Louise tim...@hotmail.de wrote:
 Hello,
 I am trying to build a map of a country which shows informations to its
 regions in a popup window as soon as someone clicks on a region.
 Thank you



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/interactive-Map-Popups-tp4710226.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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@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] Ordering in Sankey diagram using R and googleVis

2015-07-23 Thread Angela via R-help
Hi Jim,

I tried it and it while it does make the diagram look more like what I want, 
there are a few categories still out of order.  Thank you for your help!

-Angela


On Thu, 7/23/15, Jim Lemon drjimle...@gmail.com wrote:

 Subject: Re: [R] Ordering in Sankey diagram using R and googleVis

 Cc: r-help mailing list r-help@r-project.org
 Date: Thursday, July 23, 2015, 6:43 AM

 Hi Angela,
 Assuming that your reformatted data is named
 data, have you tried:

 data[order(data$count,data$before,decreasing=TRUE),]

 Jim

 On
 Thu, Jul 23, 2015 at 3:15 AM, Angela via R-help r-help@r-project.org
 wrote:
  Hello,
 
  I am trying to figure out if there is a
 way to order the left side of a Sankey diagram from most
 frequent to least frequent. I am using R version 3.2.1 and
 using googleVis version 0.5.9 for the Sankey. I've tried
 sorting, but that does not work. Is there anyway to force it
 to arrange the left (before) side in decreasing
 frequency? Something I am missing? Does not have to be using
[[elided Yahoo spam]]
 
  -Angela
 
  Example of the data I have, in a csv
 file:
 
  before   
 after
  A    B
  A 
   B
  A    B
  A 
   C
  A    A
  A 
   A
  A    B
  D 
   E
  F    B
  F 
   B
  F    F
  G 
   H
  G    A
 
  I reformat the data in R so it looks like
 this:
 
  before   
 after    count
  A    B    4
  A    C    1
  A 
   A    2
  D    E    1
  F    B    2
  F 
   F    1
  G    H    1
  G    A    1
 
  Then plot using this:
 
 plot( gvisSankey (data, from=before,
 to=after, weight=freq,
 options=list(width=600, height=800,
  
    sankey={iterations: 2})))
 
 
 __
  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] shift by one column given rows in a dataframe

2015-07-23 Thread Massimo Bressan

by considering the following reproducible example:

v0-c(a,xxx,c,rep(xxx,2))
v1-c(1,b,3,d,e)
v2-c(6,2,8,4,5)
v3-c(xxx,7,xxx,9,10)

df_start-data.frame(v0,v1,v2,v3)
df_start

v0-letters[1:5]
v1-1:5
v2-6:10

df_end-data.frame(v0,v1,v2)
df_end

I need  to shift by one column some given rows in the initial data frame 
called df_start so that to get the final structure as in df_end;
please consider that the value xxx in the rows of df_start can be 
anything so that I necessarly need to apply by row index position (in my 
reproducible example rows: 2, 3, 5);


I'm really stuck with that problem and I can not conceive any viable 
solution up to now


any hints?

best regards

m

__
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] interactive Map: Popups

2015-07-23 Thread Erich Neuwirth
I am quite happy with that package leaflet which is not yet on CRAN
but available on Githib.

https://github.com/rstudio/leaflet https://github.com/rstudio/leaflet



signature.asc
Description: Message signed with OpenPGP using GPGMail
__
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] shift by one column given rows in a dataframe

2015-07-23 Thread Sarah Goslee
With one minor change to your reproducible example (thank you!):

df_start - data.frame(v0,v1,v2,v3, stringsAsFactors=FALSE)
data.frame(t(apply(df_start, 1, function(i)i[!grepl(xxx, i)])),
stringsAsFactors=FALSE)

I'll leave it to you to deal with columns that you'd like to have
numeric. (You might also try str(df_start)).

Sarah

On Thu, Jul 23, 2015 at 12:14 PM, Massimo Bressan
mbres...@arpa.veneto.it wrote:
 by considering the following reproducible example:

 v0-c(a,xxx,c,rep(xxx,2))
 v1-c(1,b,3,d,e)
 v2-c(6,2,8,4,5)
 v3-c(xxx,7,xxx,9,10)

 df_start-data.frame(v0,v1,v2,v3)
 df_start

 v0-letters[1:5]
 v1-1:5
 v2-6:10

 df_end-data.frame(v0,v1,v2)
 df_end

 I need  to shift by one column some given rows in the initial data frame
 called df_start so that to get the final structure as in df_end;
 please consider that the value xxx in the rows of df_start can be
 anything so that I necessarly need to apply by row index position (in my
 reproducible example rows: 2, 3, 5);

 I'm really stuck with that problem and I can not conceive any viable
 solution up to now

 any hints?

 best regards

 m

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

__
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] Differences in output of lme() when introducing interactions

2015-07-23 Thread Therneau, Terry M., Ph.D.
The following are in parody (but like all good parody correct wrt the salient features). 
The musings of

Guernsey McPhearson
   http://www.senns.demon.co.uk/wprose.html#Mixed
   http://www.senns.demon.co.uk/wprose.html#FDA


In formal publication:
 Senn, Statistical Issues in Drug Development, second edition, Chapter 14: 
Multicentre Trials
 Senn, The many modes of meta, Drug information journal, 34:535-549, 2000.

The second points out that in a meta analysis no one would ever consider giving both large 
and small trials equal weights, and relates that to several other bits of standard 
practice.  The 'equal weights' notion embedded in a fixed effects model + SAS type 3 is an 
isolated backwater.


Terry T.

PS. The Devils' Drug Development Dictionary at the same source has some gems. Three 
rather random choices:


Bayesian - One who, vaguely expecting a horse and catching a glimpse of a donkey, strongly 
concludes he has seen a mule.


Medical Statistician - One who won't accept that Columbus discovered America because he 
said he was looking for India in the trial Plan.


Trend Towards Significance - An ever present help in times of trouble.



On 07/22/2015 06:02 PM, Rolf Turner wrote:

On 23/07/15 01:15, Therneau, Terry M., Ph.D. wrote:

SNIP


3. Should you ever use it [i.e. Type III SS]?  No.  There is a very strong 
inverse
correlation between understand what it really is and recommend its
use.   Stephen Senn has written very intellgently on the issues.


Terry --- can you please supply an explicit citation?  Ta.

cheers,

Rolf



__
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] Statistical distribution not fitting

2015-07-23 Thread Ben Bolker
Amelia Marsh via R-help r-help at r-project.org writes:

 
 Dear Sir,
 

 [snip]
 
 Lastly using the command rsnorm(1, mean = m, sd = s, xi = x)
 where m, s and x are the estimated parameters obtained from loss
 data. The usual procedure is to arrange these simulated values in
 descending order and select an observation representing (say 99.9%)
 and this is Value at Risk (VaR) which is say 'p'.

 My understanding is to this value 'p', I need to apply the
 transformation 10^p to arrive at the value which is in line with my
 original loss data. Am I right?

 [snip; sorry to remove context, but Gmane doesn't like it]

(1) you can probably calculate the 0.999 quantile directly from
qsnorm(0.999, [params]) rather than by simulating ...
(2) ... I believe that my original example used log(), so you
would need to use exp() (not 10^x) to get back to the original scale ...
(3) ... if you're concerned about extreme events it would be
a very good idea to use the skew-t rather than the skew-Normal
(4) you should certainly consider Boris Steipe's concerns about
non-independence (although I have to admit that without more
information and further time/effort/thought I don't have any
simple suggestions how ...)

  cheers
Ben Bolker

__
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] interactive Map: Popups

2015-07-23 Thread Marie-Louise
Thank you both very much for your tips, and excuse my horrible english
skills. 

R is new to me so I tried to work with code that was already there.
I managed to get close to what I wanted with

require(googleVis)
G4 = gvisGeoChart(con2, 
  locationvar = DE, 
  colorvar = data_7, hovervar = data_6, options=list(
  width=800, height=600, region=DE, 
displayMode=regions, 
  resolution=provinces))
  
plot(G4)

but it seems like googleVis does not support resolution=provinces for
Germany :(
Do you know anything that simple as this code to get to what I wanted? 
Thank you very much



--
View this message in context: 
http://r.789695.n4.nabble.com/interactive-Map-Popups-tp4710226p4710257.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] Contr.sum and coefficient tests

2015-07-23 Thread François Collin
Dear all,

I would like to run a linear model which includes two factors:
- The first one has two levels, including a reference level. Thus I have to use 
the treatment contrast (contr.treatment, reference level effect = 0, then the 
intercept).
- The second is a 6-level factor without reference contrast nor order. So, I 
would like to use sum contrat: sum of the effects = 0.

The problem arises when it comes to the coefficient test. I understand it is 
not relevant to test the reference level for the first factor as the reference 
level is set to 0. However, using sum contrast for the second factor, I would 
have expected the test of each level to be included in the classical summary 
print of the lm function result but it is not. And here is my problem, how can 
I have every coefficients tested and printed in the summary output when my 
factor is studied from this sum.contrast standpoint?


Here is an example from a previous thread:
(http://comments.gmane.org/gmane.comp.lang.r.general/258886)

==
 x - as.factor(c(1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3))
 y - c(1.1,1.15,1.2,1.1,1.1,1.1,1.2,1.2,1.2,2.1,2.2,2.3,2.4,2.5,
 +  2.6,2.7,2.8,2.9,3,3.1)
 test - data.frame(x,y)
 reg1 - lm(y~C(x,contr.sum),data=test)
 summary(reg1)

Coefficients:
 Estimate Std. Error t value Pr(|t|)   
(Intercept)   1.60.06577  24.834 8.48e-15 ***
C(x, contr.sum)1 -0.483330.10792  -4.479  0.00033 ***
C(x, contr.sum)2 -0.483330.08936  -5.409 4.70e-05 ***
==

How can I include the third factor level in this table?

I fill the answer provided in this previous thread is relevant for 
contr.treatment but not for contr.sum. Am I right? Or can you explain me?

Many thanks,
Fanch



This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 

Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.

__
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] How to calculate the average direct effect, average total effect and average indirect effect for spatial regression models with spatial lag of dependent variable

2015-07-23 Thread wenyueyang
Hi,

I am using four spatial regression models (SAR, SEM, SAC and SDM) to
evaluate the spillover effect of some factors. LeSage and Pace (2009)
pointed out that when the spatial lag of the dependent variable is included
in the model, parameter estimates lose their conventional interpretation as
marginal effects, because the spatial lag gives rise to a series of feedback
loops and spillover effects across regions. Therefore, I need to calculate
the three different marginal effects: average direct effect, average total
effect and average indirect (spillover) effect, and this is what I don't
know how to perform in R.
Can you teach me about how to calculate the average direct effect, average
total effect and average indirect (spillover) effect for the spatial
regression models in R and tell me the related R code? 
I would like to express my great appreciation to you!

Thank you very much and best regards.

Yours sincerely,
Wenyue Yang



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-calculate-the-average-direct-effect-average-total-effect-and-average-indirect-effect-for-spate-tp4710253.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] Read .xlsx and convert date-column value into Dataframe

2015-07-23 Thread Ivan Calandra

Hi Antony,

Except if you have good reasons to use R2.15, it is generally a good 
idea to upgrade to the latest version.
In any case, the solutions that were proposed on the list will 
definitely work fine.


There are however advantages of using readxl, in my opinion. readxl does 
not use dependencies; it correctly converts to dates; and if you have 
empty cells in numeric columns, xlsx will convert to NaN and not NA as 
would be expected (correct me if this behavior has been modified in the 
latest version). The problem with readxl is that it only reads! A 
similar write function would be nice!


Ivan

--
Ivan Calandra, ATER
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
https://www.researchgate.net/profile/Ivan_Calandra

Le 23/07/15 08:50, R_Antony a écrit :

Hi Ivan,

This way i would've tried but i am using R 2.15 - ReadXL package will
support R =3 versions.

Thanks,
Antony.



--
View this message in context: 
http://r.789695.n4.nabble.com/Read-xlsx-and-convert-date-column-value-into-Dataframe-tp4710192p4710232.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-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] Read .xlsx and convert date-column value into Dataframe

2015-07-23 Thread R_Antony
Hi Ivan,

This way i would've tried but i am using R 2.15 - ReadXL package will
support R =3 versions.

Thanks,
Antony.



--
View this message in context: 
http://r.789695.n4.nabble.com/Read-xlsx-and-convert-date-column-value-into-Dataframe-tp4710192p4710232.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] Read .xlsx and convert date-column value into Dataframe

2015-07-23 Thread R_Antony
Hi Jim,

My requirement is simple. I have to read date-values from the excel file
into dataframe, that's all.

and i tried using the way you mentioned and it works. Thank you very much !



--
View this message in context: 
http://r.789695.n4.nabble.com/Read-xlsx-and-convert-date-column-value-into-Dataframe-tp4710192p4710233.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] Stats courses in Queensland, Australia

2015-07-23 Thread Highland Statistics Ltd

Apologies for cross-posting


There are various remaining seats on the following two statistics courses:

Course 1:
Introduction to Generalized Linear Models with R. -Bayesian and 
frequentist approaches -

Dates: 11 - 14 August, 2015
Location: Hotel Grand Chancellor, Coral Coast Drive, Palm Cove. Australia


Course 2:
Introduction to Zero Inflated Models with R. - Frequentist and Bayesian 
approaches -

Dates: 17 - 21 August, 2015
Location: Hotel Grand Chancellor, Coral Coast Drive, Palm Cove. Australia


Course website:
http://highstat.com/statscourse.htm

Course flyers:
http://highstat.com/Courses/Flyers/Flyer2015_08PalmCoveI.pdf
http://highstat.com/Courses/Flyers/Flyer2015_08PalmCoveII.pdf

Both courses are pre-required knowledge for our 'Introduction to GLMs 
with spatial and temporal correlation'.



Kind regards,

Alain Zuur



--
Dr. Alain F. Zuur

First author of:
1. Beginner's Guide to GAMM with R (2014).
2. Beginner's Guide to GLM and GLMM with R (2013).
3. Beginner's Guide to GAM with R (2012).
4. Zero Inflated Models and GLMM with R (2012).
5. A Beginner's Guide to R (2009).
6. Mixed effects models and extensions in ecology with R (2009).
7. Analysing Ecological Data (2007).

Highland Statistics Ltd.
9 St Clair Wynd
UK - AB41 6DZ Newburgh
Tel:   0044 1358 788177
Email: highs...@highstat.com
URL:   www.highstat.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] Langelier-Ludwig Plots

2015-07-23 Thread Jim Lemon
Hi Rich,
Thanks to the link provided by Boris, I now realize that the third
example in the radial.plot function help page is almost a Tickell
diagram. Another plotting function that is close to the illustrations
in that paper is starPie. Learn something every day. Hope this is
helpful.

Jim


On Thu, Jul 23, 2015 at 2:49 AM, Rich Shepard rshep...@appl-ecosys.com wrote:
 On Wed, 22 Jul 2015, Boris Steipe wrote:

 According to  ...
   http://info.ngwa.org/gwol/pdf/721000139.PDF (Graphical Interpretation of
 Water Quality Data)
 ... a Langelier-Ludwig plot is simply a scatterplot of cations vs. anions
 (in percent).
 Surely that would be beyond trivial to produce in R. Or am I missing a
 subtle something?


 Boris,

   Yes, that's what it is. I'll see just how trivial it is to produce it in
 the four-quadrant format I've seen used. It's a different layout from the
 basic two-variable scatterplot.

   Thanks for the URL. I worked from a reference in a 2003 paper to the
 original 1942 paper.

 Rich

 __
 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] Ordering in Sankey diagram using R and googleVis

2015-07-23 Thread Jim Lemon
Hi Angela,
Assuming that your reformatted data is named data, have you tried:

data[order(data$count,data$before,decreasing=TRUE),]

Jim

On Thu, Jul 23, 2015 at 3:15 AM, Angela via R-help r-help@r-project.org wrote:
 Hello,

 I am trying to figure out if there is a way to order the left side of a 
 Sankey diagram from most frequent to least frequent. I am using R version 
 3.2.1 and using googleVis version 0.5.9 for the Sankey. I've tried sorting, 
 but that does not work. Is there anyway to force it to arrange the left 
 (before) side in decreasing frequency? Something I am missing? Does not 
 have to be using googleVis. Thank you!

 -Angela

 Example of the data I have, in a csv file:

 beforeafter
 AB
 AB
 AB
 AC
 AA
 AA
 AB
 DE
 FB
 FB
 FF
 GH
 GA

 I reformat the data in R so it looks like this:

 beforeaftercount
 AB4
 AC1
 AA2
 DE1
 FB2
 FF1
 GH1
 GA1

 Then plot using this:
 plot( gvisSankey (data, from=before, to=after, weight=freq, 
 options=list(width=600, height=800,
 sankey={iterations: 2})))

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