Displaying 20 results from an estimated 20000 matches similar to: "Unsuccessful beginner's struggle with lm"
2008 Jul 20
4
drawing segments through points with pch=1
Please excuse me for asking such basic questions:
Here is my code
> y=c(1.21,0.51,0.14,1.62,-0.8,0.72,-1.71,0.84,0.02,-0.12)
> ybar=mean(y)
> ll=length(y);
> ybarv=rep(ybar,ll)
> x=1:ll
> plot(x,ybarv,pch=1)
> segments(x[1],ybar,x[ll],ybar)
What I get is a collection of small circles, with a segment "on top"
of the circles, which is almost what I want. But I
2013 Sep 02
1
Sweave: printing an underscore in the output from an R command
I am working with Sweave and would like to print out into my latex document the result of the R command
version$platform
So what I first tried in my .Rnw document was \Sexpr{print(version$platform)}.
However, the output from this command is the string "x86_64-apple-darwin10.8.0" (without the quotes). This contains an underscore, which is a special character in tex and so I get an error
2008 Sep 10
4
re flecting a line
Suppose x and y are numeric vectors of the same length.
plot(x,y) #scatterplot
lmObj1 <- lm(y~x) # best fit line
abline(lmObj1) # good
lmObj2 <- lm(x~y) #get best fit but with axes interchanged
abline(lmObj2) # not what I want. I want the correct line, drawn on the same
graph, but with
# response and predictor variables interchanged
One way to proceed would be to
2010 Apr 09
4
perhaps regular expression bug with | sign ??
Here is my interaction with R:
> sub(x='>|t|',pattern = '|t',replacement='zz')
[1] "zz>|t|"
So I say to myself "Clearly the | signs need to be escaped, so let's try
this"
> sub(x='>|t|',pattern = '\|t',replacement='zz')
[1] "zz>|t|"
Warning messages:
1: '\|' is an unrecognized escape in a
2009 Feb 05
2
eliminating control characters from formatted data files
I have a few hundred files of formatted data. Unfortunately most of them end
with a spurious CONTROL-Z. I want to rewrite the files without the spurious
character. Here's what I've come up with so far, but my code is unsafe
because it assumes without justification that the last row of df contains a
control character (and some NAs to fill up the record).
options(warn=-1) #turn off
2005 Oct 27
1
Puzzled over curve() syntax.
It's probably toadally elementary (and, like, duhhhhh) but
I can't figure out why the following doesn't work:
curve(function(x){qnorm(x,4,25)},from=0,to=1)
I get the error:
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ
But if I do
foo <- function(x){qnorm(x,4,25)}
curve(foo,from=0,to=1)
it goes like a train.
Also
2008 Jul 20
1
Error in edit(name,file,title,editor)
Can anyone help me with the following attempt to use an external
editor from within R
> vi(file="p286.R")
Error in edit(name, file, title, editor) : unable to open file to read
> edit(file="p286.R")
Error in edit(name, file, title, editor) : unable to open file to read
I have only recently re-started trying to learn R. (I tried before
but failed.)
I am working
2010 Apr 11
2
simple question about contrasts, lm and factors
I have a data frame with two variables that are factors. One is actually a
TRUE/FALSE factor, and I have coded it as 1/0, a continuous variable, but I
could turn it back into a factor. The second is an ordered factor and
consists of five timepoints. There are several continuous variables as well.
Now I want to fit a linear model to my data, using lm (or another R
procedure if recommended).
2010 Apr 06
3
appending an R-object to a list
How do I append an R-object to a list?
I want to start with an empty list, and append R-objects one by one.
Does this start with a command like
mylist <- NULL
??
I have read a few answers on R-help to questions like this, but they all
seem to be well off the point. Sometimes it's assumed that the list is a
vector---not my case.
One answer I read said that the object appended must be a
2003 Jun 21
2
Beginner's Question on Linear Regression Models
Hi Folks,
Could anyone point me to a good reference on linear regression models? Specifically, I am trying to gain an intuitive feel for how the standard error values are calculated for the parameter estimates. My understanding is that these are computed using the variance-covariance matrix computed from the input data matrix. Although I think I understand the math, I still don't have a
2010 Apr 08
3
how does one print code
There is quite a long piece of code defining a certain function in one of the
R packages.
I think the code has a bug and I want to get the code into a file so that I
can take a proper look, and possibly fix it.
how does one do this? (I mean getting the code into a file, not fixing the
bug.) I suppose I could copy and paste, but that's a bit error prone for
various reasons. I want the same
2008 Jun 25
1
LDA on pre-assigned training and testing data sets
Dear r-help
I am trying to run LDA on a training data set, and test it on another data set with the same variables. I found examples using crossvalidation, and using training and testing data sets set up with sample, but not when they are preassigned.
Here is what I tried
# FIRST SET UP A DATAFRAME WITH ALL THE DATA AND CREATE NEW VARIABLES
traintest1 <-
2011 Mar 21
1
Sweave, white space and code blocks
Sweave is very useful, and I'm gradually getting used to it.
I've just been battling Sweave over the re-use of code chunks. As I am
pretty ignorant in the byways of both Sweave and R, this took a chunk of
time to sort out. Here is what I learned:
If one re-uses a code chunk, then Sweave (but not Stangle) will insist that
<>
start in column 1. In particular, white space to its left
2011 Apr 16
1
Sweave, SweaveHooks and printing the label
I would like to print the label of each code chunk, just before printing the
code chunk itself. Is that possible using SweaveHooks, or by some other
mechanism?
Thanks
David
--
View this message in context: http://r.789695.n4.nabble.com/Sweave-SweaveHooks-and-printing-the-label-tp3453829p3453829.html
Sent from the R help mailing list archive at Nabble.com.
2011 Mar 24
1
Storing user-defined R functions
Hello, I don't want to find out how to make packages unless that becomes
necessary. Also, I don't want to clog up the computer memory with functions
that I'm not using. (It would be great if someone in this forum would
explain how memory is used when I type library(MASS) and then use only one
function from MASS. Are all the many MASS functions then residing in memory,
or only the one I
2009 Feb 02
3
Environmental variables
I use a Mac (10.4.11 Mac Os X).
In my .tcshrc I define an environmental variable MY.
Is it possible to find out its value from inside R? When one loads
R for Mac OS X Cocoa GUI written by:
Simon Urbanek
Stefano M. Iacus
are files like .tcshrc read by R?
Can I make the value of this environmental variable available to R?
Sys.getenv() produces a lot of output, with the values of many
2009 Sep 03
3
goodness of "prediction" using a model (lm, glm, gam, brt, regression tree .... )
Dear R-friends,
How do you test the goodness of prediction of a model, when you predict on a
set of data DIFFERENT from the training set?
I explain myself: you train your model M (e.g. glm,gam,regression tree, brt)
on a set of data A with a response variable Y. You then predict the value of
that same response variable Y on a different set of data B (e.g. predict.glm,
predict.gam and so on).
2003 Jan 23
3
Beginner with a beginner's question..
Hallo Samba mailing list
I am a VERY new user to Linux and have just installed it (SUSE version 8.1)
and can just about make my way around the machine although there a many
things that I still don't know how to do (eg. looking at the network
neighborhood the Linux machine should be able to see).
I have several Windows PCs (running maily NT and Win 98) and the first
obvious thing is to get
2009 Jun 17
1
Predict Fanny Membership
Hello List,
My question is an elementary one. I have run a fuzzy kmeans cluster using
FANNY to group freshwater fish assemblages. I then went in the field to
validate that classification and have retrieved new assemblage data for a
new suite of streams. Therefore I would like to use Predict to determine how
well the original clustering fits the new data. However I have not figured
out a
2008 Dec 03
2
changing colnames in dataframes
dear all,
I'm building new dataframes from bigger one's using e.g. columns F76, F83,
F90:
JJ<-data.frame( c( as.character(rep( gender,3))) , c( F76,6- F83, F90) )
Looking into JJ one has:
c.as.character.rep.gender..8...
c.6...F73..F78..F79..F82..6...F84..F94..F106..F109
1 w 2
2 w