Displaying 20 results from an estimated 1000 matches similar to: "R 2.70 + ps2pdf14"
2008 Jun 26
3
bug in nls?
Dear all
Nobody responded to my previous post so far so I try with more offending
subject.
I just encountered a strange problem with nls formula. I tried to use nls
in cycle but I was not successful. I traced the problem to some parse
command.
Here is an example
DF<-data.frame(x=1:10, y=3*(1:10)^.5+rnorm(10))
coef(lm(log(DF[,2])~log(DF[,1])))
(Intercept) log(DF[, 1])
0.7437320
2009 Jan 19
1
R bug or ghostscript bug or my bug?
Dear R developers:
The following R program produces a pdf file that does not survive
ghostscript distillation correctly. The undistilled version is at
http://welch.econ.brown.edu/temp/try.PDF while the distilled version
is at http://welch.econ.brown.edu/temp/try.pdf . When previewed, the
points are wrong in the distilled .pdf version, but only in one of the
two points invokations (huh?) . The
2007 May 30
1
Static and dynamic graphics course, July 2007, Salt Lake City
We're pleased to announce a one day course covering static and dynamic
graphics using R, ggplot and GGobi. The course will be held just
before the JSM, on Saturday, 28 July 2007, in Salt Lake City. The
course will be presented by Dianne Cook and Hadley Wickham.
In the course you will learn:
* How to build presentation quality static graphics using the R
package, ggplot. We will cover plot
2007 Nov 09
1
help with lasso2 package
X is a matrix and F is a vector.
F2 <- data.frame(cbind(X,F))
F2
V1 V2 V3 F
1 -0.250536332 -1.4755883 1.9580974 -2.136487
2 -0.009856084 0.4953269 0.5486092 -2.744482
3 -0.406962682 0.7729631 0.1861905 -2.891821
4 1.938780097 0.7469251 1.2537781 -1.212992
5 -0.332370358 1.1943637 0.7114278 -1.830441
modF<-formula(F ~ V1 + V2 + V3) #no error message
2008 Jan 25
1
lapply without return values?
Hi
I am looking for a function which is executing some code repeatedly,
exactly like lapply() and sappl() are doing, but do not return anything
as I am not interested in the return values.
An example would be:
> p <- data.frame(runif(10), runif(10), runif(10))
> lapply( p, function(ps) {x11(); plot(ps)} )
which results in three graphs and a printout:
$runif.10.
NULL
$runif.10..1
2008 Apr 24
2
problem with "which"
Hi,
I'm having trouble with the "which" or the "seq" function, I'm not sure.
Here's an example :
> lat=seq(1,2,by=0.1)
> lat
[1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
> which(lat==1)
[1] 1
> which(lat==1.1)
[1] 2
> which(lat==1.2)
[1] 3
> which(lat==1.3)
[1] 4
> which(lat==1.4)
[1] 5
> which(lat==1.5)
[1] 6
>
2008 May 15
1
apply function
Hi R,
Getting a strange result using ?apply. Please look into the below codes:
>
d=data.frame(a=c(1,2,3),b=c("A","B","C"),c=c(TRUE,FALSE,FALSE),d=c(T,F,F
))
> class(d[,1])
[1] "numeric"
> class(d[,2])
[1] "factor"
> class(d[,3])
[1] "logical"
> class(d[,4])
[1] "logical"
>
2007 Jul 25
1
question on using "gl1ce" from "lasso2" package
Hi,
I tried several settings by using the "family=gaussian"
in "gl1ce", but none of them works.
For the case "glm" can work.
Here is the error message I got:
> glm(Petal.Width~Sepal.Length+Sepal.Width+Petal.Length
,data=iris,family=gaussian())
> gl1ce(Petal.Width~Sepal.Length+Sepal.Width+Petal.Length
,data=iris,family=gaussian())
Error in eval(expr, envir,
2007 Nov 23
2
rbinom with computed probability
Hello,
I have a loop with probability computed from a logistic model like this:
for (i in 1:300){
p[i]<-exp(-0.834+0.002*x[i]+0.023*z[i])/(1+exp(-0.834+0.002*x[i]+0.023
+z[i]))
x and z generated from normal distribution.
I get 300 different probabilities And I want to generate variables from
bernulli distribution
with P for every observation:
T[i]<-rbinom(1,1,p[i])
But i get missing
2008 Aug 24
1
Extracting formula from an lm object
I want to extra the part of the formula not including the response
variable from an lm object. For example if the lm object ABx.lm was
created by the call
ABx.lm <- lm( y ~ A + B + x, ...)
Then ACx.lm is saved as part of a workspace.
I wish to extract "~ A + B + x". Later in my code I will fit another
linear model of the form z ~ A + B + x for some other response variable z.
I
2008 Apr 14
4
&& and ||
Hello there,
I got a small problem about logical calculation:
we can get a sequene from a+b as below:
> a<-c(1,2)
> b<-c(3,4)
> a+b
[1] 4 6
but when the sequences are logical. (I want to get (True,False) && (True, True) ==> (True, False), but when I do as below.
> e<-c(T,T)
> f<-c(F,T)
> e
[1] TRUE TRUE
> f
[1] FALSE TRUE
>
2008 Feb 20
1
debugging a try() statement
Dear R Users,
I implemented a try() statement that looks like:
<- function(index)
{
reduced_model <- try(glm.fit(X4,n,family=poisson(link="log")))
full_model <- try(glm.fit(X5,n,family=poisson(link="log")))
if (inherits(reduced_model,"try-error") ||
inherits(full_model,"try-error")) return(NA)
else
{
p <-
2008 Feb 15
1
Questions about EM algorithm
Dear all:
Assume I have 3 distributions, x1, x2, and x3.
x1 ~ normal(mu1, sd1)
x2 ~ normal(mu2, sd2)
x3 ~ normal(mu3, sd3)
y1 = x1 + x2
y2 = x1 + x3
Now that the data I can observed is only y1 and y2. It is
easy to estimate (mu1+m2), (mu1+mu3), (sd1^2+sd2^2) and
(sd1^2+sd3^2) by EM algorithm since
y1 ~ normal(mu1+mu2, sqrt(sd1^2+sd2^2)) and
y2 ~ normal(mu1+mu3, sqrt(sd1^2+sd3^2))
However, I want
2008 May 06
1
question about se of predicted glm values
Hey, all. I had a quick question about fitting new glm values and
then looking at the error around them. I'm working with a glm using a
Gamma distribution and a log link with two types of treatments.
However, when I then look at the predicted values for each category, I
find for the one that is close to 0, the error (using se.fit=T with
predicted) actually makes it overlap 0.
2008 May 04
1
Is my understanding of rlnorm correct?
rlnorm takes two 'shaping' parameters: meanlog and sdlog.
meanlog would appear from the documentation to be the log of the mean.
eg if the desired mean is 1 then meanlog=0.
So to generate random values that fit a lognormal distribution I would
do this:
rlnorm(N , meanlog = log(mean) , sdlog = log(sd))
But when I check the mean I don't get it when sdlog>0. Interestingly I
2007 Sep 21
1
Is it solve.QP or is it me?
Hi.
Here are three successive examples of simple quadratic programming problems
with the same structure. Each problem has 2*N variables, and should have a
solution of the form (1/N,0,1/N,0,...,1/N,0). In these cases, N=4,5,6. As
you will see, the N=4 and 6 cases give the expected solution, but the N=5
case breaks down.
>cm8
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1 0
2008 Jun 04
4
sum of unknown number of matrices
Hi R,
I have a list of matrices. I need to get the sum of all the matrices in
the list.
Example:
a=b=c=d=matrix(1:4,2,2)
l=list(a,b,c,d)
I need:
> a+b+c+d
[,1] [,2]
[1,] 4 12
[2,] 8 16
Something like do.call("+",l) is not working...why is this?
I may not be knowing the number of matrices in the list...
Thanks, Shubha
This e-mail
2008 Nov 24
4
Calculating sum of letter values
Hi all
If I have a string, say "ABCDA", and I want to convert this to the sum of the letter values, e.g.
A -> 1
B -> 2
etc, so "ABCDA" = 1+2+3+4+1 = 11
Is there an elegant way to do this? Trying something like
which(LETTERS %in% unlist(strsplit("ABCDA", "")))
is not quite correct, as it does not count repeated characters. I guess what I need is
2008 Aug 05
4
literate programming
I'm working on the next iteration of coxme. (Rather slowly during the summer).
This is the most subtle code I've done in S, both mathematically and
technically, and seems a perfect vehicle for the "literate programming" paradym
of Knuth. The Sweave project is pointed at S output however, not source code.
I would appreciate any pointers to an noweb type client that was
2009 Jan 21
4
seq()
HI:
Could someone help me with the seq function? I have a range of values starting from 1 to 52 but I want seq to start at 27 by=2, but when it reaches 51 start with with number 1 to 25. is this possible. I can do the basics of seq() but I can't figure how to do this one. This is how I want my sequence to look like:
27 29 31 33 35 37 ............51 1 3 5 7 9 11 13 ...........25
Felipe D.