search for: hatvalues

Displaying 20 results from an estimated 30 matches for "hatvalues".

2012 Feb 09
1
passing an extra argument to an S3 generic
...easures 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 stats::hatvalues.lm, the S3 method for class "lm" objects, > hatvalues <-function (model, ...) UseMethod("hatvalues") > hatvalues.lm <- function (model, infl = lm.influence(model, do.coef = FALSE), ...) { hat <- infl$hat names(hat) <- names(infl$wt.res) ha...
2009 Nov 08
2
influence.measures(stats): hatvalues(model, ...)
Hello: I am trying to understand the method 'hatvalues(...)', which returns something similar to the diagonals of the plain vanilla hat matrix [X(X'X)^(-1)X'], but not quite.  A Fortran programmer I am not, but tracing through the code it looks like perhaps some sort of correction based on the notion of 'leave-one-out' variance is...
2009 Mar 05
1
hatvalues?
I am struiggling a bit with this function 'hatvalues'. I would like a little more undrestanding than taking the black-box and using the values. I looked at the Fortran source and it is quite opaque to me. So I am asking for some help in understanding the theory. First, I take the simplest case of a single variant. For this I turn o John Fox'...
2008 Nov 20
2
Identify command in R
Hi all, In using the identify command, I get the following message > plot(hatvalues(scireg3)) > abline(h=.0154,lty=2) # plots a reference line at (k + 1)/n > identify(1:1165, hatvalues(scireg3),row.names(sciach)) Error in xy.coords(x, y) : 'x' and 'y' lengths differ which doesn't allow me to see the observation number when I scroll over with the mo...
2013 Mar 12
1
Cook's distance
...mula for Cook's distance can be found for example here: http://en.wikipedia.org/wiki/Cook%27s_distance I tried to apply it in R: > y <- (1:400)^2 > x <- 1:100 > lm(y~x) -> linmod # just for the sake of a simple example > linmod$residuals[1]^2/(2*mean(linmod$residuals^2))*(hatvalues(linmod)[1]/(1-hatvalues(linmod)[1])^2) 1 0.02503195 > cooks.distance(linmod)[1] 1 0.02490679 Why differ the two results? Thanks a lot if somebody have some instructions for me. Best wishes: Kolos
2007 Oct 19
2
In a SLR, Why Does the Hat Matrix Depend on the Weights?
I understand that the hat matrix is a function of the predictor variable alone. So, in the following example why do the values on the diagonal of the hat matrix change when I go from an unweighted fit to a weighted fit? Is the function hatvalues giving me something other than what I think it is? library(ISwR) data(thuesen) attach(thuesen) fit <- lm(short.velocity ~ blood.glucose) summary(fit) hatvalues(fit) W <- 1/blood.glucose fit.w <- lm(short.velocity ~ blood.glucose,weights=W) summary(fit.w) hatvalues(fit.w)...
2008 Nov 20
2
Identify command in R]
Let me try to be more specific. The x y coordinates are different because of NAs in the dataset. In this analysis, a set of hat values (a measure of influence in regression) is given for each observation. On the basis of the regression that was run to get these hat values, the sample size was 1164 (one removed due to NA). The length of the data set is 1165. If I remove the NA from the
2003 Jul 12
1
Problem with library "car"
...Macintosh. I recently upgraded from version 1.6.0 and found that the "car" library now has a problem: ---Begin transcript--- >library(car) Attaching package 'car': The following object(s) are masked from package:base : dfbeta dfbeta.lm dfbetas dfbetas.lm hatvalues hatvalues.lm influence influence.glm influence.lm rstudent rstudent.glm rstudent.lm >x <- 1:10 >y <- 2*x+3+2*rnorm(10) >model<-lm(y~x) >qq.plot(model) Bus error ---End transcript--- No plot appears. After the bus error, R no longer operates normally, and I have to kill the...
2006 Jan 12
1
Firths bias correction for log-linear models
...h_i=1 for all i, hence one just adds 1/2 to each count, which is equivalent to the Jeffrey's prior, but I'd also like to get bias corrected estimates for other log linear models. It appears that I need to iterate using GLM, with the weights option and h_i, which I can get from the function hatvalues. For logistic regression, this can be performed by splitting up each observation into response and nonresponse, and using weights as described in Heinze, G. and Schemper, M. (2002), but I'm unsure of how to implement the analogue for log-linear models. A procedure using IWLS is described by Fir...
2009 Apr 06
6
Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
Hi there, I hope I can get advice regarding the calculation of leverage values or studentized residual values of a non-linear regression model. It seems like rstudent() does not work on a nls object. Many thanks in advance! Best regards, Xingli
2011 Jun 24
3
Error using betareg
....1=betareg(Y~X1+X2,data=dump) summary(f2.1) I get : Call: betareg(formula = Y ~ X1 + X2, data = dump) Standardized weighted residuals 2: Error in quantile.default(x$residuals) : missing values and NaN's not allowed if 'na.rm' is FALSE In addition: Warning message: In sqrt(v * (1 - hatvalues(object))) : NaNs produced Does anybody know how to fix this? Oyvind -- View this message in context: http://r.789695.n4.nabble.com/Error-using-betareg-tp3621955p3621955.html Sent from the R help mailing list archive at Nabble.com.
2016 Apr 10
0
R.squared in summary.lm with weights
Martin - Thanks, but although hatvalues() is useful for calculating PRESS, I can't find anything directly relevant to my question in the influence help pages. After some burrowing in the literature I'm doubting there is an answer out there (PRESS R^2 is always presented in a fairly ad hoc way). This is a new topic, as you say, an...
2016 Apr 09
2
R.squared in summary.lm with weights
>>>>> Murray Efford <murray.efford at otago.ac.nz> >>>>> on Fri, 8 Apr 2016 18:45:33 +0000 writes: > Thanks for these perfectly consistent replies - I didn't > understand the purpose of m = sum(w * f/sum(w)) and saw it > merely as a weighted average of the fitted values. My > ultimate concern is how to compute an appropriate
2016 Apr 10
2
R.squared in summary.lm with weights
> On Apr 10, 2016, at 3:11 AM, Murray Efford <murray.efford at otago.ac.nz> wrote: > > Martin - > Thanks, but although hatvalues() is useful for calculating PRESS, I can't find anything directly relevant to my question in the influence help pages. After some burrowing in the literature I'm doubting there is an answer out there (PRESS R^2 is always presented in a fairly ad hoc way). > This is a new topic, as you sa...
2013 May 01
1
Trouble with methods() after loading gdata package.
...uot;lm") [1] add1.lm* alias.lm* anova.lm case.names.lm* [5] confint.lm* cooks.distance.lm* deviance.lm* dfbeta.lm* [9] dfbetas.lm* drop1.lm* dummy.coef.lm* effects.lm* [13] extractAIC.lm* family.lm* formula.lm* hatvalues.lm [17] influence.lm* kappa.lm labels.lm* logLik.lm* [21] model.frame.lm model.matrix.lm nobs.lm* plot.lm [25] predict.lm print.lm proj.lm* qr.lm* [29] residuals.lm rstandard.lm rstudent.lm simulate.lm* [33] summ...
2006 Aug 31
1
NaN when using dffits, stemming from lm.influence call
...nd on some platforms not detecting hat = 1 correctly. The last sentence identifies NaN being reported for sigma, as I find with my data. But my data do not have hat = 1, but the hat diagonals are large. The troublesome Observation 3 does not have the largest hat value in the data though: > hatvalues(dep.glm2) 1 2 3 4 5 6 7 8 0.1689061 0.1064651 0.9098542 0.9030814 0.3799079 0.6382790 0.9327408 0.9607654 And besides, I am using the most recent version of R (see below). BTW, the NaNs appear in the previous version of R also. S...
2016 Apr 10
0
R.squared in summary.lm with weights
> On Apr 10, 2016, at 9:38 AM, David Winsemius <dwinsemius at comcast.net> wrote: > >> >> On Apr 10, 2016, at 3:11 AM, Murray Efford <murray.efford at otago.ac.nz> wrote: >> >> Martin - >> Thanks, but although hatvalues() is useful for calculating PRESS, I can't find anything directly relevant to my question in the influence help pages. After some burrowing in the literature I'm doubting there is an answer out there (PRESS R^2 is always presented in a fairly ad hoc way). >> This is a new topic, as yo...
2003 Nov 03
1
Questions in R
Hello, I have 4 questions in R and I am looking for 4 answers! the questions are the below: 1) is there a function in R for the Least Significant Difference method for multiple comparisons? 2) Is there a function in R that gives me the studentized deleted residuals and the leverage points? 3) is there a way that I could create a link in a program of mine, so as to select an option when my program
2004 Apr 08
1
R/Splus code for PRESS?
Dear R-help, Does anybody know where can I find R/Splus code for computing PREdiction Sum of Squares (PRESS) in a linear regression model? I have a large regression model (~100 predictors, ~30,000 cases) and good prediction is the main goal. I remember there is a faster way to compute it (no need to repeatedly fit models), but if there is existing code...... Thanks. Mai Z
2005 Jul 14
0
Pearson dispersion statistic
...lies. However, for the inverse Gaussian, the choice seems to me less clear cut. So I just wanted to compare two different options. I have used the dispersion parameter to compute the standardized deviance residuals: summary(model.gamma)$deviance.resid /(summary(model.gamma)$dispersion * (1 - hatvalues(model.gamma)))^0.5 I noticed differences with Genstat which outputs these stand. dev. residuals directly, and they are explained by the automatic use of deviance instead of Pearson. Kind regards, Robin Smit -----Original Message----- From: Prof Brian Ripley [mailto:ripley@stats.ox...