Displaying 20 results from an estimated 53 matches for "100,0,1".
Did you mean:
1000,1
2005 Jan 11
2
getting variable names from formula
R-list,
1. Given a formula (f) w variables referencing some data set (dat), is
there any easier/faster way than this to get the names (in character form)
of the variables on the RHS of '~' ?
dat <- data.frame(x1 = x1 <- rnorm(100,0,1), x2 = x2 <- rnorm(100,0,1), y = x1 + x2 + rnorm(100,0,1))
f <- y ~ x1 + x2
mf <- model.frame(f, data=dat)
mt <- attr(mf, "terms")
predvarnames <- attr(mt, "term.labels")
> predvarnames
[1] "x1" "x2"
-----
2. Also, is there a...
2009 Dec 14
0
Confused on using expand.grid(), array(), image() and npudens(np) in my case
...) and npudensbw().
This confusion will only be generated in >=3 dimensions. I marked the four
places with confusion1-4. I think there should be some kind
of correspondence in those four places,but cannot figure them out.Thanks
very much for chewing on this.
#simulated dataset: d
x1<-c(runif(100,0,1),runif(50,0.67,1));y1<-c(runif(100,0,1),runif(50,0.67,1));d1<-data.frame(x1,y1);colnames(d1)<-c("x","y")
x2<-c(runif(100,0,1),runif(50,0.33,0.67));y2<-c(runif(100,0,1),runif(50,0.33,0.67));d2<-data.frame(x2,y2);colnames(d2)<-c("x","y"...
2006 Nov 12
0
forward variable selection using function step
...I got this error message whenever it chose a model with an interaction
term X_p :X_q and if I put X_q before X_p in the upper scope formula, like
X_q*X_p***. Shouldn't X_p:X_q be the same as X_q:X_p? So why am I getting
this error message? Any help is greatly appreciated.
> x1<-rnorm(100,0,1)
> x2<-rnorm(100,0,1)
> x3<-rnorm(100,0,1)
> y<-x1+x2+2*x3+2*x1*x3+rnorm(100,0,1)
> datasim<-data.frame(cbind(y,x1,x2,x3))
>
steplm<-step(lm(y~1,data=datasim),scope=list(upper=~x1*x2*x3,lower=~1),direction="forward",trace=1)
Start: AIC= 274.81
y ~ 1...
2009 May 13
2
Problems with randomly generating samples
Dear R users,
Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size.
For example, if I want to generate 1000 samples of size n=100, with a N(0,1) distribution, how should I proceed?
(Since I dont want to do "rnorm(100,0,1)" in R for 1000 times)
Thanks for help
Debbie
_________________________________________________________________
Looking to change your car this year? Find car news, revi...
2004 Mar 09
4
help
Hello,
I am a new member, and I need your help.
For my work (thesis), I use the package rpart to construct trees.
But, to continu my studies, I need to calcule the 'variable importance'. But, I
don't find a program to do this in the implementation of R.
Is there someone who know if there exist a program which calculate the 'variable
importance', notion defined by Breiman and
2005 Dec 29
2
How to fit all points into plot?
.... Some points (or parts of the
line) are not shown on the graph because they lie
beyond the scale of the axis. Is there a way to
overcome this so all points (or the entire line) are
shown on the graph? Here's an example of my problem:
colors = c("red", "blue")
plot(x=rnorm(100,0,1), y=runif(100), type="p", pch=21,
col = colors[1])
# if I add these points not all of them are shown on
the graph
lines(x=rnorm(100,3,1), y=runif(100), type="p",
pch=24, col = colors[2])
Thanks in advance,
Martin
2004 Aug 19
3
probability histogram question
Hello, all;
I get an unexpected result when trying to plot a probability histogram
with R1.9.1 on windows xp:
#with the following code:
> x <- runif(100,0,1)
> hist(x)
> hist(x, freq=F)
> h <- hist(x, freq=F)
> summary(h)
# Length Class Mode
#breaks 11 -none- numeric
#counts 10 -none- numeric
#intensities 10 -none- numeric
#density 10 -none- numeric
#mids 10 -none- numeric
#xname...
2009 Jul 23
3
How to perform a calculation in each element of my list?
Hi R-helpers,
I have a list containing 10 elements, each of which is a dataframe. I wish
to add a new column to each list element (dataframe) containing the product
of the last two columns of each dataframe.
I'd appreciate any pointers, thanks!
Mark Na
[[alternative HTML version deleted]]
2008 Nov 20
4
Dequantizing
I have some data measured with a coarsely-quantized clock. Let's say
the real data are
q<- sort(rexp(100,.5))
The quantized form is floor(q), so a simple quantile plot of one
against the other can be calculated using:
plot(q,type="l"); points(floor(q),col="red")
which of course shows the characteristic stair-step. I would like to
smooth the quantized form back into an app...
2001 Jan 17
2
PR#751
...rather, confirm an existing one
(bug #751).
I have had some difficulty using the polyroot() function.
For example, in Win 98, R 1.1.1,
> polyroot(c(2,1,1))
correctly (per the help index) gives the roots of 1 + (1*x) + (2*x^2) as
[1] -0.5+1.322876i -0.5-1.322876i
However,
> polyroot(c(-100,0,1))
gives the roots of
[1] 10+0i -10+0i
which corresponds to -100 + x^2, not 1 - (100*x^2).
Also,
> polyroot(c(0,0,0,1))
gives
[1] 0+0i 0+0i -10+0i
which aren't all roots of x^3.
Thanks for all your efforts.
I apologize if I'm missing something.
Kristian Markon...
2008 Sep 04
2
Adding a legend to R graph device with several plots (no to individual plots!)
...t, but I am looking for something in the spirit of mtext. That
is, putting the legend anywhere I want on the device. In my situation
I have:
par(mfrow=c(2,2), ann = FALSE)
p.names <- c("1","2","3","4")
lapply(p.names, function(x) {
d1 <- density(rnorm(100,0,1))
d2 <- density(rnorm(100,.3,1.2))
plot(range(d1$x, d2$x), range(d1$y, d2$y), type = "n", xlab = NULL,
ylab = NULL)
lines(d1, col = "black", lty = 2)
lines(d2, col = "black", lty = 1)
})
mtext("Learning R the hard way", side = 1, line=-1.5, outer...
2007 Dec 10
2
Problem with graphics device in Mac OS X
...plot command does not bring up a plot (e.g. plot(), boxplot(), hist()).
I found a thread concerning X11 windows under Mac OS X but I feel these users will most likely be just using the native quartz device.
Invoking a call to quartz() first does not seem to help, e.g.
>quartz()
>plot(rnorm(100,0,1))
produces no output and no error message (Nothing happens). A call to dev.cur() seems to indicate a device is active.
>quartz()
>dev.cur()
quartz
2
but again a plot command produces no figure. Sorry am I not a Mac OS user and I did check the archives but found mostly discussions on X11...
2009 May 13
11
Simulation
Dear R users,
Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size.
For example, if I want to generate 1000 samples of size n=100, with a N(0,1) distribution, how should I proceed?
(Since I dont want to do "rnorm(100,0,1)" in R for 1000 times)
Thanks for help
Debbie
_________________________________________________________________
Looking to change your car this year? Find car news,...
2000 Apr 21
1
outlier detection methods in r?
hi -
if I sample from a normal distribution with something like
n100<-rnorm(100,0,1)
and add an outlier with
n100[10]<-4
then
qqnorm(n100)
visually shows the point 4 as an outlier
and calculating the probablity of a value of 4 or bigger in 100 samples of norm(0,1)
gives
> 1-exp(log(pnorm(4,0,1))*100)
[1] 0.003162164
If I have more than 1 sample above out...
2005 May 04
1
Questions about the intersection area under two kernel densities
Hi there,
I am working on a project which needs the value of the interaction area under two distributions( eatimated by kernel density estimators).
For example:
x<-rnorm(100,0,1)
y<-rnorm(100,0.2,1)
density(x) # This produces the summary of dependent variable and independent variable.
How can I get the individual values of variables and reform a curve to calculate the area under curve?
Is there a way to get aroud this and give me the solution?
Thanks a lot....
2007 Feb 24
1
recovering collums of DF using a text var.list
Um texto embutido e sem conjunto de caracteres especificado associado...
Nome: n?o dispon?vel
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070224/7164edfb/attachment.pl
2008 Sep 16
1
are these the same?
Dear members,
I was trying to simulate W which is iid and depends on X and Y.
Here are 2 methods:
Method 1:
x<-rnorm(100)
y<-rnorm(100)
w<-rnorm(100, 2x+y,1)
Method 2:
x<-rnorm(100)
y<-rnorm(100)
w<-2x+y+rnorm(100,0,1)
Are these methods comparable?
Since x and y are vectors, the term 2x+y would return a vector. It seems that, given Method 1, each element of W would come from a different populat...
2009 May 22
1
anova leads to an error
Dear R-list,
the following code had been running well over the last months:
exam <- matrix(rnorm(100,0,1), 10, 10)
gg <- factor(c(rep("A", 5), rep("B", 5)))
mlmfit <- lm(exam ~ 1); mlmfitG <- lm(exam ~ gg)
result <- anova(mlmfitG, mlmfit, X=~0, M=~1)
Until, all of a sudden the following error occured:
Fehler in apply(abs(sapply(deltassd, funct...
2010 Oct 27
1
Control of axis limits in multiple panel lattice plots
...) is introduced at the extremes of the x and y
axes of my lattice plots.
I've tried defining the scales using xlim, scale and num.limits in
x.scale.components, but haven't succeded in getting overriding the
introduction of extra space.
Here's the problem:
test.df<-data.frame(a=runif(100,0,1),b=c(runif(50,0,1),runif(50,0,2)),c=c(rep(c("A","B"),c(50,50))))
1) Space appears when I plot multiple panels:
xyplot(a~b|c,data=test.df)
2) I can get rid of the space by explicitly defining scales (shown for
x axis)...
xyplot(a~b|c,data=test.df...
2011 Nov 23
1
character substitution within a variable name
Hi,
I'd like to create a function that accepts as arguments a string that is to
be substituted within a variable name. For instance, suppose I have a data
frame df:
df<-data.frame(x_narrow=c(rnorm(100,0,1)),x_wide=c(rnorm(100,0,10)))
What I have in mind is something like:
f <- function(string){
var = paste("x_",string,sep = "")
df$var
}
which does not work. Any suggestion for modifications? Thanks in advance,
Matteo
--
View this message in context: http://r.789695.n4.n...