Re: [R] car::deltaMethod() fails when a particular combination of categorical variables is not present

2023-10-07 Thread Michael Cohn
Thank you very much, John. This has allowed us to move forward on several fronts and better understand our data. - Michael Cohn On Tue, Sep 26, 2023 at 8:39 AM John Fox wrote: > Dear Michael, > > My previous response was inaccurate: First, linearHypothesis() *is* able > to accommodate aliased c

Re: [R] car::deltaMethod() fails when a particular combination of categorical variables is not present

2023-09-26 Thread John Fox
Dear Michael, My previous response was inaccurate: First, linearHypothesis() *is* able to accommodate aliased coefficients by setting the argument singular.ok = TRUE: > linearHypothesis(minimal_model, "bt2 + csent + bt2:csent = 0", + singular.ok=TRUE) Linear hypothesis test:

Re: [R] car::deltaMethod() fails when a particular combination of categorical variables is not present

2023-09-26 Thread John Fox
Dear Michael, You're testing a linear hypothesis, so there's no need to use the delta method, but the linearHypothesis() function in the car package also fails in your case: > linearHypothesis(minimal_model, "bt2 + csent + bt2:csent = 0") Error in linearHypothesis.lm(minimal_model, "bt2 + cse

[R] car::deltaMethod() fails when a particular combination of categorical variables is not present

2023-09-25 Thread Michael Cohn
I'm running a linear regression with two categorical predictors and their interaction. One combination of levels does not occur in the data, and as expected, no parameter is estimated for it. I now want to significance test a particular combination of levels that does occur in the data (ie, I want

Re: [R] CAR

2017-02-14 Thread Bert Gunter
Rseek.org brings up what look like relevant hits on "conditional autoregressive models." Have you looked at these? If so and they do not suit, perhaps you should explain why not. If they do, please do such searching on your own in future. Cheers, Bert Bert Gunter "The trouble with having an ope

[R] CAR

2017-02-14 Thread Siswanto Sumargo
*I would like to simulate spatial data conditional **autoregressive (CAR) model with weighted matrix order 2**Is there any package or function in R to perform it ? **Thanks in advance* *Best Regards Siswanto* -- *Siswanto* Department of Statistics, Faculty of Mathematics and Natural Science Bogo

Re: [R] {car} outlierTest looses p/q values

2014-10-21 Thread John Fox
Dear Phil, I'll bypass questions about why one would want to do this, why you're using glm() rather than lm(), etc., and just point out that the *studentized* residual for the 11th observation is undefined for your example. Simplifying your code: snip --- > y <- c(1.00,1.00,1.00,

Re: [R] {car} outlierTest looses p/q values

2014-10-21 Thread Phil
Hi all, as John pointed out, there is a way to create settings where the studentized residuals are undefined. However, after cross-checking it seems that the residuals are getting calculated without any error. The problem comes up when I use outlierTest to assign a p,q value,respectively. Be

Re: [R] {car} outlierTest looses p/q values

2014-10-17 Thread John Fox
Dear Phil, Yes, that's a bit clearer. One can invent data configurations where certain studentized residuals are undefined. For example, try the following: y <- c(0, 0, 0, 0, 0, 1) x <- 1:6 xx <- (1:6 - 3.5)^2 rstudent(lm(y ~ x)) rstudent(lm(y ~ xx)) plot(x, y) plot(xx, y) The plots should clar

Re: [R] {car} outlierTest looses p/q values

2014-10-17 Thread John Fox
Dear Phil, After reading your posting several times, I still don't understand what you did. As usual, having a reproducible example illustrating the error would be a great help. I do have a guess about the source of the error: glm() failed in some way for the problematic case. Best, John ---

[R] {car} outlierTest looses p/q values

2014-10-17 Thread Phil
Hi guys, I came across a strange phenomena and can't figure out why it happens by myself so here we go. I got a dataframe which consists of double numbers which I want to check, row-wise if there are outliers in the rows. So I iterate over the rows and create a glm using the numbers of that

Re: [R] car::linearHypothesis Sum of Sqaures Error?

2012-10-09 Thread John Jay Wiley Jr.
: Tuesday, October 09, 2012 4:00 PM To: John Jay Wiley Jr. Cc: r-help@r-project.org Subject: RE: [R] car::linearHypothesis Sum of Sqaures Error? Dear John, > -Original Message- > From: John Jay Wiley Jr. [mailto:jwile...@syr.edu] > Sent: Tuesday, October 09, 2012 3:37 PM > To: J

Re: [R] car::linearHypothesis Sum of Sqaures Error?

2012-10-09 Thread John Fox
Dear John, > -Original Message- > From: John Jay Wiley Jr. [mailto:jwile...@syr.edu] > Sent: Tuesday, October 09, 2012 3:37 PM > To: John Fox > Cc: r-help@r-project.org > Subject: RE: [R] car::linearHypothesis Sum of Sqaures Error? > > John, > > A

Re: [R] car::linearHypothesis Sum of Sqaures Error?

2012-10-09 Thread John Jay Wiley Jr.
variances are similar. Is there another metric I am missing for a continuous covariate? Cheers, John From: John Fox [j...@mcmaster.ca] Sent: Tuesday, October 09, 2012 2:59 PM To: John Jay Wiley Jr. Cc: r-help@r-project.org Subject: RE: [R] car::linearHypo

Re: [R] car::linearHypothesis Sum of Sqaures Error?

2012-10-09 Thread John Fox
Dear John, > -Original Message- > From: John Jay Wiley Jr. [mailto:jwile...@syr.edu] > Sent: Tuesday, October 09, 2012 9:17 AM > To: John Fox > Cc: r-help@r-project.org > Subject: RE: [R] car::linearHypothesis Sum of Sqaures Error? > > John, > > Thank yo

Re: [R] car::linearHypothesis Sum of Sqaures Error?

2012-10-09 Thread John Jay Wiley Jr.
l and Forest Biology 460 Illick Hall Syracuse, NY 13210 315.470.4825 (office) 740.590.6121 (cell) From: John Fox [j...@mcmaster.ca] Sent: Tuesday, October 09, 2012 7:15 AM To: John Jay Wiley Jr. Cc: r-help@r-project.org Subject: Re: [R] car::linearHypothe

Re: [R] car::linearHypothesis Sum of Sqaures Error?

2012-10-09 Thread John Fox
Dear John On Tue, 9 Oct 2012 02:07:07 + "John Jay Wiley Jr." wrote: > I am working with a RCB 2x2x3 ANCOVA, and I have noticed a difference in the > calculation of sum of squares in a Type III calculation. For type III tests, you should use contrasts that are orthogonal in the row basis o

[R] car::linearHypothesis Sum of Sqaures Error?

2012-10-09 Thread John Jay Wiley Jr.
I am working with a RCB 2x2x3 ANCOVA, and I have noticed a difference in the calculation of sum of squares in a Type III calculation. Anova output is a follows: > Anova(aov(MSOIL~Forest+Burn*Thin*Moisture+ROCK,data=env3l),type=3) Anova Table (Type III tests) Response: MSOIL

Re: [R] car::linearHypothesis fails to constrain factor to zero

2012-08-15 Thread John Fox
Pr(>F) 1 45 322.54 2 44 311.97 110.567 1.4903 0.2287 Best, John > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Iuri Gavronski > Sent: August-15-12 4:47 AM > To: r-help >

[R] car::linearHypothesis fails to constrain factor to zero

2012-08-15 Thread Iuri Gavronski
Hi, I am trying to test whether a factor (coded as a set of dummy variables) is equal to zero, using linearHypothesis. I get an error. See a reproducible example: data(swiss) my_swiss = swiss my_swiss$fake = factor(sample(c("A","B"),47,rep=T)) my_lm <- lm(Infant.Mortality ~ Fertility + fake, data

Re: [R] car::Anova - Can it be used for ANCOVA with repeated-measures factors.

2012-07-23 Thread peter dalgaard
On Jul 23, 2012, at 02:48 , John Fox wrote: [snip long discussion which I admit not to have studied in every detail...] >> >> Unfortunately, my involvement with this issue has led me to another >> question. Winer and Kirk both discuss a split-plot ANCOVA in which one has >> measured a covaria

Re: [R] car::Anova - Can it be used for ANCOVA with repeated-measures factors.

2012-07-22 Thread John Fox
F value Pr(>F) > >> (Intercept) 3.01 11.40 0.264 > >> treatment 13.71 23.18 0.085 . > >> age11.56 15.37 0.043 * > >> treatment:age 13.37 23.11 0.089 . > >> Residuals 21.53 10 > >> --- > >&g

Re: [R] car::Anova - Can it be used for ANCOVA with repeated-measures factors.

2012-07-22 Thread Henrik Singmann
s Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox -----Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Henrik Singmann Sent: July-21-12 1:29 PM To: r-h...@stat.math.ethz.ch Subject: [R]

Re: [R] car::Anova - Can it be used for ANCOVA with repeated-measures factors.

2012-07-22 Thread John Fox
m not sure why > > you would want to do so, but you could simply ignore these tests. > > > > I hope this helps, > > John > > > > > > John Fox > > Senator William McMaster > >Professor of Social Statistics &

Re: [R] car::Anova - Can it be used for ANCOVA with repeated-measures factors.

2012-07-22 Thread Henrik Singmann
- project.org] On Behalf Of Henrik Singmann Sent: July-21-12 1:29 PM To: r-h...@stat.math.ethz.ch Subject: [R] car::Anova - Can it be used for ANCOVA with repeated- measures factors. Dear list, I would like to run an ANCOVA using car::Anova with repeated measures factors, but I can't figure

Re: [R] car::Anova - Can it be used for ANCOVA with repeated-measures factors.

2012-07-22 Thread John Fox
..@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Henrik Singmann > Sent: July-21-12 1:29 PM > To: r-h...@stat.math.ethz.ch > Subject: [R] car::Anova - Can it be used for ANCOVA with repeated- > measures factors. > > Dear list, > > I would like to r

[R] car::Anova - Can it be used for ANCOVA with repeated-measures factors.

2012-07-21 Thread Henrik Singmann
Dear list, I would like to run an ANCOVA using car::Anova with repeated measures factors, but I can't figure out how to do it. My (between-subjects) covariate always interacts with my within-subject factors. As far as I understand ANCOVA, covariates usually do not interact with the effects of

Re: [R] car/MANOVA question

2012-03-19 Thread John Fox
Dear Ranjan, As you no doubt noticed, the Manova() function in the car package, or the Anova() function for which Manova() is an alias, produces type II or III tests for a multivariate linear model. To compare two nested multivariate linear models, as you wish to do, you can use the standard R

[R] car/MANOVA question

2012-03-19 Thread Ranjan Maitra
Dear colleagues, I had a question wrt the car package. How do I evaluate whether a simpler multivariate regression model is adequate? For instance, I do the following: ami <- read.table(file = "http://www.public.iastate.edu/~maitra/stat501/datasets/amitriptyline.dat";, col.names=c("TCAD", "drug"