search for: infl

Displaying 20 results from an estimated 39 matches for "infl".

Did you mean: inf
2012 Feb 09
1
passing an extra argument to an S3 generic
I'm trying to write some functions extending influence measures to multivariate linear models and also allow subsets of size m>=1 to be considered for deletion diagnostics. I'd like these to work roughly parallel to those functions for the univariate lm where only single case deletion (m=1) diagnostics are considered. Corresponding to...
2007 Nov 12
0
Resid() and estimable() functions with lmer
Hi all, Two questions: 1. Is there a way to evaluate models from lmer() with a poisson distribution? I get the following error message: library(lme4) lmer(tot.fruit~infl.treat+def.treat+(1|initial.size),family=poisson)->model plot(fitted(model),resid(model)) Error: 'resid' is not implemented yet Are there any other options? 2. Why doesn't the function estimable() in gmodels work with lmer() using a poisson distribution? I know that my coefficient...
2007 Oct 29
3
Strange results with anova.glm()
Hi, I have been struggling with this problem for some time now. Internet, books haven't been able to help me. ## I have factorial design with counts (fruits) as response variable. > str(stubb) 'data.frame': 334 obs. of 5 variables: $ id : int 6 23 24 25 26 27 28 29 31 34 ... $ infl.treat : Factor w/ 2 levels "0","1": 2 2 2 2 1 1 1 2 1 1 ... $ def.treat : Factor w/ 4 levels "1","2","3","4": 2 3 1 3 3 3 2 2 3 1 ... $ initial.size : num 854 158 256 332 396 ... $ tot.fruit : int 45 8 19 8 10 7 4 7 2 6 ... ## I fit a glm...
2003 Apr 07
1
filtering ts with arima
...that I'd like to migrate to R. So far, the only problem is the arima.filt function. This function allows me to filter an existing time-series through a previously estimated arima model, and obtain the residuals for further use. Here's the Splus code: # x is the estimation time series, new.infl is a timeseries that contains new information # a.mle is estimated result (list) from arima.mle, (1,0,1) x (1,0,1)12 seasonal model mdl _ list(list(order=c(1,0,1)), list(order=c(1,0,1), period=12)) a.mle _ arima.mle(x, model = mdl) # then, we get regular residuals: new.pred _ arima.filt(ne...
2005 Apr 13
2
multinom and contrasts
...the same. Why is that? and for multinomial logisitc regression, what contrast should be used? I guess it's helmert? here is an example script: library(MASS) library(nnet) #### multinomial logistic options(contrasts=c('contr.treatment','contr.poly')) xx<-multinom(Type~Infl+Cont,data=housing[-c(1,10,11,22,25,30),]) yy<-predict(xx,type='probs') yy[1:10,] options(contrasts=c('contr.helmert','contr.poly')) xx<-multinom(Type~Infl+Cont,data=housing[-c(1,10,11,22,25,30),]) zz<-predict(xx,type='probs') zz[1:10,] ##### binary...
2008 Sep 30
2
weird behavior of drop1() for polr models (MASS)
...main effects models, however when the model includes an interaction effect it seems to have problems with matching the parameters to the predictor terms. An example: library("MASS"); options(contrasts = c("contr.treatment", "contr.poly")); house.plr1 <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing); drop1(house.plr1,attributes(house.plr1$terms)$term.labels,test="Chisq"); house.plr2 <- polr(Sat ~ Infl * Type + Cont, weights = Freq, data = housing); drop1(house.plr2,attributes(house.plr2$terms)$term.labels,test="Chisq"); N...
2011 Mar 14
3
Standardized Pearson residuals
...and deviance residuals are not used in the text. For now I'll just provide the students with a simple function to use, but I prefer to use R's native capabilities whenever possible. I think something along the following lines should do it: rstandard.glm <- function(model, infl=influence(model, do.coef=FALSE), type=c("deviance", "pearson"), ...) { res <- switch(type, pearson = infl$pear.res, infl$dev.res) res <- res/sqrt(1-infl$hat) res[is.infinite(res)] <- NaN res }
2004 Jan 08
3
Strange parametrization in polr
.... Is this a bug og a feature I have overlooked? Here is the naked code for reproduction, below the results. ------------------------------------------------------------------------ --- version library( MASS ) data( housing ) hnames <- lapply( housing[,-5], levels ) house.plr <- polr( Sat ~ Infl + Type + Cont, data=housing, weights=Freq ) summary( house.plr ) newdat <- expand.grid( hnames[-1] )[1:5,] cbind( newdat, predict( house.plr, newdat, type="probs" ) ) # Baseline probs: diff( c(0,tigol( c(-0.4961,0.6907) ), 1) ) # First level of Infl: diff( c(0,tigol( c(-0.4961,0.6907)...
2003 May 05
3
polr in MASS
Hi, I am trying to test the proportional-odds model using the "polr" function in the MASS library with the dataset of "housing" contained in the MASS book ("Sat" (factor: low, medium, high) is the dependent variable, "Infl" (low, medium, high), "Type" (tower, apartment, atrium, terrace) and "Cont" (low, high) are the predictor variables (factors). And I have some questions, hope someone could help me out. The following commands are from the MASS book as well. > house.plr<-polr(Sat~Infl+...
2012 Apr 30
5
Different varable lengths
...accepts 9 observations in two of the objects. The third must have 10! Very confusing because there is no 10th observation! # Adjusted Real rate - P > Sweden.p.adjust <- c(4.70243, 1.3776655, 1.117755, 1.6695175, 1.59282, > 1.1017625, -0.04295, 2.2552875, 0.0552875) > > # Adjusted Inflation deviation > Sweden.infl.dev.adjust <- c(0.110382497, -0.261612509, 0.040847515, > -0.195062497, -0.234362485, -0.023408728, 0.206421261, -0.079401261, > 0.071828752) > > # Adjusted GDP-gap > Sweden.GDP.gap.adjust <- c(0.673792123, 1.196706756, 1.196131539, > 0.6469...
2005 Dec 06
1
standardized residuals (rstandard & plot.lm) (PR#8367)
...near-zero rstandard(Uniform)[as.logical(diag(8))] #mostly Inf/NaN plot(Uniform) #breaks on qqnorm plot (or any 'which' > 1) This could be fixed by replacing standardized residuals with zero where the hat value is one, e.g. rstandard.glm <- function (model, infl = lm.influence(model, do.coef = FALSE), ...) { res <- infl$wt.res hat <- infl$hat ifelse(hat == 1, 0, res/sqrt(summary(model)$dispersion * (1 - infl$hat))) } etc.
2009 Dec 10
2
Problem with coeftest using Newey West estimator
Hi, I want to calculate the t- and p-values for a linear model using the Newey West estimator. I tried this Code and it usually worked just fine: > oberlm <- lm(DYH ~ BIP + Infl + EOil, data=HU_H) > coeftest(oberlm, NeweyWest(oberlm, lag=2)) t test of coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.1509950 0.0743832 2.0300 0.179486 BIP -5.5131683 1.2536813 -4.3976 0.048016 * Infl -0.0623530 0.0036215 -...
2009 Oct 31
2
Logistic and Linear Regression Libraries
Hi all, I'm trying to discover the options available to me for logistic and linear regression. I'm doing some tests on a dataset and want to see how different flavours of the algorithms cope. So far for logistic regression I've tried glm(MASS) and lrm (Design) and found there is a big difference. Is there a list anywhere detailing the options available which details the specific
2004 Jan 20
2
rstandard.glm() in base/R/lm.influence.R
...the dispersion is inside the sqrt". (That's the way I read 12.5 on p. 397 too). I can't see that summary(model)$dispersion has already been subject to sqrt() in sum(object$weights * object$residuals^2)/df.r in summary.glm(). Should: res / (summary(model)$dispersion * sqrt(1 - infl$hat)) be: res / (sqrt(summary(model)$dispersion * (1 - infl$hat))) on line 117 in base/R/lm.influence.R? Best wishes, Roger -- Roger Bivand Econonic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, N...
2008 Jan 05
1
Likelihood ratio test for proportional odds logistic regression
...he Wald test and the likelihood ratio test to give similar p-values. However the p-values obtained from anova(fit1,fit3) (refer to example below) are very different (0.0002622986 vs. 1). Why is this so? > library(MASS) > fit1 <- polr(housing$Sat~1) > fit2<- polr(housing$Sat~housing$Infl) > fit3<- polr(housing$Sat~housing$Cont) > summary(fit1) Re-fitting to get Hessian Call: polr(formula = housing$Sat ~ 1) No coefficients Intercepts: Value Std. Error t value Low|Medium -0.6931 0.2500 -2.7726 Medium|High 0.6931 0.2500 2.7726 Residual Deviance:...
2009 Nov 13
1
dfbetas vs dfbeta
Hi, I've looked around but can't find a clear answer to the difference for these two? Any help? Thanks! -- View this message in context: http://old.nabble.com/dfbetas-vs-dfbeta-tp26331704p26331704.html Sent from the R help mailing list archive at Nabble.com.
2012 Apr 24
1
nobs.glm
Hi all, The nobs method of (MASS:::polr class) takes into account of weight, but nobs method of glm does not. I wonder what is the rationale of such design behind nobs.glm. Thanks in advance. Best Regards. > library(MASS) > house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) > house.logit <- glm(I(Sat=='High') ~ Infl + Type + Cont, binomial,weights = Freq, data = housing) > nobs(house.plr) [1] 1681 > nobs(house.logit) [1] 72 -- Wincent Ronggui HUANG Sociology Department of Fudan University PhD of Cit...
2004 Nov 11
1
polr probit versus stata oprobit
Dear All, I have been struggling to understand why for the housing data in MASS library R and stata give coef. estimates that are really different. I also tried to come up with many many examples myself (see below, of course I did not have the set.seed command included) and all of my `random' examples seem to give verry similar output. For the housing data, I have changed the data into numeric
2010 May 26
2
extracat , JGR, iWidgets install problems
...ons how to make this work? > > library(extracat) Loading required package: reshape Loading required package: plyr Loading required package: grid Loading required package: MASS > ?irmb starting httpd help server ... done > data(housing) > # example 1 > irmb(~Type+Infl+Cont+Sat,dset=housing,expected = TRUE, + eqwidth=FALSE,base=0.2,mult=2,lab.tv=TRUE,abbr=TRUE) iWidgets requires 'JGR' in order to run correctly. Please visit http://www.rosuda.org/software/ to download it.> > utils:::menuInstallPkgs() trying URL 'http://probability.ca...
2003 Jan 29
1
Scoping rule problem -- solved
Thanks to some comments from Brian D. Ripley, I found my error: I should not have given a data argument to lm() after creating a formula-object. This obviously confused things... Thanks again, I've really learnt again a bit more on R-programming... Cheers, Winfried --------------------------------------------------------------------- E-Mail: Winfried Theis <theis at