Re: [R] How to obtain individual log-likelihood value from glm?

2020-08-29 Thread peter dalgaard
> On 25 Aug 2020, at 18:40 , peter dalgaard wrote: > > If you don't worry too much about an additive constant, then half the > negative squared deviance residuals should do. (Not quite sure how weights > factor in. Looks like they are accounted for.) > > -pd > >> On 25 Aug 2020, at 17:33 ,

Re: [R] How to obtain individual log-likelihood value from glm?

2020-08-29 Thread peter dalgaard
Briefly, you shouldn't. One way of seeing it is if you switch the model to y~1, you still get logLik==0. The root cause is the rounding in binomial()$aic: > binomial()$aic function (y, n, mu, wt, dev) { m <- if (any(n > 1)) n else wt -2 * sum(ifelse(m > 0, (wt/m), 0) * dbin

[R] tempdir() does not respect TMPDIR

2020-08-29 Thread Jinsong Zhao
Hi there, When I started R by double clicking on Rgui icon (I am on Windows), the tempdir() returned the tmpdir in the directory I set in .Renviron. If I started R by double clicking on a *.RData file, the tempdir() return the tmpdir in the directory setting by Windows system. I don't know whe

Re: [R] How to obtain individual log-likelihood value from glm?

2020-08-29 Thread John Fox
Dear John, On 2020-08-29 1:30 a.m., John Smith wrote: Thanks Prof. Fox. I am curious: what is the model estimated below? Nonsense, as Peter explained in a subsequent response to your prior posting. I guess my inquiry seems more complicated than I thought: with y being 0/1, how to fit weig

Re: [R] Base package being deleted recurrently

2020-08-29 Thread J C Nash
Possibly way off target, but I know some of our U of O teaching systems boot by reverting to a standard image i.e., you get back to a vanilla system. That would certainly kill any install. JN On 2020-08-28 10:22 a.m., Rene J Suarez-Soto wrote: > Hi, > > I have a very strange issue. I am currentl

Re: [R] How to obtain individual log-likelihood value from glm?

2020-08-29 Thread John Smith
Thanks for very insightful thoughts. What I am trying to achieve with the weights is actually not new, something like https://stats.stackexchange.com/questions/44776/logistic-regression-with-weighted-instances. I thought my inquiry was not too strange, and I could utilize some existing codes. It is

[R] serialize does not work as expected

2020-08-29 Thread Sigbert Klinke
Hi, if I create a list with l <- list(1:3, as.numeric(1:3), c(1,2,3)) and applying lapply(l, 'class') lapply(l, 'mode') lapply(l, 'storage.mode') lapply(l, 'typeof') identical(l[[2]], l[[3]]) then I would believe that as,numeric(1:3) and c(1,2,3) are identical objects. However, lapply(l, s

Re: [R] serialize does not work as expected

2020-08-29 Thread Jeff Newmiller
Did you really conclude from looking at class that they were identical? Numeric mode sometimes makes it hard to distinguish integers from doubles, but they are different. On August 29, 2020 8:34:29 AM PDT, Sigbert Klinke wrote: >Hi, > >if I create a list with > >l <- list(1:3, as.numeric(1:3),

Re: [R] Would Like Some Advice

2020-08-29 Thread Robert D. Bowers M.A.
Besides monitization, Windows has a few other things that infuriate me... (1) VERY hard to control updates, (2) "sneaker" updates - things installed that people don't want (like trying to force Windows computer owners to update - and sometimes wrecking the computer when it does), (3) bad update

Re: [R] serialize does not work as expected

2020-08-29 Thread Duncan Murdoch
On 29/08/2020 11:34 a.m., Sigbert Klinke wrote: Hi, if I create a list with l <- list(1:3, as.numeric(1:3), c(1,2,3)) and applying lapply(l, 'class') lapply(l, 'mode') lapply(l, 'storage.mode') lapply(l, 'typeof') identical(l[[2]], l[[3]]) then I would believe that as,numeric(1:3) and c(1,2,

Re: [R] tempdir() does not respect TMPDIR

2020-08-29 Thread Henrik Bengtsson
It is too late to set TMPDIR in .Renviron. It is one of the environment variables that has to be set prior to launching R. From help("tempfile", package = "base"): The environment variables TMPDIR, TMP and TEMP are checked in turn and the first found which points to a writable directory is used:

Re: [R] How to obtain individual log-likelihood value from glm?

2020-08-29 Thread John Fox
Dear John, On 2020-08-29 11:18 a.m., John Smith wrote: Thanks for very insightful thoughts. What I am trying to achieve with the weights is actually not new, something like https://stats.stackexchange.com/questions/44776/logistic-regression-with-weighted-instances. I thought my inquiry was not t

Re: [R] serialize does not work as expected

2020-08-29 Thread Sigbert Klinke
Hi, is there in R a way to "normalize" a vector from compact_intseq/compact_realseq to a "normal" vector? Sigbert Am 29.08.20 um 18:13 schrieb Duncan Murdoch: Element 1 A 3 262146 197888 5 UTF-8 238 2 1 262153 14 compact_intseq 2 1 262153 4 base 2 13 1 13 254 14 3 3 1 1 254 Element 2 A 3 26

Re: [R] serialize does not work as expected

2020-08-29 Thread Henrik Bengtsson
Does serialize(..., version = 2L) do what you want? /Henrik On Sat, Aug 29, 2020 at 10:10 AM Sigbert Klinke wrote: > > Hi, > > is there in R a way to "normalize" a vector from > compact_intseq/compact_realseq to a "normal" vector? > > Sigbert > > Am 29.08.20 um 18:13 schrieb Duncan Murdoch: > >

Re: [R] How to obtain individual log-likelihood value from glm?

2020-08-29 Thread John Smith
In the book Modern Applied Statistics with S, 4th edition, 2002, by Venables and Ripley, there is a function logitreg on page 445, which does provide the weighted logistic regression I asked, judging by the loss function. And interesting enough, logitreg provides the same coefficients as glm in the

Re: [R] serialize does not work as expected

2020-08-29 Thread William Dunlap via R-help
For some reason l[[2]] is serialized as a 'compact_realseq' and l[3]] is not. They both unserialize to the same thing. On Windows I get: > lapply(l, function(x)rawToChar(serialize(x, connection=NULL, ascii=TRUE))) [[1]] [1] "A\n3\n262146\n197888\n6\nCP1252\n238\n2\n1\n262153\n14\ncompact_intseq

Re: [R] How to obtain individual log-likelihood value from glm?

2020-08-29 Thread John Fox
Dear John, If you look at the code for logitreg() in the MASS text, you'll see that the casewise components of the log-likelihood are multiplied by the corresponding weights. As far as I can see, this only makes sense if the weights are binomial trials. Otherwise, while the coefficients thems

Re: [R] serialize does not work as expected

2020-08-29 Thread Duncan Murdoch
On 29/08/2020 1:10 p.m., Sigbert Klinke wrote: Hi, is there in R a way to "normalize" a vector from compact_intseq/compact_realseq to a "normal" vector? I don't know if there's a function specifically designed to do that, but as Henrik proposed, this works: l_normalized <- unserialize(seri

Re: [R] Would Like Some Advise

2020-08-29 Thread Jan Galkowski
Hi Philip, This ends up being a pretty personal decision, but here's my advice. I have used Windows of various flavors, and Linux in a couple of versions. I have also used four or five Unixen, in addition to Linux. I've never spent a lot of time using a Mac, although in many instances most o

[R] Solving derivates, getting the minimum of a function, and helpful documentation of the deriv function

2020-08-29 Thread Sorkin, John
I am trying to find the minimum of a linear function: y <- (-0.0263*b) + (0.0010*B^2) I am having GREAT difficulty with the documentation of the deriv function. I have (after playing for two-hours) been able to get the following to work: zoop <- deriv(expression((-0.0263*B)+(0.0010*B^2)),"B",fu

Re: [R] Solving derivates, getting the minimum of a function, and helpful documentation of the deriv function

2020-08-29 Thread Roy Mendelssohn - NOAA Federal via R-help
Hi John: Can I ask if this is the specific problem you are after, or a test for more general problem? If the former, the derivative is -0.0263 + 0.002 * B so the solution for B is: B = (0263)/0.002 If you are after a more general way fo doing this: ?solve -Roy > On Aug 29, 2020, at 2:

Re: [R] tempdir() does not respect TMPDIR

2020-08-29 Thread Jinsong Zhao
I read the help page, I don't understand it very well, since I set the environmental variable TMPDIR in .Renviron. What confused me is when double clicking the *.RData to launch R, the tempdir() does not respect the environmental variable TMPDIR, but launch R by double clicking Rgui icon does.

Re: [R] Solving derivates, getting the minimum of a function, and helpful documentation of the deriv function

2020-08-29 Thread Rolf Turner
On Sat, 29 Aug 2020 21:15:56 + "Sorkin, John" wrote: > I am trying to find the minimum of a linear function: Quadratic function??? > y <- (-0.0263*b) + (0.0010*B^2) > > I am having GREAT difficulty with the documentation of the deriv > function. I have (after playing for two-hours) been

Re: [R] serialize does not work as expected

2020-08-29 Thread Jeff King
compact sequences are actually an ALTREP object. I do not know if there is any standard way to do it, but here is a trick for what you want. ``` > x <- 1:3 > .Internal(inspect(x)) @0x0196bed8dd78 13 INTSXP g0c0 [NAM(7)] 1 : 3 (compact) > x[1] <- x[1] > .Internal(inspect(x)) @0x0196bef90b6