similar to: unexpected behaviour in lm() (PR#3657)

Displaying 20 results from an estimated 20000 matches similar to: "unexpected behaviour in lm() (PR#3657)"

2003 Feb 10
2
problems using lqs()
Dear List-members, I found a strange behaviour in the lqs function. Suppose I have the following data: y <- c(7.6, 7.7, 4.3, 5.9, 5.0, 6.5, 8.3, 8.2, 13.2, 12.6, 10.4, 10.8, 13.1, 12.3, 10.4, 10.5, 7.7, 9.5, 12.0, 12.6, 13.6, 14.1, 13.5, 11.5, 12.0, 13.0, 14.1, 15.1) x1 <- c(8.2, 7.6,, 4.6, 4.3, 5.9, 5.0, 6.5, 8.3, 10.1, 13.2, 12.6, 10.4, 10.8, 13.1, 13.3, 10.4, 10.5, 7.7, 10.0, 12.0,
1998 Nov 08
1
Strange behaviour of lm
R-0.62.4 running under linux ------------------------------------------------------------------------------- > x <- rnorm(10) > lm(x~x) Error: length of namelist must equal dims > x <- c(1,2,3) > lm(x~x) Call: lm(formula = x ~ x) Coefficients: (Intercept) 2 > y <- x > lm(y~x) Call: lm(formula = y ~ x) Coefficients: (Intercept) x
2005 Apr 13
1
lm() with many responses
Hi all, I have one array of predictors, one observation per row, and one array of responses, also arranged one observation per row. I arrange these into a data.frame and call lm() with a pasted-together formula. I would like to call lm() with a number of responses in excess of 100, but for some reason, 39 seems to be a limit. Why do I get an "invalid variable names" error from
2003 Nov 13
1
what does this multinom error mean?
I have RedHat linux 9 with R 1.8. I'm estimating models with multinom with a dependent variable that has 3 different values. Sometimes the models run fine and I can understand the results. Sometimes when I put in another variable, I see an indication that the estimation did work, but then I can't get the summary method to work. It's like this: > votemn1 <-
2005 Feb 24
4
r: functions
hi all i have a function that uses two inputs, say xdata and ydata. An example is the following, simple1<-function(xdata,ydata) { ofit<-lm(ydata~xdata) list(ofit) } say i use arbitray number for xdata and ydata such that D = x1 x2 y 1 1 10 2 6 6 3 10 7 x<-D[,1:2] and y<-D[,3] if one uses these inputs and rund the program we get the following: >simple(xdata=x,ydata=y)
2007 May 08
1
Fitting Random effect tobit model
Dear R-user: I have a left censored longitudinally measured data set with 4 variables such as sub (which is id), x (only covariate), y (repeatedly measured response) and w (weights) (note, ?-5? indicates the left censored value in the attached data set). I am using following R codes (?survival? library and ?survreg? package) for fitting a random effect tobit model for the left censored
2007 Dec 27
0
Help with lm and multiple linear regression?
Hello, I'm new to R, but I've read the intro to R and successfully connected it to an instance of mysql. I'm trying to perform multiple linear regression, but I'm having trouble using the lm function. To start, I have read in a simply y matrix of values(dependent variable) and x matrix of independent variables. It says both are data frames, but lm is giving me an error that my
2006 May 19
1
Weird LM behaviour
Dear R users, experimenting with the lm function in R, I've encountered some behaviour I don't understand with my limited knowledge of regression. I made a data-'set' of three measurements (see syntax below). Using lm (linear model) to fit the regression-line, I expected to find an intercept of 2.0 and a slope of 0, but in fact the slope is slightly below zero. Amazed by
2007 Dec 27
2
Help with lm and multiple linear regression? (Plain Text version)
(Apologies the previous version was sent as rich text) Hello, I'm new to R, but I've read the intro to R and successfully connected it to an instance of mysql. I'm trying to perform multiple linear regression, but I'm having trouble using the lm function. To start, I have read in a simply y matrix of values(dependent variable) and x matrix of independent variables. It says both
2007 Oct 02
1
problems with glm
I am having a couple of problems someone may be able to cast some light on. Question 1: I am making a logistic model but when i do this: glm.model = glm(as.factor(form$finished) ~ ., family=binomial, data=form[1:150000,]) I get this: Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : variable lengths differ (found for 'barrier') which is
2010 Apr 26
0
lm.ridge {MASS} intercept questions
I am trying to understand the code for lm.ridge from the MASS package. Here is the part I am having trouble understanding: if(Inter <- attr(Terms, "intercept")) { Xm <- colMeans(X[, -Inter]) Ym <- mean(Y) p <- p - 1 X <- X[, -Inter] - rep(Xm, rep(n, p)) Y <- Y - Ym } else Ym <- Xm <- NA Xscale <- drop(rep(1/n, n) %*% X^2)^0.5 X <- X/rep(Xscale, rep.int(n,
2006 Mar 16
2
DIfference between weights options in lm GLm and gls.
Dear R-List users, Can anyone explain exactly the difference between Weights options in lm glm and gls? I try the following codes, but the results are different. > lm1 Call: lm(formula = y ~ x) Coefficients: (Intercept) x 0.1183 7.3075 > lm2 Call: lm(formula = y ~ x, weights = W) Coefficients: (Intercept) x 0.04193 7.30660 > lm3 Call:
2013 Feb 19
1
Small quirks in summary.(g)lm docs
Hi! In R 3.0.0 from current SVN, ?summary.lm says: > Value [...] > df degrees of freedom, a 3-vector (p, n-p, p*), the last > being the number of non-aliased coefficients. ?summary.glm says: > df a 3-vector of the rank of the model and the number of residual > degrees of freedom, plus number of non-aliased coefficients. It seems to me that the description is reversed: p is
2002 May 11
2
Bug on Mac version of lm()?
Dear Mac users, Hi, as you might have probably read the thread of "[R] Rsquared in summary(lm)" on May 10, it seems that Mac version of lm() seem to be working incorrectly. I enclose the script to produce the result both for lm() and manual calculation for a simple regression. Could you run the script and report with the version of R, so I don't have to go through every builds
2004 Jan 12
1
question about how summary.lm works
Hi, While exploring how summary.lm generated its output I came across a section that left me puzzled. at around line 57 R <- chol2inv(Qr$qr[p1, p1, drop = FALSE]) se <- sqrt(diag(R) * resvar) I'm hoping somebody could explain the logic of these to steps or alternatively point me in the direction of a text that will explain these steps. In particular I'm puzzled
2005 Jul 21
1
Question about 'text' (add lm summary to a plot)
I would like to annotate my plot with a little box containing the slope, intercept and R^2 of a lm on the data. I would like it to look like... +----------------------------+ | Slope : 3.45 +- 0.34 | | Intercept : -10.43 +- 1.42 | | R^2 : 0.78 | +----------------------------+ However I can't make anything this neat, and I can't find out how to combine this
2005 Nov 03
1
Problems with abline adding regression line to a graph
Hello all, R2.1.1, W2k I try to make a plot of a simple regression model in this way: > with(njfA_bcd, { + plot(TC_OS.G31,Prot,cex = 2, col = "red", xlab= "TC/OS at GS32", + ylab="Grain crude protein (CP)") + }) This part works well and produces the datapoints as red circles. When I try to add a line, using a fitted linear model in a way that works perfect
2007 Sep 21
1
Stats 101 : lm with/without intercept
I am puzzled at the use of regression. I have a categorical variable ClassePop33000 which factors a Population variable into 3 levels. I want to investigate whether that categorical variable has some relation with my dependent variable, so I go : lm(Cout.ton ~ ClassePop33000, data=ech2) Call: lm(formula = Cout.ton ~ ClassePop33000, data = ech2) Residuals: Min 1Q Median 3Q
2019 Aug 31
0
inconsistent handling of factor, character, and logical predictors in lm()
Dear Bill, Thanks for pointing this difference out -- I was unaware of it. I think that the difference occurs in model.matrix.default(), which coerces character variables but not logical variables to factors. Later it treats both factors and logical variables as "factors" in that it applies contrasts to both, but unused factor levels are dropped while an unused logical level is not. I
2012 Sep 29
1
Unexpected behavior with weights in binomial glm()
Hi useRs, I'm experiencing something quite weird with glm() and weights, and maybe someone can explain what I'm doing wrong. I have a dataset where each row represents a single case, and I run glm(...,family="binomial") and get my coefficients. However, some of my cases have the exact same values for predictor variables, so I should be able to aggregate up my data frame and