search for: lsfit

Displaying 20 results from an estimated 65 matches for "lsfit".

2009 Mar 13
1
lsfit w/ rank-deficient x
Dear R-devel, It seems that lsfit incorrectly reports coefficients when the input matrix 'x' is rank-deficient, see the example below: ## here values of 'b' and 'c' are incorrectly swapped > x <- cbind(a=rnorm(100), b=0, c=rnorm(100)); y <- rnorm(100); lsfit(x, y)$coef Intercept a...
2009 Oct 25
1
lsfit residuals
I'm trying to extract the points above and below a particular lsfit. I can only get the residuals from the original fit though. x = runif(100, 0, 10) plot(x) abline(lsfit(1:100, test)) abline(lsfit(1:100, test + sd(test))) #I want the points above THIS line. Is there a way to use the coefficients from the fit to do this? Thanks for any help.
2013 Apr 25
1
lsfit: Error in formatting error message
Hi, in R-3.0 I get the following error when calling lsfit with more observations than variables, which seems to come from an error in the formatting of the error message (note that this was not happening in 2.15.3): > nobs <- 5; nvar <- 6; lsfit(matrix(runif(nobs*nvar), ncol=nvar), runif(nobs), intercept=FALSE) Error in sprintf(ngettext(nry, &qu...
2002 May 14
1
princomp
Hello experts, as newcomer in pca, i have a question, concerning the princomp algorithm. With a dataset "r" containing 18 "input" parameters and 1 "output" parameter r[19], i got with the following fit ls <- lsfit(r[1:18],r[19]); lsdiag <- ls.diag(ls); lsdiag$std.dev a prediction error of: [1] 8.879561 what is quite reasonable. If i take only two significant important inputs, ls <- lsfit(r[1:2],r[19]); lsdiag <- ls.diag(ls); lsdiag$std.dev i will get an prediction error of: [1] 20.18148...
2003 Jul 21
5
how to test whether two slopes are sign. different?
...^2) -------Original Message------- From: Gijsbert Stoet <stoet at volition.wustl.edu> Sent: 07/20/03 09:51 PM To: r-help at stat.math.ethz.ch Subject: [R] how to test whether two slopes are sign. different? > > Hi, suppose I do want to test whether the slopes (e.g. determined with lsfit) of two different population are significantly different, how do I test this (in R). Say for example, I found out what the slope between age and number of books read per year is for two different populations of subjects (e.g. 25 man and 25 woman), say using lsfit. How can I tell whether the slopes...
2016 Apr 20
0
Solving sparse, singular systems of equations
This is not a solution but your lsfit attempt #Error in lsfit(A, b) : only 3 cases, but 4 variables lsfit(A,b) gave that error because lsfit adds a column of 1 to its first argument unless you use intercept=FALSE. Then it will give you an answer (but I think it converts your sparse matrix into a dense one before doing any linear...
2009 Feb 27
0
help with correct use of function lsfit
...0.027225 [7,] 1 0.198 0.039204 [8,] 1 0.231 0.053361 [9,] 1 0.264 0.069696 [10,] 1 0.297 0.088209 [11,] 1 0.330 0.108900 [12,] 1 0.363 0.131769 [13,] 1 0.396 0.156816 [14,] 1 0.429 0.184041 [15,] 1 0.462 0.213444 [16,] 1 0.495 0.245025 [17,] 1 0.528 0.278784 > lsfit(x, y, wt = NULL, intercept = TRUE, tolerance = 1e-07, + yname = NULL> > lsfit(ls.mat, y.win,wt = NULL, intercept = TRUE, tolerance = 1e-07,yname = NULL) $coefficients Intercept X1 X2 X3 -1.3191398 0.1233055 0.9297401 0.0000000 $residuals [1] 0.020...
1997 Apr 30
1
R-beta: ls.print
...------------------------------------------------- > summary(hyeung) x.1 x.2 Min. : 28.0 Min. : 10.0 1st Qu.: 72.0 1st Qu.: 87.5 Median : 86.5 Median : 92.5 Mean : 81.0 Mean : 82.5 3rd Qu.: 97.0 3rd Qu.:100.0 Max. :100.0 Max. :100.0 > summary(lsfit(hyeung[,1],hyeung[,2])) Length Class Mode coef 2 -none- numeric residuals 24 -none- numeric intercept 1 -none- logical qr 6 -none- list > ls.print(lsfit(hyeung[,1],hyeung[,2])) trace: ls.print(lsfit(hyeung[, 1], hyeung[, 2])) Error: missing value in ``n...
1997 Apr 30
1
R-beta: ls.print
...------------------------------------------------- > summary(hyeung) x.1 x.2 Min. : 28.0 Min. : 10.0 1st Qu.: 72.0 1st Qu.: 87.5 Median : 86.5 Median : 92.5 Mean : 81.0 Mean : 82.5 3rd Qu.: 97.0 3rd Qu.:100.0 Max. :100.0 Max. :100.0 > summary(lsfit(hyeung[,1],hyeung[,2])) Length Class Mode coef 2 -none- numeric residuals 24 -none- numeric intercept 1 -none- logical qr 6 -none- list > ls.print(lsfit(hyeung[,1],hyeung[,2])) trace: ls.print(lsfit(hyeung[, 1], hyeung[, 2])) Error: missing value in ``n...
2016 Apr 20
6
Solving sparse, singular systems of equations
...w=3,ncol=3),"sparseMatrix")b = matrix(c(-30,40,-10),nrow=3,ncol=1) #solve for x, Error in LU.dgC(a) : cs_lu(A) failed: near-singular A (or out of memory)solve(A,b,sparse=TRUE,tol=.Machine$double.eps) #one x that happens to solve Ax = bx = matrix(c(-10,10,0),nrow=3,ncol=1)A %*% x #Error in lsfit(A, b) : only 3 cases, but 4 variableslsfit(A,b)#solves the system, but fails belowsolve(qr(A, LAPACK=TRUE),b)#Error in qr.solve(A, b) : singular matrix 'a' in solveqr.solve(A,b) #matrices used in my actual problem (see attached files)A = readMM("A.txt")b = readMM("b.txt"...
2006 Mar 06
0
Problems with R CMD Rdconv and R CMD Sd2Rd (PR#8661)
...on>, or better yet <code>.Machine$double.eps</code>, In \examples{}, < should be converted verbatim rather than converted to &lt; In the References section (and for links more generally?), file names are missing the .sgm This: \seealso{ \code{\link{lm}} \code{\link{lsfit}} } is converted to: <s-see> <s-function name="lm">lm</s-function> <s-function name="lsfit">lsfit</s-function> </s-see> It should be <s-see> <s-function name="lm.sgm">lm</s-function> <s-function name="ls...
2002 Apr 15
2
krige and polygon limit problem
..., 2215795, 2217396, units of prediction points. Using points within c(785291, 789980, 794030, 798282, 805920, 813151, 817000, 820902, units of prediction points. Predicting.Error: (list) object cannot be coerced to vector type 14 In addition: Warning messages: 1: X matrix was collinear in: lsfit(xmat, y, wt = w, intercept = FALSE) 2: X matrix was collinear in: lsfit(xmat, y, wt = w, intercept = FALSE) 3: X matrix was collinear in: lsfit(xmat, y, wt = w, intercept = FALSE) 4: X matrix was collinear in: lsfit(xmat, y, wt = w, intercept = FALSE) ------------------------------- Do you hav...
2010 Jan 02
3
Help needed on applying a function across different data sets and aggregating the results into a single data set
...me(cbind(rnorm(10),rnorm(10))) names(df1)[1] <- "A" names(df1)[2] <- "B" There are many such data sets, df2,df3,... I have the names stored in a list DF <- cbind("df1","df2",...,"df100") I now need to apply the following function: a <- lsfit(df1$A,df1$B) and stack up the following results: a$coef Intercept X -0.1479750 0.2485416 So, I would end up with as many rows as there are data sets. I think sapply would be the function I should be looking for (at least I have used it in the case of applying a function across diffe...
2013 Feb 26
2
Efficient way to perform linear regressions
...o fit the model. if the second row is (0,0,0,1,...,1), then I use X[4:n,] as input matrix to do the regression, etc. I would like to extract a single element of estimated parameter beta, and the SSE from the results. So far what I know is to use these functions which performs better than lm(): 1. lsfit() # this works faster than lm(), but have to extract the results without using ls.print(print=F), maybe I/O slows down. And not better than the other two approaches 2. directly use solve(X'X) and the formula from score equation to get the results # not sure how well for almost singular or wir...
2010 Dec 24
1
lattice regression coefficients
Dear list I am sorry to have to ask this question, but I have not been able to find a solution to what seems a simple problem. I have created a lattice plot of a number of regression points and lines using a function containing panel.xyplot and panel.lmline. The result is what is expected , but I cannot figure out how to obtain the coefficients of each of the regression lines. Any help
2011 Jun 16
1
Scatter plot produces "'x' and 'y' lengths differ"
...d syntax I am using: good <- complete.cases(affect1,adh1scr) plot (jitter(affect1,2.0),jitter(adh1scr,1.0),xlim=c(1,35),ylim=c(1,35),pch=1 6, main='Adherence Score by Affectiveness Level - Visit 1', ylab='Adherence score',xlab='Affect Scale - Patient Survey',abline(lsfit(affect1,adh1scr)),col="red") lines(lowess(affect1[good], adh1scr[good]), col="blue") I run this and get: > good <- complete.cases(affect1,adh1scr) > plot (jitter(affect1,2.0),jitter(adh1scr,1.0),xlim=c(1,35),ylim=c(1,35),pch=1 6, + main='Adherence Score...
2005 Apr 21
2
apply vs sapply vs loop - lm() call appl(y)ied on array
Christoph -- There was just a thread on this earlier this week. You can search in the archives for the title: "refitting lm() with same x, different y". (Actually, it doesn't turn up in the R site search yet, at least for me. But if you just go to the archive of recent messages, available through CRAN, you can search on refitting and find it. The original post was from William
2010 Apr 08
2
Overfitting/Calibration plots (Statistics question)
This isn't a question about R, but I'm hoping someone will be willing to help. I've been looking at calibration plots in multiple regression (plotting observed response Y on the vertical axis versus predicted response [Y hat] on the horizontal axis). According to Frank Harrell's "Regression Modeling Strategies" book (pp. 61-63), when making such a plot on new data
2009 Jan 08
1
cosinor analysis
Hallo, I didn´t found any facilities for Halbergs cosinor analysis in R. This analysis is well known in the Chronobiology as the least square approximation of time series using cosine function of known period (in my case of 24hours-period). I tried to write a script but crashed... Can you give me some advices, please!? Thanks Anne Berger Institute of Zoo- and Wildlife Research, Berlin, Germany
2013 Apr 23
2
Help: Where can I find the code for 'C_Cdqrls'?
Dear all, I’m not sure if it is O.K. to ask this question here. But where can I find the code for the function ‘C_Cdqrls’ which is called by the R function ‘lsfit‘. Thank you all. Sorry for being naïve if so. -------------------- Ziqiang Zhao 2013-04-23 [[alternative HTML version deleted]]