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

2020-08-29 Thread John Smith
:18 AM 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 too st

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

2020-08-29 Thread John Smith
is just an optimization problem at the end of day, or not? Thanks On Sat, Aug 29, 2020 at 9:02 AM John Fox wrote: > 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? > >

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

2020-08-28 Thread John Smith
McMaster University > Hamilton, Ontario, Canada > web: https://socialsciences.mcmaster.ca/jfox/ > >> On 2020-08-28 9:28 p.m., John Smith wrote: >> If the weights < 1, then we have different values! See an example below. >> How should I interpret logLik value then? >> set.s

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

2020-08-28 Thread John Smith
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 , John Smith wrote: > > > > Dear R-help, > > > > The function l

Re: [R] Passing formula and weights error

2020-08-28 Thread John Smith
s the same result you get with a direct call to > glm(y~., data=data, weights=1/(1:n)) > > This is a common problem and I don't know if there is a FAQ on it or a > standard function to deal with it. > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Fri, Aug

[R] Passing formula and weights error

2020-08-28 Thread John Smith
Dear R-help: I am writing a function based on glm and would like some variations of weights. In the code below, I couldn't understand why the second glm function fails and don't know how to fix it: Error in eval(extras, data, env) : object 'newweights' not found Calls: print ... eval -> -> mode

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

2020-08-27 Thread John Smith
accounted for.) > > -pd > > > On 25 Aug 2020, at 17:33 , John Smith wrote: > > > > Dear R-help, > > > > The function logLik can be used to obtain the maximum log-likelihood > value > > from a glm object. This is an aggregated value, a summation of in

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

2020-08-25 Thread John Smith
Dear R-help, The function logLik can be used to obtain the maximum log-likelihood value from a glm object. This is an aggregated value, a summation of individual log-likelihood values. How do I obtain individual values? In the following example, I would expect 9 numbers since the response has leng

Re: [R] Classification Tree Prediction Error

2020-08-25 Thread John Smith
As Bert advised correctly, this is not an R programming question. There is some misunderstanding on how training//test data work together in predictions. Suppose your test data has only one class. Therefore, you can get the following rate by betting on the majority class every time, again using dat

Re: [R] [EXT] Re: Plot math symbol with string and number

2020-08-17 Thread John Smith
Thanks David for a quite interesting suggestion: Indeed I didn't know paste0! Best! On Mon, Aug 17, 2020 at 12:26 PM David K Stevens wrote: > John - one more approach > > plot(y,main=parse(text=paste0('data ~~ sigma == ',s))) > > Good luck > > David Stevens

Re: [R] Plot math symbol with string and number

2020-08-17 Thread John Smith
Thanks to Dunkan, Rasmus and Bert. Will keep the very useful tips. Best! On Sun, Aug 16, 2020 at 9:13 PM Rasmus Liland wrote: > On Sun, Aug 16, 2020 at 3:18 PM Bert wrote: > | On Sun, Aug 16, 2020, 14:53 John wrote: > | | > | | I would like to make plots with > | | titles for different data sets

[R] Plot math symbol with string and number

2020-08-16 Thread John Smith
Dear Helpers, I would like to make plots with titles for different data sets and different parameters. So a useful title should combine data name and parameter for clarity. The following is a simplified code example with two plots. The first title doesn't show sigma as a math symbol, while the sec

[R] offset in glm

2020-02-27 Thread John Smith
It is simple to use the provided function glm as fit1 below. However, without the offset argument, I tried fit2 below. The reason I used fit2 is that (for X as predictors, b the coefficients) fit2: log(Claims/Holders) = Xb means fit1: log(Claims)=Xb + log(Holders) Obviously the results from fit2

Re: [R] Running Omega in R

2017-01-16 Thread John Smith
logy Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of peter dalgaard Sent: Sunday, January 15, 2017 2:27 PM To: Rui Barradas Cc: John Smith ; r-help@r-project.org Subject: Re: [R] Running Omega in R

[R] Running Omega in R

2017-01-15 Thread John Smith
Hi, I opened a question on stack overflow I’m hoping this mailing list can help with. I have a dataset below (this is made up but produces the same error I am getting) structure(list(Q1 = c(4, 5, 3, 5, 4, 5, 3, 5, 5, 5, 6, 3, 5, 4, 6, 5, 5, 6, 7, 4, 5, 5, 3, 4, 4, 5, 4, 3, 5, 4, 5, 5, 6, 6, 3,

[R] Creating Volatile Table in Teradata using RODBC

2015-02-15 Thread John Smith
Hi All I'm trying to use R to create a temporary table in Teradata and then add rows from data frame into the temporary volatile table in R Based on the code below (I have changed the SQL slightly), I am able to create the temporary table in my spool space but when I try add the data frame myd

[R] how to change annotations in contour function from rsm package

2014-04-04 Thread John Smith
Dear All, I am using R3.0.3 and rsm 2.04. Since I want do log transformation on my data, so I want change annotation of "Slice at ..". For example, I want change (Slice at W = 1.25, L=2) in the first graph into (Slice at W = log(1.25), L=log(2)). Can anyone tell me how can I change it? Thanks l

[R] how to set pch in auto.key for splom

2013-10-15 Thread John Smith
Dear All, I am using most current version of R (3.0.2) and lattice (0.20-24). But can not set appropriate pch type with the following code. Could anyone help me? splom(~iris[1:4], groups = iris$Species, pch=1:3, auto.key = list(space = 'top', columns = 3, pch=1:3)) Thanks John [[alt

Re: [R] appending and merging data frames

2013-02-07 Thread John Smith
t; Spotfire, TIBCO Software > wdunlap tibco.com > > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] >> On Behalf >> Of John Smith >> Sent: Thursday, February 07, 2013 9:59 AM >> To: David Winsemi

Re: [R] appending and merging data frames

2013-02-07 Thread John Smith
e: [R] appending and merging data frames > > > On Feb 7, 2013, at 9:12 AM, John Smith wrote: > >> Hi Gerrit, >> >> as I said in my original email, I already know both the >> merge and the rbind commands, but I think that many >> standard situations (I have giv

Re: [R] indexing operation based upon a sequence

2013-02-07 Thread John Smith
I think this is because some decimal numbers with a fixed number of digits after the decimal point cannot be represented as base-2 floating point numbers with a limited number of digits. So when one adds them up, the result is slightly different from the sum: huh1 = seq(.1,.7,.15) huh1 - 0.55 [1

Re: [R] appending and merging data frames

2013-02-07 Thread John Smith
iteSearch( "merge") > > > Hth -- Gerrit > > On Thu, 7 Feb 2013, John Smith wrote: > >> I know that the basic approach to append or merge data frames is using >> the rbind and merge commands. >> However, if I understand things correctly, for both

[R] appending and merging data frames

2013-02-07 Thread John Smith
I know that the basic approach to append or merge data frames is using the rbind and merge commands. However, if I understand things correctly, for both commands one needs to do quite some additional programming to get e.g. behavior as with the Stata append and morge commands or to achieve some

[R] use xyplot to plot mean and CI by groups

2012-05-29 Thread John Smith
Dear R users, I am trying to use xyplot to draw group mean and CI. The following is the sample code. But I want: 1. Use different colors and symbols to draw individual points, CI and the lines connect group means from different time points; 2. Add jitters to x axis to allow CIs not be ov

[R] Performing repeated T tests in R

2012-04-19 Thread John Smith
I need to perform 1 T tests #I have two populations with different means Popc1<-rnorm(10,10,2) Popc2<-rnorm(10,8,2) #I created two sets of samples - each set has 1 samples, and I made a matrix of 20 rows and 1 columns to fit the data sampc1<-matrix(,20,1) for(j in 1:1

[R] Performing t tests between matrices

2012-04-19 Thread John Smith
I need to perform 1 T tests #I have two populations with different means Popc1<-rnorm(10,10,2) Popc2<-rnorm(10,8,2) #I created two sets of samples - each set has 1 samples, and I made a matrix of 20 rows and 1 columns to fit the data sampc1<-matrix(,20,1) for(j in 1:10

Re: [R] can not use plot.Predict {rms} reproduce figure 7.8 from Regression Modeling Strategies (http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf)

2012-03-15 Thread John Smith
Sorry. I am still using the 9-11 March 2011 version of course2.pdf. On Wed, Mar 14, 2012 at 5:52 PM, David Winsemius wrote: > > On Mar 14, 2012, at 4:09 PM, John Smith wrote: > > With most current version of R and RMS, the 4 curves are drew in >> 4 separate panels. Can anyo

Re: [R] can not use plot.Predict {rms} reproduce figure 7.8 from Regression Modeling Strategies (http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf)

2012-03-14 Thread John Smith
:04 PM, John Smith wrote: > Dear R-users, > > I am using R 2.13.0 and rms 3.3-0 , but can not reproduce figure 7.8 of > the handouts *Regression Modeling Strategies* ( > http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf) by the > following code. Could any one help me

Re: [R] general question on Spotfire

2012-02-16 Thread John Smith
After one month of struggle, I lost confidence on Spotfire, it's totally not user-friendly. Yes it is very good for certain data presentation, but you still need do heavy lifting on data processing by other software. For me, R is the perfect tool and has best user supporting group. I send this emai

Re: [R] general question on Spotfire

2012-01-11 Thread John Smith
I am struggling whether I should learn Spotfire or not. I just want some statisticians inputs. Thanks On Wed, Jan 11, 2012 at 10:28 AM, Duncan Murdoch wrote: > On 12-01-11 10:13 AM, John Smith wrote: > >> Dear R users, >> >> I have been using R for 10 years, and I love

[R] general question on Spotfire

2012-01-11 Thread John Smith
Dear R users, I have been using R for 10 years, and I love it very much. But in my daily job for drug discovery, some people use Spotfire. I tried Spotfire on couple of data sets. It sounds I still need do some data manipulation before plot figures. For example, I can not plot figure with data arr

Re: [R] can not use plot.Predict {rms} reproduce figure 7.8 from Regression Modeling Strategies (http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf)

2011-05-17 Thread John Smith
Also I can not reproduce figure 7.11 by f <- Newlabels(f, list(turnout='voter turnout (%)')) windows() nomogram(f, interact=list(income=incomes), turnout=seq(30,100,by=10), lplabel='estimated % voting Democratic', cex.var=.8, cex.axis=.75) On Tue, May 17, 2011

[R] can not use plot.Predict {rms} reproduce figure 7.8 from Regression Modeling Strategies (http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf)

2011-05-17 Thread John Smith
Dear R-users, I am using R 2.13.0 and rms 3.3-0 , but can not reproduce figure 7.8 of the handouts *Regression Modeling Strategies* ( http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf) by the following code. Could any one help me figure out how to solve this? setwd('C:/Rharrell') re

[R] how to delete empty levels from lattice xyplot

2011-03-02 Thread John Smith
Hello All, I try to use the attached code to produce a cross over plot. There are 13 subjects, 7 of them in for/sal group, and 6 of them in sal/for group. But in xyplot, all the subjects are listed in both subgraphs. Could anyone help me figure out how to get rid of the empty levels? Thanks l

[R] lattice auto.key gives mismatch colors

2011-02-11 Thread John Smith
Hello All, I am using the following code to draw a figure. But the legend given buy auto.key has mismatched colors. Could any one help me? I am using R2.12.1 and most current lattice on windows XP. Thanks John library(lattice) src <- data.frame(t=rep(c('A','B','C','D'), rep(8,4)),

[R] need help in understanding R code, and maybe some math

2010-05-22 Thread john smith
Hi, I am trying to implement Higham's algorithm for correcting a non positive definite covariance matrix. I found this code in R: http://projects.cs.kent.ac.uk/projects/cxxr/trac/browser/trunk/src/library/Recommended/Matrix/R/nearPD.R?rev=637 I managed to understand most of it, the only line I rea

[R] bug in R2WinBUGS

2009-01-09 Thread John Smith
In newest version of R2WinBUGS, the default directory is changed to working.directory, but never changed back once finished bugs call. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinf

Re: [R] Lattice: How to draw curves from given formulae

2008-08-04 Thread John Smith
d) + umbrella(d) + emax(d) + sigmoid(d) ~ d, data = list(d = seq(0, 8, length = 101)), ylab='Expected change from baseline in VAS at Week 6', xlab='Dose', type = "l", outer = TRUE, ) Many thanks On Tue, Jul 22, 2008 at 4:31 PM, Deepaya

Re: [R] Lattice: How to draw curves from given formulae

2008-07-22 Thread John Smith
ECTED]> wrote: > On 7/21/08, John Smith <[EMAIL PROTECTED]> wrote: > > Dear R Users: > > > > I have a list function as: > > Flat: y = 0 > > Linear: y = -(1.65/8)d > > Logistic: y = 0.015 - 1.73/{1+exp[1.2(4-d)]} > > Umbrella: y= -(1.65/3)d

[R] Lattice: How to draw curves from given formulae

2008-07-22 Thread John Smith
Dear R Users: I have a list function as: Flat: y = 0 Linear: y = -(1.65/8)d Logistic: y = 0.015 - 1.73/{1+exp[1.2(4-d)]} Umbrella: y= -(1.65/3)d + (1.65/36)d^2 Emax: y = -1.81d/(0.79+d) Sigmoid Emax: y = -1.70d^5/(4^5+d^5) And want draw the figure as attached (those material are extracted from a

[R] how to draw multiples curses (for given formulae) in lattice

2008-07-21 Thread John Smith
Dear R Users, Could you please write a piece of code to draw Figure 5.9 of "Mixed-Effects Models in S and S-Plus"? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PL

Re: [R] how to plot an user-defined function

2008-02-06 Thread John Smith
942554 > > 0.56464247 0.64421769 0.71735609 > > [10] 0.78332691 0.84147098 0.89120736 0.93203909 0.96355819 0.98544973 > > 0.99749499 0.99957360 0.99166481 > > [19] 0.97384763 0.94630009 0.90929743 > > > > > > So you either have to rewrite your function, or have

[R] how to plot an user-defined function

2008-02-05 Thread John Smith
Dear R-users, Suppose I have defined a likelihood function as ll(tau), how can I plot this likelihood function by calling it by plot? I want to do it like this: ll <- function(tau) { w <- 1 / (s^2 + tau^2) mu <- sum(theta * w) / sum(w) -1/2*sum((theta-mu)^2*w -log(w)) } plot(ll,

[R] R2WinBUGS is broken

2008-01-31 Thread John Smith
Dear R-users, I am trying to use the following code to reproduce results from Prof. Gelman's book, but have the listed error for R2WinBUGS version (the openbugs version is good). I am using R-2.6.1 on windows XP, and all the R packages are most current ones. schools.bug can be found at http://www.

[R] Hmisc: can not reproduce figure 4 of Statistical Tables and Plots using S and LATEX

2007-11-24 Thread John Smith
Dear R-users: I can not reproduce figure 4 of *Statistical Tables and Plots using S and LATEX* by Prof. Frank Harrell with the following code: rm(list=ls()) library(Hmisc) getHdata(pbc) attach(pbc) age.groups <- cut2(age, c(45,60)) g <- function(y) apply(y, 2, quantile, c(.25,.5,.75)) y <- with(

[R] plot.Design

2007-10-19 Thread John Smith
Dear R-users: I am trying to use the following code to reproduce the figures on page 140 of Prof. Frank Harrell's book 'Regression Modeling Strategies': rm(list=ls()) options(width=128) library(Hmisc) library(Design) getHdata(counties) counties$older <- counties$age6574 + counties$age75 label(co

[R] R: anova.Design

2007-09-26 Thread John Smith
Dear All: I tried to replicate a case study described by Prof. Harrell in Chapter 7 of his Regression Modeling Strategies book, but failed on using anova.Design to reproduce his table 7.1, Following is the code: rm(list=ls()) library(Hmisc) library(Design) getHdata(counties) counties$older <- c