Displaying 20 results from an estimated 10000 matches similar to: "Constructing a lm for predict() by hand"
2006 Jan 20
3
abline() or predict.lm() when log="x"
Hello,
I'm trying to plot a fitted lm() line on a plot when the one
explanatory variable is log transformed and log="x". I get different
lines using abline and predict.lm().
#Example
x <- 1:100
y <- rnorm(100)
plot(y ~ x, log="x")
abline(lm(y ~ log(x)))
lines(x, predict(lm(y ~ log(x))), lwd=2)
I'm sure I'm missing something but could someone tell me which
2010 Mar 22
2
problems extracting parts of a summary object
summary(x), where x is the output of lm, produces the expectedd display,
including standard errors of the coefficients.
summary(x)$coefficients produces a vector (x is r$individual[[2]]):
> r$individual[[2]]$coefficients
tX(Intercept) tXcigspmkr tXpeld tXsmkpreve mn
-2.449188e+04 -4.143249e+00 4.707007e+04 -3.112334e+01 1.671106e-01
mncigspmkr mnpeld
2003 Nov 12
1
Plotting lm() attributes
Suppose you fit a linear model
> model.1 ~ lm(v1 ~ ..., data=myframe)
and v2 is some other column of myframe typically not in the model. You
will often want to try
> plot(v2, model.1$residuals)
but this will fail if there are NAs in the response v1 as
model.1$residuals has length equal to the number of nonmissing values in
v1. I suppose
> plot(v2[!is.na(v1)],
2008 Dec 17
2
PREDICT NEW VALUES FROM REGRESSION MODEL, EST. ST.ERROR, AND CI
Greetings,
I'd be grateful if a good Samaritan helps me to approach this problem....
with my data, I've created the following model
lm(formula = OUTCOME ~ VAR1 + VAR2)
summary(model)
Call:
lm(formula = OUTCOME ~ VAR1 + VAR2)
Residuals:
Min 1Q Median 3Q Max
-1.4341 -0.3621 0.1879 0.4994 0.7696
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.89020
2013 Jul 04
1
XHCI umass support breaks between r248085 and r252560 on 9-STABLE
Three different external hard drives (Seagate, Western Digital and noname USB 3.0 enclosure) refused to be recognized as the umass devices. Reverting /usr/src/sys/dev/bsd/controller to r248085, building and loading just xhci module makes drives appear again. Below are snippets from the log in both cases:
Non working:
Jul 4 14:35:17 twinhead kernel: xhci0: <XHCI (generic) USB 3.0
2006 Apr 12
7
help ith burncd (Input/output error, 6.1-RC, plextor PX-740a)
I have a new system which includes a Plextor PX-740a DVD+-R/RW CD-R/RW
drive attached to an Asus A8V-MX motherboard.
When I try to use burncd to burn a cd, it writes all of the data, says
"fixating CD, please wait.." and then reports
burncd: ioctl(CDRIOCFIXATE): Input/output error
Oddly enough, the CD seems to be usable.
I can successfully burn the same file if I use cdrecord.
The
2004 Jan 14
2
automatic "paste" filter to paste only the commands from a transcript on the clipboard
Just for fun (and actually because I would use it too) I wrote a
version of the "paste" menu command that assumes the clipboard
contains a transcript, and just pastes the commands from it into
the R console window (Windows GUI only).
So, if something like this:
> foo <-
+ 33
> foo * 3
[1] 99
> foo
[1] 33
is on the clipboard, then the "paste commands" menu
2006 Mar 11
4
Problem with 16-in-1 card reader
My new PC has an internal 16-in-1 card reader connected via USB 2.0. The
device is the Techsolo TCR-1640
(http://www.techsolo.de/product/cardreader/tcr_1640/index.php).
I boot from a compact flash inserted in it and I can mount and unmount
the same CF once the system has booted and has mounted the root
partition from my graid3 array.
The problem arise when I replace the inserted CF with another
2003 Oct 21
5
do.call() and aperm()
Hi everyone
I've been playing with do.call() but I'm having problems understanding it.
I have a list of "n" elements, each one of which is "d" dimensional
[actually an n-by-n-by ... by-n array]. Neither n nor d is known in
advance. I want to bind the elements together in a higher-dimensional
array.
Toy example follows with d=n=3.
f <-
2003 Oct 23
3
what's going on here with substitute() ?
I was trying to create a function with a value computed at creation time,
using substitute(), but I got results I don't understand:
> this.is.R
Error: Object "this.is.R" not found
> substitute(this.is.R <- function() X,
list(X=!is.null(options("CRAN")[[1]])))
this.is.R <- function() TRUE
> # the above expression as printed is what I want for the
2004 Mar 18
12
substitute question
Consider the following example:
# substitute a with b in the indicated function. Seems to work.
> z <- substitute( function()a+1, list(a=quote(b)) )
> z
function() b + 1
# z is an object of class call so use eval
# to turn it into an object of class expression; however,
# when z is evaluated, the variable a returns.
> eval(z)
function()a+1
Why did a suddenly reappear again
2002 Oct 10
2
tapply for matrices
Does anyone have something like tapply that is extremely fast for matrices when there is a very large number of levels of the grouping variable?
I'm referring to, for example,
tapply(x, grouping.variable, function.operating.on.submatrix)
where x is a matrix and the submatrix is a subset of the rows of x. The grouping variable's length equals the number of rows of x.
--
Frank E
2004 Jan 09
2
Fit non-linear regressor
Hi R masters,
Sorry for first mensage, this is orignal text...
y<-c(2.8150,3.5239,4.0980,4.5845,5.0709,5.4824,5.8427,6.3214,6.7349,7.3651)
x<-c(37,42,47,52,57,62,67,72,77,82)
I need fit R and A in y=f(x)=R*exp(A*x), with minimize sd= sqrt(SRR/(n-2)) where SRR is Sum of the Square of the Residuals
and n is number of data points (in this case 10)
How do I make this?
Thanks in advance
2005 Jun 09
1
single assignment affecting multiple sub-structures (PR#7924)
I'm trying to create a language structure that is a call to a function
with a number of arguments that is only known at run time. I do this by
using repeated indices to expand out a call with a single argument.
However, when I change one of the arguments, all are changed.
I don't see the same behavior when I initially create a call with
multiple arguments.
Even more strangely,
2006 Aug 03
4
meta characters in file path
Hi,
I need to read in some files. The file names contain come meta characters such as @, #, and white spaces etc, In read.csv, file= option, is there any way that one can make the function to recognize a file path with those characters?
Thanks
Johnny
[[alternative HTML version deleted]]
2009 Oct 09
2
weigths in nls (PR#13991)
Potential bug:
I mistyped weights in the call ('weigths') and it did not produce any error=
message. The coefs were exactly the same like without weights, so I was su=
spicious and when weights(nls1) gave NULL, I saw my typo.
Usually the function will say "Unused arguments", which shows you the error=
, but not nls.
Regards
Stephen
[[alternative HTML version deleted]]
2012 Sep 10
1
usb port issue in 9.1-Prerelease (Possibly Cam related)
Hi Folks,
I've facing an intermittent hang with a USB port which seems cam
related:
Event's that happen are:
o USB modem (HUAWEI E220) plugged into PC
ugen3.2: <HUA WEI> at usbus3
u3g0: <3G Modem> on usbus3
u3g0: Found 3 ports.
umass0: <USB MASS STORAGE> on usbus3
umass0: SCSI over Bulk-Only; quirks = 0x0000
umass0:6:0:-1: Attached to scbus6
umass1: <USB
2004 Sep 24
1
algorithm reference for sample() - Knuth
Thank you for the reference to Knuth. Indeed in vol. 2 he has a
> -----Original Message-----
> From: Tony Plate [mailto:tplate@blackmesacapital.com]
> Sent: Friday, September 24, 2004 8:05 AM
> To: Vadim Ogranovich
> Subject: Re: [Rd] algorithm reference for sample()
>
> Have you tried looking in Knuth's books on computer
> algorithms? (They are classics for good
2005 Apr 22
2
pointer to comments re Paul Murrell's new book, R, & SAS on Andrew Gelman's blog
There are some interesting comments re Paul Murrell's new book, R, & SAS
on Andrew Gelman's blog:
http://www.stat.columbia.edu/~cook/movabletype/archives/2005/04/a_new_book_on_r.html
-- Tony Plate
2006 Jan 10
2
Wikis (was about prod(numeric(0)))
Tony Plate <tplate <at> acm.org> writes:
>
> Since the virtue and reliability of Wikis was brought up, I created a R
> Wiki page for this at
>
http://www.sciviews.org/_rgui/wiki/doku.php?id=beginners:surprises:emptysetfuncs
>
>
> Anyone: please correct errors and improve it!
>
> Tony Plate
>
OK, now I have another question:
I see a wiki at