Displaying 20 results from an estimated 40000 matches similar to: "R: expression"
2005 Jul 21
3
R:plot and dots
hi all
a very simple question.
i have plot(x,y)
but i would like to add in on the plot the observation number associated
with each point.
how can this be done?
/
allan
2004 Feb 03
3
R: plotting multiple functions
Hi all
Another simple question.
I would like to plot three graphs one the same plot with different
colours. Say red, blue and black. Here are the functions.
r1<-1+5*cos(2*pi*seq(1:100)/20)+rnorm(100)
r2<-1+7*sin(2*pi*seq(1:100)/20)+rnorm(100)
r3<-1+7*sin(2*pi*seq(1:100)/20)+5*cos(2*pi*seq(1:100)/20)+rnorm(100)
Regards
Allan
2004 Feb 24
5
r: plots
hi all
i have another probably simple question.
I have three variables say x, y and z. x and y are quite large and z is
relative small.
how can one plot the three variables on the same graph with two separate
axis?
(one for x and y and the other for z)
e.g.
x<-c(101,110,150,167,120)
y<-c(120,135,175,95,200)
z<-c(0.001, 0.15, 0.6, 0.8, 1)
regards
Allan
2005 Jul 29
5
R: graphics devices
a simple question
how does one produce plots on two different graphics devices?
/
allan
2005 Apr 11
4
R: function code
HI
sorry to be a nuisance to all!!!
how can i see the code of a particular function?
e.g. nnet just as an example
2010 Feb 11
1
Fwd: Recall function: "evaluation nested too deeply: infinite recursion / options(expressions=)?"
hello all
i searched the archives and couldn't get a solution to the following question.
i have the following function:
F=function(z,v)
{
if (v==-.5) return(1) else return(2*v/z + 1/Recall(z,v-1))
}
and while testing whether it works (ie F(z,v) is approx = besselK(z,1+v)/besselK(z,V). the recursion formula allows one to calculate besselK(z,1+v)/besselK(z,V) for large values of z )
2005 Mar 10
1
R: LIST function and LOOPS
hi all
another simple question.
i've written a dummy program so that you get the concept. (the code
could be simplfied such that there are no loops. but lets leave the
loops in for now.)
z1<-function(w)
{
for (i in 1:w)
{
set.seed(i+6)
ss<-0
for (j in 1:5)
{
set.seed(j+1+(i-1)*6)
r<-rnorm(1)
ss<-ss+r
}
list(ss=ss)
}
}
check.1<-z1(3)
check.1
the results is:
$ss
[1]
2004 Feb 10
6
R: lags
hi all
how does one simulate a random walk process?
i.e
y(0)=0
y(t)=y(t-1)+ e(t)
where e(t) is normal(0,1) say.
Regards
allan
2005 Mar 04
11
R: simulation
hi all
a simple question
i want to run simulations in r. i however want the experiments to be
repeated at a later time with exactly the same numbers by other users.
can i set the random number seed for rnorm in some way?
e.g. is there some arguement that goes with rnorm?
please supply an example
regards
Allan
2005 Feb 24
4
r: functions
hi all
i have a function that uses two inputs, say xdata and ydata. An example
is the following,
simple1<-function(xdata,ydata)
{
ofit<-lm(ydata~xdata)
list(ofit)
}
say i use arbitray number for xdata and ydata such that
D =
x1 x2 y
1 1 10
2 6 6
3 10 7
x<-D[,1:2]
and
y<-D[,3]
if one uses these inputs and rund the program we get the following:
>simple(xdata=x,ydata=y)
2007 Jul 24
7
Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.
Hi all,
If the question below as been answered before I
apologize for the posting.
I would like to get the frequencies of occurrence of
all values in a given variable in a multivariate
dataset. In short for each variable (or field) a
summary of values contained with in a value:frequency
pair, there can be many such pairs for a given
variable. I would like to do the same for several such
variables.
2008 Jan 22
1
R: determinants and inverses
hello all
sorry for the following "none" R related question.
does anyone know of a reference to calculate the following identity:
|I + ABC|
where I is an identity matrix and A, B,C may not have to be square matrices?
you help will be greatly appreciated.
H. V. Henderson; S. R. Searle
SIAM Review, Vol. 23, No. 1. (Jan., 1981), pp. 53-60.
provides a result to
2003 Dec 18
2
: Lp norm estimation
Hi all
Just wondering whether one can undertake Lp norm estimation (a type of
regression analysis) in R?
i.e.
argmin S ( | y(i) - x(i)b | ^p )
where:
* S is the summation over observation i= 1,2,...,n
* y is a vector of n observations
* x is an n by p matrix of explanatory variables
* b is a p by 1 vector of beta coefficients and
* p is a constant to be estimated such that
2004 Dec 13
2
R: functions problem
hi all
how can i see the code inside a particular function? i know one can
simply type the function, eg ls, but sometimes when this is done one
will get "UseMethod("some function name"). (One could also use "body"
but i have the same problem in this case. )How does one see the code in
this case?
2005 Oct 10
2
R: integration problem
hi all
an integration problem. i would like an exact or good approximation for
the following, but i do not want to use a computer. any suggestions:
integral of exp(b*x)/sqrt(1-x^2)
where "b" is a constant greater than or equal to 0
and
the integral runs from 0 to 1
any help would be apreciated
/
allan
2007 Jun 08
2
legend + expression
Dear all;
A simple? question.
I'm having a problem with a math expression in the legend of a plot
and I haven't found the way to get this to work, so any help will be
appreciate. Basically I want to include in the plot is the R-squared
and its numerical value, so I tried this:
R2c<-0.82879 # R-squared of calibration model
plot(1:10,1:10)
legend("topleft",
2005 Sep 15
2
R: deleting rows
hi all
hopefully some one can help.
assume that i imported the following data into R (say the data frame is
called a)
x1 x2 x3
1 NA 3
1 2 NA
1 2 3
3 NA 6
4 5 9
7 5 6
7 8 9
NA 7 9
How can i construct a new data frame that only contains those rows that
does not contain the NA's? is these a quick way?
ie
x1 x2 x3
1 2 3
4 5 9
7 5 6
7 8 9
in this example we can simple use
2005 Jul 29
1
R: non parametric regression/kernels
hi all
i have a another stats question.
i would like to solve the following question:
y(i)=a+b*x(i)+e(i)
i.e. estimate a and b (they should be fixed) but i dont want to specify
the standard density to the straight line.
this can be done using kernel regression. the fitted line is however
fitted locally. does anyone have a reference that will help me with my
problem.
i am still new to
2008 Jan 25
2
Using bquote: question
Hi all
Observe:
x <- c(1,2)
y <- c(1,-1)
phi <- 1
p <- 2
par( mfrow=c(1,2))
plot(x , y, main=bquote( paste( p==.(p)," and ",phi==.(phi)) ) )
plot(y ~ x, main=bquote( paste( p==.(p)," and ",phi==.(phi)) ) )
par( mfrow=c(1,2))
On my system (details below), the first plot is correct (in my
understanding), and produces a title reading "p=2 and phi=1"
2009 Feb 23
1
r: intergrate behaviour
hello R users
strange behavior of the integrate function!
i assume this occurs because of the way in which the quadriture is set up! (any comments.)
f=function(x){exp(-exp(-x)-5*x)/gamma(5)}
xx=seq(from=-20, to=20, length.out=1000)
plot(xx,f(xx),type="l")
integrate(f, lower=-Inf, upper= 1)
integrate(f, lower=-Inf, upper= 10)
integrate(f, lower=-10, upper= 11)
integrate(f,