Displaying 20 results from an estimated 7000 matches similar to: "least median squares"
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,
2007 Feb 28
3
Packages in R for least median squares regression and computing outliers (thompson tau technique etc.)
Hi
I am looking for suitable packages in R that do
regression analyses using least median squares method
(or better). Additionally, I am also looking for
packages that implement algorithms/methods for
detecting outliers that can be discarded before doing
the regression analyses.
Although some websites refer to "lms" method under
package "lps" in R, I am unable to find such a
2003 Jul 30
2
robust regression
Hi,
trying to do a robudt regression of a two-way linear model, I keep
getting the following error:
> lqs(obs ~ y + s -1,method="lms", contrasts=list(s=("contr.sum")))
Error: lqs failed: all the samples were singular
Robust regression with M-estimators works (also regular least square
fits, of course):
rlm.formula(formula = obs ~ y + s - 1, method = "M",
2006 Feb 21
2
How to get around heteroscedasticity with non-linear least squares in R?
I am using "nls" to fit dose-response curves but am not sure how to approach
more robust regression in R to get around the problem of the my error
showing increased variance with increasing dose.
My understanding is that "rlm" or "lqs" would not be a good idea here.
'Fairly new to regression work, so apologies if I'm missing something
obvious.
2016 Apr 02
3
apply mean function to a subset of data
Dear all;
This must have a rather simple answer but haven't been able to figure it
out: I have a data frame with say 2 groups (group 1 & 2). I want to select
from group 1 say "n" rows and calculate the mean; then select "m" rows from
group 2 and calculate the mean as well. So far I've been using a for loop
for doing it but when it comes to a large data set is
2016 Apr 03
1
apply mean function to a subset of data
Here are several ways to get there, but your original loop is fine once it is corrected:
> for (i in 1:2) smean[i] <- mean(toy$diam[toy$group==i][1:nsel[i]])
> smean
[1] 0.271489 1.117015
Using sapply() to hide the loop:
> smean <- sapply(1:2, function(x) mean((toy$diam[toy$group==x])[1:nsel[x]]))
> smean
[1] 0.271489 1.117015
Or use head()
> smean <- sapply(1:2,
2016 Apr 02
0
apply mean function to a subset of data
Hi Pedro,
This may not be much of an improvement, but it was a challenge.
selvec<-as.vector(matrix(c(nsel,unlist(by(toy$diam,toy$group,length))-nsel),
ncol=2,byrow=TRUE))
TFvec<-rep(c(TRUE,FALSE),length.out=length(selvec))
toynsel<-rep(TFvec,selvec)
by(toy[toynsel,]$diam,toy[toynsel,]$group,mean)
Jim
On 4/3/16, Pedro Mardones <mardones.p at gmail.com> wrote:
> Dear all;
>
2007 Jun 14
4
question about formula for lm
Dear all;
Is there any way to make this to work?:
.x<-rnorm(50,10,3)
.y<-.x+rnorm(50,0,1)
X<-data.frame(.x,.y)
colnames(X)<-c("Xvar","Yvar")
Ytext<-"Yvar"
lm(Ytext~Xvar,data=X) # doesn't run
lm(Yvar~Xvar,data=X) # does run
The main idea is to use Ytext as input in a function, so you just type
"Yvar" and the model should fit....
2007 May 11
3
how to get column/row info from a dist object?
Dear R users;
Is it possible to get the row and column number of a particular entry
in a dist object?
Let's say that I want to find the position of the value 1.1837 (the
last entry on the dist object below), that is [6,3]. Can I get those
values without transforming the object to a matrix?, i.e. working with
the dist object only.
1 2 3
2 0.23935864
2011 Sep 20
5
help in interpreting paired t-test
Dear all;
A very basic question. I have the following data:
************************************************************************************
A <- 1/1000*c(347,328,129,122,18,57,105,188,57,257,53,108,336,163,
62,112,334,249,45,244,211,175,174,26,375,346,153,32,
89,32,358,202,123,131,88,36,30,67,96,135,219,122,
89,117,86,169,179,54,48,40,54,568,664,277,91,290,
2006 Feb 21
3
How to get around heteroscedasticity with non-linear leas t squares in R?
Your understanding isn't similar to mine. Mine says robust/resistant
methods are for data with heavy tails, not heteroscedasticity. The common
ways to approach heteroscedasticity are transformation and weighting. The
first is easy and usually quite effective for dose-response data. The
second is not much harder. Both can be done in R with nls().
Andy
From: Quin Wills
>
> I am
2009 Mar 14
4
persp plot + plotting grid lines
Dear all;
Does anyone know how to add grid lines to a persp plot? I've tried
using lines(trans3d..) but the lines of course are superimposed into
the actual 3d surface and what I need is something like the plot shown
in the following link:
http://thermal.gg.utah.edu/tutorials/matlab/matlab_tutorial.html
I'll appreciate any ideas
Thanks
PM
2009 Jan 18
2
don't print object attributes on screen
Dear all;
I have a function written in R that returns as a list of values as
output that has associated some user defined attributes to it. How can
hide these attributes when printing the output on screen? I'm using
R-2.8.1 on WinXP....it's like hiding the attr of the output from the
scale function....
Thanks in advance
PM
2013 Mar 13
1
calculating column difference in a matrix
Dear R users;
Consider the following toy example:
a <- matrix(c(2,3,4,NA,NA,5,8,NA,8,NA), 5, 2)
b <- cbind(a,apply(a, 1, diff, na.rm = TRUE))
What I would like be able to get is:
c <- matrix(c(2,3,4,NA,NA,5,8,NA,8,NA,3,5,-4,8,NA), 5, 3)
i.e., for each row if both values (column 1 and 2) are NA then the
difference must return NA, but if any of those two values is different
from NA
2009 Aug 04
0
Problems with lqs()
Dear List-Members,
I have a problem with the function lqs() from package MASS. In some cases it produces different results for the same settings and needs a random seed to be set, in other cases not.
I really cannot understand, why this happens. As well I do not understand what exactly you need the random seed for. Is it a starting point for iterations? Or do different results occur because of
2002 Jan 22
1
documentation and plotting with lqs
Dear r-help,
Is there any available description of the components of lqs objects
found in the package "lqs"?
> names(slts)
[1] "crit" "sing" "coefficients" "bestone"
[5] "fitted.values" "residuals" "scale" "terms"
[9] "call"
2008 Jan 29
2
error message + boot library
Dear all;
What can be wrong with this simple example?
library(boot)
d1<-c(rnorm(10,mean=10))
fm<-function(d,i) mean(d[i])
bd1<-boot(d1,fm,10000)
> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
Thanks for any idea
2002 Nov 14
1
R-1.6.1, Mac OS X 10.2.2 build failure
I tried building R-1.6.1 under Mac OS X 10.2.2 and experienced the
following build failure:
<...stuff omitted...>
cc1: warning: changing search order for system directory
"/usr/local/include"
cc1: warning: as it has already been specified as a non-system
directory
gcc -bundle -flat_namespace -undefined suppress -L/usr/local/lib -o
ctest.so ansari.o chisqsim.o d2x2xk.o
2006 Nov 29
3
R2.4 xyplot + panel.number problem
Hi all;
I'm trying to display a 2 panel plot for the Puromycin data from R
with 2 different non-linear models fitted to each group. The problem
is that as far as I know panel.number doesn't work in the latest
version of R. Can anyone give a hint how to solve this?
Here is the code that I used before and now doesn't work
xyplot(rate ~conc| state,Puromycin,
2005 Sep 14
1
R CMD check
Dear r-devel members,
I tried to build R packages on a PC running Windows XP but experience
problems. However, it is ok when there is no inst directory in a package.
Any help would be appreciated.
The following is an example,
C:\work>R CMD check VR_7.2-19.tar.gz
* checking for working latex ... OK
* using log directory 'C:/work/VR.Rcheck'
* using R version 2.1.1, 2005-06-20
*