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
. It 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
tant, 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 logLik

Re: [R] Passing formula and weights error

2020-08-28 Thread John Smith
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 28, 2020 at 8:33 AM John S

[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 -> ->

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 individ

[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

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

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 > > On 8/

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

[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

[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

Re: [R] Running Omega in R

2017-01-16 Thread John Smith
y Texas A 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 <ruipbarra...@sapo.pt> Cc: John Smith <jsmith.cours...@outlook.com>; r-he

[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

[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

[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

[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

Re: [R] appending and merging data frames

2013-02-07 Thread John Smith
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 commands one needs to do quite some additional programming to get e.g. behavior as with the Stata append and morge

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

Re: [R] appending and merging data frames

2013-02-07 Thread John Smith
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 given just a few) require rather clumsy ad-hoc programming. So I was wondering

Re: [R] appending and merging data frames

2013-02-07 Thread John Smith
is a beginner). -Original Message- From: dwinsem...@comcast.net Sent: Thu, 7 Feb 2013 09:46:02 -0800 To: johsmi9...@inbox.com Subject: Re: [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

[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

[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

[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

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 dwinsem...@comcast.netwrote: 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 anyone

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 zmr...@gmail.com 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 figure

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

[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

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 murdoch.dun...@gmail.comwrote: On 12-01-11 10:13 AM, John Smith wrote: Dear R users, I have been using R for 10 years, and I love it very

[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] 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 at 4:04 PM, John Smith

[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

[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-23 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

[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

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

2008-08-04 Thread John Smith
, 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, Deepayan Sarkar [EMAIL PROTECTED]wrote: On 7/22/08, John Smith [EMAIL PROTECTED] wrote

[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

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

2008-07-22 Thread John Smith
: 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 + (1.65/36)d^2 Emax: y = -1.81d/(0.79+d) Sigmoid Emax: y = -1.70d^5/(4^5+d^5

[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

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

2008-02-06 Thread John Smith
either have to rewrite your function, or have a loop that will evaluate the function at each individual point and then plot it. Or use Vectorize, e.g. plot(Vectorize(ll), 0, 2) Duncan Murdoch On Feb 5, 2008 7:06 PM, John Smith [EMAIL PROTECTED] wrote: Dear R-users, Suppose I have

[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

[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 -