Displaying 20 results from an estimated 8000 matches similar to: "Calculation optimization advice needed"
2010 Feb 03
3
diagnostic plots
Dear all,
does anybody ever encountered the problem with diagnostic plots?
x<-rnorm(100)
y<-rnorm(100)
plot(lm(x~y))
It gives the following message "Waiting to confirm page change..." and
nothing happens.
Thanks a lot!
[[alternative HTML version deleted]]
2010 Jan 13
4
<= returns wrong result? Why
Dear all,
Does anybody know the probable reason why <= gives false when it should give
true?
These two variables are of the same type, and everything works in the cycle
but then it stops when they are equal.
this is the output result
> Rk[47] <= RB[21]
[1] FALSE
> Rk[47]
[1] 0.002842007
> RB[21]
[1] 0.002842007
Thanks a lot.
[[alternative HTML version deleted]]
2010 Jul 09
3
strange floor rounding
Dear all,
might seem and easy question but I cannot figure it out.
floor(100*(.58))
[1] 57
where is the trick here? And how can I end up with the right answer?
Thanks a lot everybody for your help.
Trafim
[[alternative HTML version deleted]]
2010 Jul 14
4
reverse string
Dear all,
Are there any functions in R to reverse the order of the string.
smth like reverse("abc") to get "cba"?
Thanks a lot.
[[alternative HTML version deleted]]
2010 Jan 14
3
plot type any symbols?
Dear all,
I have a question is there a possibility to plot points with different
symbols like stars, crosses?
I looked at different types for plot command and didn't find anything like
that.
Thanks a lot.
[[alternative HTML version deleted]]
2010 Jan 07
2
Graph titles from massive
Dear all,
I would like to ask you if there is a possibility in R to give the names to
graphs which are not const.
For example,
How to name each plot, or to add notes like a=x[i], b=y[i] in this cycle
x<-c(1,2,3,4,5,6)
y<-c(7,8,9,10,11,12)
par(mfrow=c(2,3))
for (i in 1:6){
plot(x,y)
}
Thank you for your time and help!
[[alternative HTML version deleted]]
2010 Sep 09
1
createDataPartition
Dear all,
does anyone know how to define the structure of the required samples using
function createDataPartition, meaning proportions of different types of
variable in the partition?
Smth like this for iris data:
createDataPartition(y = c(setosa = .5, virginica = .3, versicolor = .2),
times = 10, p = .7, list = FALSE)
Thanks a lot for your help.
Regards,
Trafim
[[alternative HTML version
2010 Feb 05
3
Extract p-value from lm for the whole model
Dear all,
I would like to ask how to extract the p-value for the whole model from
summary(lm).
This didn't help a lot summary.lm
summary(lm(speed~dist, cars))
Thanks a lot!
[[alternative HTML version deleted]]
2010 Jan 22
4
Extract R-squared from summary of lm
Dear all,
I cannot find to explicitly get the R-squared or adjusted R-squared from
summary(lm())
Thanks a lot!
[[alternative HTML version deleted]]
2009 Dec 09
1
Bootstrapping in R
Dear all,
I have some error trying to bootstrap from a matrix. The error message is
"Error in sample(n, n * R, replace = TRUE) : element 2 is empty;
the part of the args list of '*' being evaluated was: (n, R)"
vv <- c(0.5,3.2,5.4,1.1,1.4,1.2,2.3,2.0)
Reg <- matrix(data=vv, nrow = 4, ncol = 2)
bootcoeff <- function(x){
coefficients(lm(x[,1]~x[,2]))[2]+1
}
2010 Sep 07
4
minor diagonal in R
Dear all,
seems that easy question but cannot find the function for that.
How to get the elements of the minor diagonal of the matrix?
Thanks a lot.
[[alternative HTML version deleted]]
2010 Apr 05
3
Matrix elements are vectors
Dear all,
My question how is it possible to define a matrix A with 10 rows 1 column,
so that its elements are vectors of undefined length.
I need to have a possibility later to add elements like A[1,1] <-
c(A[1,1],3,4,5)
Thanks a lot for the help!
[[alternative HTML version deleted]]
2010 Jan 07
2
Extract p-value from linear model
Dear all,
I have the following question.
Is it possible in R to call for the p-value directly in a model like this
a <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
b <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
summary(lm(a~(b+0)))
or even in this
a <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
b <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
2009 Dec 02
2
Joint density kde2d works improperly?
Dear all,
Please, look at the following code:
attach(geyser)
f1 <- kde2d(duration, waiting, n = 5)
a <- 0
for (i in 1:5){
for (j in 1:5){
a <- a + f1$z[i,j]
}
}
As far as I understood from Help kde2d returns matrix elements of which are
values of joint probability mass function Pr(X=x,Y=y) therefore, sum of its
elements should sum to 1.
Which is not the case from my check.
Where is
2009 Dec 02
2
Histogram probabilities >1 ????!!!
Hi everybody,
well, I definitely don't understand anything.
Why the hist function with freq=FALSE gives such a strange result???
R <- c(-1.10, 0.79, -1.17, -0.53, -0.26, -0.22, 0.29, -0.26, -0.26, 0.39)
hist(R, freq=FALSE, breaks=10)
Thanks everybody
[[alternative HTML version deleted]]
2010 Mar 01
1
Fitting chi-squared distribution
Dear all,
I have a question regarding performing test if the data fits chi-squared
distribution.
For example, using ks.test()
I found in the examples how to fit it to gamma or weibull
x<-rnorm(100)
ks.test(x, "pweibull", shape=2,scale=1)
for the gamma, pgamma can be used
But I cannot find the value of this second parameter for the chi-squared
distribution.
Maybe someone
2009 Dec 02
2
calculation problem when export and import data
Hello,
I have a question on export and import data. Thank you for any suggestions.
data 'simul' is generated as follows:
N <- 20
n <- N/2
nsets <- 10
simul <- matrix(0,nsets,N)
th <- c(0,1, 1)
for(i in 1:nsets){
simul[i,] <- rnorm(N,mean= rep(th[1:2],N/2),sd=th[3])
}
I exported data as follows:
write.table(simul,
2010 Aug 16
1
lm prediction strange error
Dear all,
I have an error in the simple prediction function for lm().
Maybe someone experienced the same?
xma <- matrix(data = 0, nrow = 100, ncol = 2)
xma[, 1] <- rnorm(100)
xma[, 2] <- rchisq(100, df = 3)
m1 <- lm(xma[, 1] ~ xma[, 2])
predict(m1, as.data.frame(seq(-13, 13, 0.5)))
Thanks a lot,
Trafim
[[alternative HTML version deleted]]
2010 Feb 18
1
Shapiro-Wilk test problem
Hi everybody,
Does anyone know what problem may be with this test.
I am applying 5 different normality tests and use p-values for them, but for
some reason S-W gives me NA, while sample size is 100.
Any ideas?
Thanks a lot!
[[alternative HTML version deleted]]
2010 Mar 27
1
string width calculation
Colleagues,
I am trying to create a PDF document in which I use margin text with two different fonts. The resulting text might be:
XXXXXyZZZ
where X and Z are one font and Y is the other.
My plan was to do this in the following manner:
mtext("XXXXX ZZZ", cex=2, adj=0.5, family=SOMEFONT)
mtext("Y", cex=2, adj=??, family=DIFFERENTFONT)
My question regards how to calculate