Displaying 20 results from an estimated 200 matches similar to: "Efficient way to perform linear regressions"
2011 May 31
1
Please HELP
Hi R people.
I have a problem. What can I create by using functions the
combinations of distances in multiple comparisons tests such as
duncan multiple range test?
cur=sample(rnorm(15),15,replace=TRUE)
varr=factor(c(rep("var1",5),rep("var2",5),rep("var3",5)))
dat<-data.frame(cur, varr)
lmm<-lm(cur~ varr,data=dat)
2010 Sep 07
1
change the for loops with lapply
cv.fold<-function(i, size=3, rang=0.3){
cat('Fold ', i, '\n')
out.fold.c <-((i-1)*c.each.part +1):(i*c.each.part)
out.fold.n <-((i-1)*n.each.part +1):(i*n.each.part)
train.cv <- n.cc[-out.fold.c, c(2:2401, 2417)]
train.nv <- n.nn[-out.fold.n, c(2:2401, 2417)]
train.v<-rbind(train.cv, train.nv) #training data for feature
2010 May 26
1
how to Store loop output from a function
HI, Dear R community,
I am writing the following function to create one data set(*tree.pred*) and
one vector(*valid.out*) from loops. Later, I want to use the data set from
this loop to plot curves. I have tried return, list, but I can not use the
*tree.pred* data and *valid.out* vector.
auc.tree<- function(msplit,mbucket) {
* tree.pred<-data.frame()
2010 Sep 24
1
How to read this file into R.
Dear community,
I have one file named ca_boost_feature.txt,
Feature selection (Boosting:0.0025,5)!
H.2.C C.1.D C.3.R E.0.N C.2.S C.0.G H.3.G
log file: ep
If I want to use the second line of this file, how to read it into R?
varr<-read.table("/home/cdu/operon/carbonic/ca_boost_feature.txt", sep=" ",
skip=1, header=F, strip.white=TRUE, nrows=1)
Warning message:
In
2004 Oct 16
0
Re: winesetuptk0.72/tcltk-winesetuptk-0.72
> It's the configuration part that I was looking for some help with, but
> as noted I can install neither winesetuptk nor wineinstall
You don't need winesetuptk or wineinstall anymore, because wine
automatically sets up a .wine directory with the appropriate contents.
Also, the wine config file isn't needed to successfully run wine
anymore. If you don't have a .wine
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 b c
-0.0227787 0.1042860 -0.1729261 0.0000000
Warning
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, "%d response", "%d
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
2003 Jul 21
5
how to test whether two slopes are sign. different?
Not really r-specific:
Z = (b1 - b2) / SQRT ( SEb1^2 + SEb2^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
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 algebra).
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On
2009 Feb 27
0
help with correct use of function lsfit
To the purpose of fitting a 2nd order polynomial (a + b*x + c*x^2) to the chunk of signal falling in a 17 consecutive samples window
I wrote the following very crude script. Since I have no previous experience of using Least Square Fit with R I would appreciate
your supervision and suggestion.
I guess the returned coefficients of the oolynomial are:
a = -1.3191398
b = 0.1233055
c = 0.9297401
1997 Apr 30
1
R-beta: ls.print
ls.print produces error that I don't seem to be able to trace.
Output of the commands as follows: (hyeung is a 24x2 matrix of data)
-------------------------------------------------
> 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.
1997 Apr 30
1
R-beta: ls.print
ls.print produces error that I don't seem to be able to trace.
Output of the commands as follows: (hyeung is a 24x2 matrix of data)
-------------------------------------------------
> 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.
2016 Apr 20
6
Solving sparse, singular systems of equations
I have a situation in R where I would like to find any x (if one exists) that solves the linear system of equations Ax = b, where A is square, sparse, and singular, and b is a vector. Here is some code that mimics my issue with a relatively simple A and b, along with three other methods of solving this system that I found online, two of which give me an error and one of which succeeds on the
2006 Mar 06
0
Problems with R CMD Rdconv and R CMD Sd2Rd (PR#8661)
I'm using R 2.2.0 on Windows.
Doing some conversions of help files. Internal comments indicate
that the Sd2Rd conversion is "Converted by Sd2Rd version 1.21."
I'm converting
.d -> .Rd
.sgml -> .Rd
using Sd2Rd, then checking by using Rdconv to
convert .Rd back to .d or .sgml.
Here are errors in some of the conversions.
The most significant errors are in .Rd to .sgml.
2002 Apr 15
2
krige and polygon limit problem
Dear all,
I'm new on R and this mailing list. We work on spatial rainfall estimation
with R and Grass.
We have a problem with the krige function from the sgeostat package. We would
like to limit the estimated area with a polygon limit.
I use a 50 points polygon to describe my work area. The krige function work
quiet well without limit. But if I use this option I have the following error
2010 Jan 02
3
Help needed on applying a function across different data sets and aggregating the results into a single data set
Hi folks,
Wish y'all a Happy New Year 2010!
I need some help with the following:
Say I have lots of data sets, on which I have to apply a certain function on
the same set of columns in each of the data set. Let's take, for ex, the
typical data set is:
df1 <- as.data.frame(cbind(rnorm(10),rnorm(10)))
names(df1)[1] <- "A"
names(df1)[2] <- "B"
There are many
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"
Hello,
I am working on a project to create some scatter plots. I have syntax
for 26 plots, and 22 of them display as they should. But here, for
example, is a sample of the command 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',