Displaying 20 results from an estimated 300 matches similar to: "getting the std errors in the lm function"
2004 Feb 21
3
saving variables created by functions in the workspace
Hello ,
just a simple question from a beginner:
I write the function:
plotsinx <- function()
{
x<-seq(0,2*pi,0.01)
sinx<-sin(x)
plot(sinx)
}
I recall it:
plotsinx()
and the plot works properly.
but then in the workspace if I want to look at the
values of sinx the following error is displayed:
Error: Object "sinx" not found.
How to save the variables created by the function on
2004 Feb 23
2
deleting elements from an array/object
Hello,
I created a simple histogram with:
myHist<-hist(myData)
the object myHist now has two arrays (among the others):
myHist$mids
myHist$counts
Since myHist$counts contains some "0", and I want to calculate the linear fit among myHist$mids and log(myHist$counts), I want remove the elements of both arrays where these "0" occurs.
which are the possible solutions to
2004 Mar 03
3
plot(x,y) with errors
Dear all,
I have 2 variables,
x<-c(1,2,3,4,5,6,7,8,9,10)
y<-c(1.3,2.5,4.6,5.3,5.9,6.7,7.4,8.5,9.4,10.4)
each point of the y variable has an error:
erry<-(0.2,0.3,0.2,0.1,0.4,0.2,0.3,0.4,0.3,0.2)
how to plot(x,y) with the errors segments?
Thank you,
Copex
---------------------------------
[[alternative HTML version deleted]]
2004 Feb 28
1
Basic general statistical problem.
Hello everyone,
I'd like to have suggestions about a common basic statistical approach,
hope to be useful also for other R beginners.
When you first get some data (i.e length of river) you may want to look at its distribution.
Then you probably want to find which law follows this distribution,
and to test the goodness of the fit.
For doing this simple analysis I am writing some code
2004 Feb 15
1
linear regression of data with standard deviation
Hello everyone,
I know that to calculate the linear regression between x and y I
have to use the function "lm".
But how to do if x and y have a standard deviation like in the
following example?
How to compute the chi square test in this case?
Thank you,
Fulvio.
example:
x +- dx
5 2
13 4
17 4
23 6
y +- dy
6.3 0.6
9.2 0.9
14 1
21 4
2010 Sep 14
1
NA confusion (length question)
Hi folks,
I am running a very simple regression using
mylm <- lm(mass ~ tarsus, na.action=na.exclude)
I would like the use the residuals from this analysis for more
regression but I'm running into a snag when I try
cbind(mylm$residuals, mydata) # where my data is the original data set
The error tells me that it cannot use cbind because the length of
mylm$residuals is
2003 Oct 11
1
Subclassing lm
I'd trying to subclass the "lm" class to produce a "mylm" class whose
instances behave like lm objects (are accepted by methods like summary.lm)
but have additional data or slots of my own design.
For starters:
setClass("mylm", "lm")
produces the somewhat cryptic:
Warning message:
Old-style (``S3'') class "mylm" supplied as a
2009 Mar 31
1
using "substitute" inside a legend
Hello list,
I have a linear regression:
mylm = lm(y~x-1)
I've been reading old mail postings as well as the plotmath demo and I came
up with a way to print an equation resulting from a linear regression:
model = substitute(list("y"==slope%*%"x", R^2==rsq),
list(slope=round(mylm$coefficients[[1]],2),rsq=round(summary(mylm)$adj.r.squared,
2)))
I have four models and I
2004 Sep 28
1
call R scripts from python
Hello,
I have just learnt some python, and would like to call R scripts from python, without using batch mode.
I learnt how to do it from perl, in fact reading in the mail archive I found the following good example:
***************************************
#!/usr/local/bin/perl
open (FILE, ">test.txt");
print FILE "a,b,c,d,e\n1,2,3,4,5";
close FILE;
####### Start R
2009 May 14
1
automated polynomial regression
Dear all -
We perform some measurements with a machine that needs to be
recalibrated. The best calibration we get with polynomial regression.
The data might look like follows:
> true_y <- c(1:50)*.8
> # the real values
> m_y <- c((1:21)*1.1, 21.1, 22.2, 23.3 ,c(25:50)*.9)/0.3-5.2
> # the measured data
> x <- c(1:50)
> # and the x-axes
>
> # Now I do the following:
2011 May 20
2
extraction of mean square value from ANOVA
Hello,
I am randomly generating values and then using an ANOVA table to find the
mean square value. I would like to form a loop that extracts the mean square
value from ANOVA in each iteration. Below is an example of what I am doing.
a<-rnorm(10)
b<-factor(c(1,1,2,2,3,3,4,4,5,5))
c<-factor(c(1,2,1,2,1,2,1,2,1,2))
mylm<-lm(a~b+c)
anova(mylm)
Since I would like to use a loop to
2009 Jan 24
2
how to prevent duplications of data within a loop
Hi All,
I had posted a question on a similar topic, but I think it was not
focused. I am posting a modification that I think better accomplishes
this.
I hope this is ok, and I apologize if it is not. :)
I am looping through variables and running several regressions. I have
reason to believe that the data is being duplicated because I have
been
monitoring the memory use on unix.
How can I avoid
2007 Apr 06
2
lm() intercept at the end, rather than at the beginning
Hi,
I wonder if someone has already figured out a way of making
summary(mylm) # where mylm is an object of the class lm()
to print the "(Intercept)" at the last line, rather than the first
line of the output. I don't know about, say, biostatistics, but in
economics the intercept is usually the least interesting of the
parameters of a regression model. That's why, say, Stata
2005 Jun 16
1
regressing each column of a matrix on all other columns
DeaR list
I would like to predict the values of each column of a matrix A by
regressing it on all other columns of the same matrix A. I do this with
a for loop:
A <- B <- matrix(round(runif(10*3,1,10),0),10)
A
for (i in 1:length(A[1,])) B[,i] <- as.matrix(predict(lm( A[,i] ~
A[,-i] )))
B
It works fine, but I need it to be faster. I've looked at *apply but
just can't
2007 Oct 30
1
Some matrix and sandwich questions
Dear R-help,
I have a four-part question about regression, matrices, and sandwich package.
1) In the sandwich package, I would like to better understand the
meat() function.
>From the bread() documentation, for a simple OLS regression, bread() returns
(1/n * X'X)^(-1)
That is, for a simple regression (per the documentation on bread()):
MyLM <- lm(y ~ x)
bread(MyLM)
2002 Jul 01
1
a little statistics help
Dear R-guRus:
I am stuck with the following problem in R:
Let's say i have a data.frame with columns X,Y & Z.
X is a column of numbers, Y is a column of N
factors "A", "B", "C", "D", etc and Z is a column of n
factors "a", "b", "c", etc
if i do MyLm<-lm(X~Y*Z - 1) i get all N coefficients for Y-factors, but
only
2007 Apr 18
7
[Bridge] Passing vlan tagged packets through linux bridge
> Use an Intel pro/100 or pro/1000 driver..they are known to
> work with VLANs.
>
> I guess it's also possible that it's a problem in the
> bridging code, so try the latest kernel
> as well...
I compiled the latest 2.6.19 kernel and tested it with two
3COM 3c905c fast ethernet interfaces which work fine with
vlan 802.1q tagging, but when I have added the eth0 and eth1
2008 Jul 06
1
Patch for GRUB Legacy to chainload SYSLINUX from logical partitions
Inspired from a similar patch posted on grub-devel for Grub2 I immersed
myself into the code of Grub Legacy and came up with this absurdedly simple
patch to allow syslinux or other bootloaders residing in logical partition
to be chainloaded from GRUB Legacy (0.9x).
Hoping it to be of help, regards
Fulvio Scapin
-------------- next part --------------
A non-text attachment was scrubbed...
Name:
2004 Jul 30
1
Three-way ANOVA?
Hi,
I'm a biologist, so please forgive me if my question sounds absurd! I have 3
parameters x1, x2, x3 and a response variable y.The sample size is 75. I tried
to do the following:
mylm<-lm(y~ x1 + x2 + x3, data="mydata")
but i can only get stats from anova for the first 2 variables. The third comes
up as NA. The degrees of freedom for the third variable are 0.
Is there
2007 Apr 18
2
[Bridge] large packet size doesn't work
Hi,
I have just configured a Linux box with kernel 2.6.16.7 and configured two
ethernet interfaces (with MTU 1500) in bridge mode. CONFIG_BRIDGE_NETFILTER
is enabled.
The problem is that ping -s 1500 192.168.0.2 doesn't work from 192.168.0.1
if the systems are separated by the bridge. Normal ping with smaller packet
size works ok.
What is wrong?
Best Regards
Fulvio Ricciardi