Displaying 20 results from an estimated 10000 matches similar to: "How to do an infinite sum in R"
2012 Dec 25
1
Sampling data without having infinite numbers after diong a transformation
Hello R-helpers..
I want to ask about how I can sample data sets without having the infinite numbers coming out. For example,
set.seed(1234)
a<-rnorm(15,0,1)
b<-rnorm(15,0,1)
c<-rnorm(15,0,1)
d<-rnorm(15,0,36)
After come out with the sample, I need to do a transformation (by Hoaglin, 1985) for each data set. Actually I need to measure the skewness and kurtosis, that's why I
2012 Aug 28
3
Course
Hello,
I am a student of Materials Engineering and I want to minister an
introductory course of R at the university I study here in Brazil. I know R is
a free software, but I just want to know if I do need a special authorization
for doing it. The course will be totaly free and I also will not receive any
money for doing it. The idea is just to show the program.
--
Atenciosamente,
Pedro
2012 Mar 14
2
sum(hist$density) == 2 ?!
> x <- rnorm(1000)
> h <- hist(x,plot=FALSE)
> sum(h$density)
[1] 2 ----------------------------- shouldn't it be 1?!
> h <- hist(x,plot=FALSE, breaks=(-4:4))
> sum(h$density)
[1] 1 ----------------------------- now it's 1. why?!
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://www.childpsy.net/ http://www.memritv.org
2009 Oct 15
4
Generating a stochastic matrix with a specified second dominant eigenvalue
Hi,
Given a positive integer N, and a real number \lambda such that 0 < \lambda
< 1, I would like to generate an N by N stochastic matrix (a matrix with
all the rows summing to 1), such that it has the second largest eigenvalue
equal to \lambda (Note: the dominant eigenvalue of a stochastic matrix is
1).
I don't care what the other eigenvalues are. The second eigenvalue is
2012 Sep 01
2
Computing 'exp(1e3)*0' correctly....
I have some trouble to deal the value of 'NaN'. For example,
> exp(1e3)
[1] Inf
> exp(1e3)*0
[1] NaN
The correct answer should be 0 rather than NaN. I will very appreciate
if anyone can share some technique to get a correct answer.
2013 May 23
1
sample(c(0, 1)...) vs. rbinom
Greetings.? My wife is teaching an introductory stat class at UC Davis.? The
class emphasizes the use of simulations, rather than mathematics, to get
insight into statistics, and R is the mandated tool.?? A student in the class
recently inquired about different approaches to sampling from a binomial
distribution.? I've appended some code that exhibits the idea, the gist of
which is that using
2011 Apr 18
3
Power Analysis
I am trying to do a power analysis to get the number of replicas per
treatment.
If I try to get the power it works just fine:
setn=c(2,3)
sdx=c(1.19,4.35)
power.t.test(n = setn, delta = 13.5, sd = sdx, sig.level = 0.05,power =
NULL)
If I go the other way to obtain the "n" I have problems.
sdx=c(1.19,4.35)
pow=c(.8,.8)
power.t.test(n = NULL, delta = 13.5, sd = sdx, sig.level = 0.05,
2010 Oct 26
5
cube root of a negative number
Hi,
This might be me missing something painfully obvious but why does the cube root of the following produce an NaN?
> (-4)^(1/3)
[1] NaN
>
As we can see:
> (-1.587401)^3
[1] -4
Thanks!
Greg
2012 Mar 15
2
summing "transfers"
I have a dataframe from an On-Board Survey with weights ("expwgt") and variables for up to 8 used lines: VEH1 through VEH8. The lines are labeled "MT-..1" through "MT-902". I want to know how many transfers there are between MT-802 and MT-901. That is, when one of them is VEHx and the other is VEHx+1 or VEHx-1
E.g. {VEH1 = MT-802 AND VEH2 = MT-901 } plus {VEH2 =
2012 Apr 23
2
.rda vs. .RData
Are they the same with .RData being the newer format?? Thanks,
...Tao
2011 Jul 22
1
Summing daily values by weekday and weekend
(Sorry for reposting. Please delete previous msgs. Thanks!)
Hi, all
Here I created a data frame like
mydates<- seq(as.Date("2010-05-29"), length = 43, by = "day")
myvalues<-runif(43,0,1)
myframe<-data.frame(dates=mydates, day=weekdays(dates), value=myvalues)
dates day value
1 2010-05-29 Saturday 0.14576143
2 2010-05-30 Sunday 0.37669604
2013 Oct 10
1
Rcpp and mclapply
Dear all,
I have an R script that uses Rcpp, and I have been trying to parallelize
it using mclapply (I tried with the multicore and the parallel library)
Sometimes (not always, interestingly), the CPU use for each core drops,
usually so that the total over all cores reaches 100%, i.e., as fast as if
using just one single core fully. I tried my code directly from within
emacs, and also using a
2013 Oct 12
1
lmerTest
Hi,
I'm trying to user lmer function from lmerTest package because, if I
understood correectly, it allows to make better inference than lmer method
from lme4 package. However, whatever I do I keep getting this error:
Error in lme4::lFormula(formula = mark ~ ssCount + sTime+ : rank of X =
1660 < ncol(X) = 1895
any ideas what could be a problem?
thanks,
Srecko
[[alternative HTML
2012 Nov 11
2
Cropping a matrix by rows
Hello r-help,
I've been banging my head against the computer in an attempt to learn how
to divide my matrix into segments by rows. I want to be able to return each
segment as a newly named object. I've tried looking at the apply functions
and creating a for loop but brain no work. Here's the basic starting
objects that I believe would be needed to separate the matrix.
mat <-
2018 Jan 15
5
barplot that displays sums of values of 2 y colums grouped by different variables
I am trying to create a barplot displaying the sums of 2 columns of data
grouped by a variable. the data is set up like this:
"city" "n" "y" <br>
mon 100 200 <br>
tor 209 300 <br>
edm 98 87 <br>
mon 20 76 <br>
tor 50 96 <br>
edm 62 27 <br>
the resulting plot should have city as the x-axis, 2 bars per city, 1
representing
2018 Jan 15
0
barplot that displays sums of values of 2 y colums grouped by different variables
It is not generally advisable to get too fancy with stat functions in
ggplot... things can easily get more complicated than ggplot is ready to
handle when it comes to calculations. It is better to create data that
corresponds directly to the graphical representations you are mapping
them to.
Read [1] for more on this philosophy.
[1] H. Wickham, Tidy Data, Journal of Statistical Software,
2011 Nov 25
3
counting values with some conditions in a simulation
Dear R users,
I am running simulations (1000), and in my simulation I am looking at
specific sums. For example, if the sum is >=4 then count this, if say <3,
then don't count, if the sum=3, then generate a random number from uniform
distribution, if this number is say less than 0.5, then count this sum, if
greater than 0.5, then don't count. I am having trouble with introducing
this
2012 Jan 11
3
64bit R under 32bit winxp
Hi all:
My OS is 32bit winxp,but I wanna install 64bit R2.14.1.
>From the following website,it says "You can also go back and add 64-bit components to a 32-bit install, or vice versa"
http://cran.r-project.org/bin/windows/rw-FAQ.html#Can-both-32_002d-and-64_002dbit-R-be-installed-on-the-same-machine_003f
Does it mean that I can install and run 64bit R2.14.1 under 32bit
2011 Aug 15
3
write.table extra column
In the following data.frame there are 6 columns, but 7 are written to
the CSV file.
install.packages("pmlr")
library(pmlr)
data(enzymes)
write.table(enzymes, sep=",", eol="\n",file="albert.csv")
2012 Mar 12
3
Idea/package to "linearize a curve" along the diagonal?
Hi,
I am trying to normalize some data. First I fitted a principal curve
(using the LCPM package), but now I would like to apply a
transformation so that the curve becomes a "straight diagonal line" on
the plot. The data used to fit the curve would then be normalized by
applying the same transformation to it.
A simple solution could be to apply translations only (e.g., as done
after a