Displaying 20 results from an estimated 4000 matches similar to: "a problem about integrate function in R .thank you ."
2009 Oct 23
1
integrate() function error
This is my code , when i run it ,error happed . can you tell me what's the
reason and modify it ?thank you very much !! the error is "evaluation of
function gave a result of wrong length"
e2<-function(a) integrate(function(x) x,lower=0,upper=a)$value
integrate(e2,lower=0, upper=0.5)$value
[[alternative HTML version deleted]]
2009 Feb 27
3
question about 3-d plot
Hi R Users,
I have produced a simulated scatter plot of y versus x tightly clustered
around the 45 degree line through the origin with the following code:
x <- seq(1,100)
y <- x+rnorm(100,0,10)
plot(x,y,col="blue")
abline(0,1)
Is there some way to generate a 3-dimensional analogue of this? Can I get a
similar simulated scatter plot of points in 3 dimensions where the points
2010 Jul 06
3
Function for gruping similar variables?
Hi,
I have a matrix of results of multiple 2x2 chi^2 tests, non-
significant tests are marked as TRUE. Is there a function for grouping
those variables in a similar way LSD.test from agricolae library does?
I reviewed LSD.test's source but it's not helpful for me.
This is my matrix:
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
1 TRUE FALSE TRUE TRUE TRUE FALSE TRUE
2 FALSE TRUE
2009 Mar 09
2
mean reverting model
dear useRs,
i'm working with a mean reverting model of the following specification:
y = mu + beta(x - mu) + errorterm, where mu is a constant
currently I estimate just y = x (with lm()) to get beta and then
calculate mu = estimated intercept / (1-beta).
but I'd like to estimate mu and beta together in one regression-step
and also get the test-statistics (including parameter
2009 Mar 20
2
print of objects in R
Hello,
I have been watching my output as I create functions and do other things
in r.
One thing I don't like is the [1,] type notation at the beginning of a
line. I have been
able to change that to a number such as 1 2 etc. using
as.data.frame(object).
How can I stop the printing of a line number and column heading if I
want to?
I am thinking about publishing and writing of papers.
2009 Jun 08
2
Tinn R
Dear R-users,
I have installed the latest version of Tinn R (Version 2.2.0.2).
With the older versions it was possible to run Tinn R next to R and then select code that one could send to R.
Now it seems that one has to start the R gui in Tinn R and then it is possible to select en run code of R.
But if I start R within Tinn R it does NOT start the R-Gui but only the R console. When I start R
2008 Dec 10
2
missing argument
Dear list,
I have a question and I'm going to give an example of my problem
f<- function(d1, d2, d3)
{
d<- d1*d2/d3
return(d)
}
v1<- 1
v2<- 2
If I try
f(v1, v2, v3)
Error in f(v1, v2, v3) : object "v3" not found
I obviously got the above error message.
I would like to add something to my function to allow me to get a certain
value (say zero)
if one of the arguments is
2009 May 08
3
'Dynamic' 3D plot
Hi,
I am looking for a R package to draw 3d plot. But not in a static way like scatterplot3d or stuff like that. I would like to make rotate the plot, to zoom/unzoom etc..., actually to render the graph 'dynamic'... (for the biologist and bioinformatician, a R package which permitts to reproduce what pdb viewer does).
Does a Way exist to do something like that in R ?
Thanks,
2008 Dec 15
5
how to create duplicated ID in multi-records per subject dataset
Hi R helpers,
If I have a dataset looks like:
ID record
1 20
. 30
. 25
2 26
. 15
3 21
4.....................
And I want it becomes
ID record
1 20
1 30
1 25
2 26
2 15
3 21
4.....................
That is, I have to duplicate IDs for those with multiple records. I am wondering it is possible to be
2000 Feb 23
0
Thank you!
Thank you very much for your help, your fuction runs on R without
any change, and the results are the same that your obtain with Splus,
but there still a small difference.
In SAS
W=0.960439
With your shapiro.wilk.test
W=0.9606107
But the p-values are almost the same.
Thank you very much for your help.
> Here is a function for the Shapiro-wilk test that I obtained from StatLib.
> Using
2009 Dec 06
5
optim with constraints
Hi, dear R users
I am a newbie in R and I wantto use the method of meximum likelihood
to fit a Weibull distribution to my survival data. I use "optim" as
follows:
optim(c(1, 0.25),weibull.like,mydata=mydata,method="L-BFGS-B",hessian
= TRUE)
My question is: how do I setup the constraints so that the two
parametrs of Weibull to be pisotive? Or should I use other function
2010 Oct 26
3
stripping #s in a text file prior to reading into table or dataframe
I'm importing a lot of text tables of data (from Latent Gold) that includes
hashes in some of the column names ("Cluster#1", "Cluster#2", etc.). Is
there an easy way to strip the offending hashes out before pushing the text
into a table or data frame? I thought I'd use gsub, e.g., but can't figure
out how to read in a text file without reading it into a table or
2005 Dec 10
2
Problems with integrate
Hi,
Having a weird problem with the integrate function.
I have a function which calculates a loss density: I'd like to integrate
it to get the distribution.
The loss density function is:
lossdensity<-function(p,Beta,R=0.4){
# the second derivative of the PDF
# p is the default probability of the pool at which we are evaluating
the lossdensity
# Beta is the correlation with the market
2009 Jan 14
2
how to read data from the different worksheets in the same Excel file
Dear All:
I am trying to read the data from the different sheet but in the same Excel
file. Does R provide this kind of command to do it?
Anyone has experience on this?
Thanks!
Xin
[[alternative HTML version deleted]]
2009 Mar 04
2
Multivariate GARCH Package
Good day everyone,
I tried to find a multivariate GARCH package and failed to find one. Although when I searched R I found the following link which describes the package:
http://www.r-project.org/user-2006/Slides/Schmidbauer+Tunalioglu.pdf
can any one help me with this issue.
Thank you in advance
[[alternative HTML version deleted]]
2007 Apr 26
2
Extract p-value from survdiff function
Hi list,
I want to use the p-value from the survdiff function (package
survival) to reuse within a function in a Kaplan-Meier plot. The
p-value is somehow not a component of the value list ?!
Thanks in advance
--
A. Goralczyk
G?ttingen, Ger.
2009 Jan 09
1
[R} how to build TermDocMatrix in tm text mining package of R
Howdy Gurus
I 'd like to ask a question about how to build TermDocMatrix in tm text
mining package.
It is not clear about importing a plain text file, and them converting that
text file into TermDocMatrix file, etc to me.
How can I build a TermDocMatrix of " a plain text document file for text
association?
Or are there any good manuals?
Thank you in advance,
--
Kum-Hoe Hwang, Ph.D.
2006 Jan 15
1
Multiple comparison and two-way ANOVA design
Dear useRs,
I'm working on multiple comparison design on two factor (2 3 levels)
ANOVA. Each of the tests I have tried (Tukey, multcomp package) seem to
do only with one factor at a time.
fm1 <- aov(breaks ~ wool * tension, data = warpbreaks)
tHSD <- TukeyHSD(fm1, "tension", ordered = FALSE)
$tension
diff lwr upr p adj
M-L -10.000000 -19.35342
2008 Jan 31
2
Box Plot With Groups being numbers
I would like to Summarize values that are repeated measures at a
certain river mile with box plot i.e.
The data matrix looks like this
123 124 125 #fiver mile
0.5 0.6 0.7
0.4 0.5 0.6
... ... ... #values
I would like to make a boxplot with the river mile naming the
different box plot. How do you suppress the X123?
Stephen
--
Let's not
2008 Nov 25
2
invoking user-defined function
Dear list,
Can somebody tell me how to invoke user-defined functions from script
files during run-time?
Basically I have (almost) one function per script file.
I am thinking of something like
#include in C++
import in Java/Python
use in Perl
No, I don't need my functions every time R is started.
Neither I am thinking about writing building my functions into
packages.
I just