Also look at the get function, it may be a bit more straight forward (and safer
if there is any risk of someone specifying 'rm(ls())' as a data frame name).
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original
You can do this by reading in the image and plotting it, then use the updateusr
function from the TeachingDemos package to set the user coordinates to match
the image (use locator to find the current values of some points). Then you
can just use the locator function to get the coordinates of
You can get the name of var by doing
coeffname - deparse(substitute(var))
Is that what you wanted?
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org
If you know the period of the sine that you want to fit (just fitting the
amplitude, phase shift, and offset) and are willing to assume normal errors (or
at least normal enough for the CLT) then you can just use the lm function. If
you need to find the period as well (but still willing to
Look at my.symbols and ms.image in the TeachingDemos package.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of
Look at the EBImage package from bioconductor.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Roger Gill
It is not completely clear what question you are trying to answer or what you
are trying to accomplish. But here are some additional questions that may help:
What tests would you use if you could use the original data?
What assumptions are you willing to make about the data and/or statistics?
?.First.lib
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Johannes Graumann
Sent: Wednesday, October 20,
I generally use simulation to calculate power:
library(MASS)
out1 - replicate(1,
{tmp - mvrnorm(100, mu=c(0,0), Sigma=matrix( c(1,.2,.2,1), 2 ) );
cor.test( tmp[,1], tmp[,2] )$p.value } )
mean( out1 = 0.05 )
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain
Can you show us the code that generated the errors?
Best if you can provide reproducible code (stuff that we can just cut and paste
and it runs, not depending on data that we do not have, you can generate random
data, use built in datasets, or use dput with your data).
--
Gregory (Greg) L.
For a quick exploration of the plot you can use the zoomplot function in the
TeachingDemos package. But for production graphs it is better to explicitly
set the xlim and ylim parameters in creating the plot up front.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain
In addition to the other responses you have received, the xspline function may
also be of use.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org
There is the TkListView function in the TeachingDemos package for looking at
list structures. It gives you a view of the list structure with nested
elements available to be expanded by clicking on the little plus sign. You can
view or run code on the selected piece, which could help create
Look at power.examp in the TeachingDemos package. If that plot is not good
enough, you can steal the code and modify to your specifications.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From:
If you are willing to shift the c vector by 1 and have 1 (the initial value) as
the start of c, then you can just do:
cumsum( cc * b^( (n-1):0 ) ) / b^( (n-1):0 )
to compare:
cc - c(1, rnorm(999) )
b - 0.5
n - length(cc)
a1 - numeric(100)
a1[1] - 1
system.time(for(i in 2:n ) {
a1[i]
[mailto:r-help-boun...@r-
project.org] On Behalf Of Greg Snow
Sent: Monday, November 08, 2010 1:15 PM
To: PLucas; r-help@r-project.org
Subject: Re: [R] How to eliminate this for loop ?
If you are willing to shift the c vector by 1 and have 1 (the initial
value) as the start of c, then you can
Software
wdunlap tibco.com
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Greg Snow
Sent: Tuesday, November 09, 2010 8:31 AM
To: Greg Snow; PLucas; r-help@r-project.org
Subject: Re: [R] How to eliminate this for loop
Here are 2 possibilities:
cbind( iris[,1, drop=FALSE], 1, iris[,2:5] )
cbind( iris, 1) [ ,c(1,6,2:5) ]
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org
You could use the Reduce function to get the sum of the matrices, then if
there are no missing vales just divide by the number of matrices. If there are
missing values then you would probably need to use Reduce again to count the
number of non-missing values.
Since all the matrices are the
Also look at the grconvertX function for a different way of finding the
coordinates to plot at.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org
What hypothesis do you expect the p-values to be testing?
What you would get from regsubsets is unlikely to test any hypothesis of
interest.
If you really feel the need for p-values then the safest approach is probably
the function SnowsCorrectlySizedButOtherwiseUselessTestOfAnything in the
The way you are running the test the null hypothesis is that the data comes
from a normal distribution with mean=0 and standard deviation = 1. If your
minimum data value is 0, then it seems very unlikely that the mean is 0. So
the test is being strongly influenced by the mean and standard
Check out the rms package, especially the validate function.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of
necessary, so is it incorrect to have the same
standard deviation too? I need to go back and read on the K-S test to
see what the appropriate constraints are before bothering anyone for
more help. Sorry, I thought I had it.
Thanks again,
kbrownk
On Nov 11, 12:40 am, Greg Snow greg.s
In addition to Michael's answer, look at the ?par help page and look at the ask
argument, you can use this to have the graphics device wait for you to click
before starting a new plot.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
The best approach if creating all the files using R is to change how you create
the graphs so that they all go to one file to begin with (as mentioned by
Joshua), but if some of the files are created differently (rgl, external
programs), then this is not an option.
One external program that
What package is pointLabel (or is it pointLabels) in? giving a reproducible
example includes stating packages other than the standard ones.
What you are trying to do is not simple for general cases, some tools work
better on some datasets, but others work better on other datasets.
Some other
This is a side effect of the lazy evaluation done in functions. Look at the
help page for the force function for more details and how to force evaluation
and solve your problem.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
Look at Predict.Plot (and TkPredict) from the TeachingDemos package.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On
Well, assuming this refers to the histogram function in the lattice package,
looking at the code for print.trellis shows that the default behavior is to
call plot.trellis with the same arguments. So unless you change the default
behavior, there really is no difference between printing and
Look at the squishplot function in the TeachingDemos package, it may do what
you want, or if not quite then you could perhaps tweak the code to include the
values you want and create the correct aspect ratio.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
I think that your problem comes from a misunderstanding.
The general rule is that you give the plot command 2 vectors, x and y (though
you can give it the vectors separately, or together in a list or matrix). If
you give plot only a single vector then it will use this as the y vector and
use
Did you read the help page for qqnorm? The return value has the x and y
coordinates used, you can just do something like:
tmp - qqnorm( resid(test.lm) )
identify(tmp, , names(resid(test.lm)) )
Or the plot.lm function has an argument id.n that automatically labels the n
most extreme values:
-help-boun...@r-
project.org] On Behalf Of Greg Snow
Sent: Thursday, November 18, 2010 1:11 PM
To: casperyc; r-help@r-project.org
Subject: Re: [R] how exactly does 'identify' work?
Did you read the help page for qqnorm? The return value has the x and
y coordinates used, you can just do
Often when things look to small/thin it is because the plot is being created at
too large a size, then shrunk.
How are you creating the graph? How are you transferring it?
Try creating the graph at the exact size that it will be when used in the
powerpoint, then without needing to resize
Look at Predict.Plot (and possibly TkPredict) in the TeachingDemos package.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org]
Look at the subplot function in the TeachingDemos package.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of
I would suggest reading the discussion (all the posts) starting at:
http://tolstoy.newcastle.edu.au/R/e2/help/07/08/22858.html
This gives reasons for not doing what you are asking along with some
alternatives.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
One possibility for what is happening is that when you load the object it does
not automatically load the package as well, so you get an error when working
with the object. Try loading lme4 package in a new session, then load the
saved object and see if things work for you.
--
Gregory (Greg)
What Frank was trying to tell you is that the p-values don't have much meaning
if you do stepwise regression (sometimes they are worse than useless). The
p-values are computed based on certain assumptions, once you remove a variable
because it is Not Significant, then recompute, those
Generating new data from a kernel density estimate is equivalent to choosing a
point from your data at random, then generating a point from your kernel
centered at the chosen point.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
This is a user interface issue. The standard command line user interfaces all
wait for the user to hit enter before sending the information to the parser, so
this cannot be done using the standard command line interface.
You could rewrite the source code, but that is probably overkill. The
I would suggest using the layout function instead of the mfcol and pin with
par. The layout function gives you more control of the size of areas to be
plotted to.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original
If the curves are sufficiently close to sine (cosine) curves and you know the
period, then this can be restructured as a linear model and you can avoid all
the complexities that come with non-linear models. Further, from your
description, it does not sound like you really gain much from using
There are several functions in several packages for plotting intervals that
will give you plots much better than the excel one. The RSiteSearch function
or the sos package may help you find those.
But it is also easy to create such plots using just a few lines of R code and
base graphics.
content[na.omit(pmatch(searchset, content,,TRUE))]
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Ralf B
For one definition of random:
ss - rexp(100)
ss - ss/sum(ss)
ss - 5 + round( ss*9500 )
cnt - 0
while( ( d - sum(ss) - 1 ) != 0 ) {
tmpid - sample.int(100,1)
ss[tmpid] - ss[tmpid] - d
ss[ ss 500 ] - 500
ss[ ss 5 ] - 5
cnt - cnt + 1
-
From: Ralf B [mailto:ralf.bie...@gmail.com]
Sent: Tuesday, July 13, 2010 11:57 AM
To: Greg Snow
Cc: r-help@r-project.org
Subject: Re: [R] StartsWith over vector of Strings?
When running the combined code with your suggested line:
content - data.frame(urls=c(
http://www.google.com
It looks like you want to use a matrix, then you can do proper indexing.
Creating the names will just lead to unnecessary complexity and confusion.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
Look at the logspline package. This is a different approach to density
estimation from the kernel densities used by 'density', but does allow you to
set fixed boundaries.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
You may want to look at the biglm package as another way to regression models
on very large data sets.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org
This is a frequently asked/answered question (7.21 in the FAQ). What searching
did you do and why did it not find this FAQ or previous discussion of it? How
could the documentation/search/etc. be improved so that you (and the next n
people with this question) will find the answer easier?
The
Hopefully the right now will be a forever. The fact that trellis graphics do
not support hatching is a conscious decision or feature, not a bug or missing
feature to be corrected some day (at least I for one will be disappointed if
Deepayan (or someone else) gives in and implements it).
Have
Another option for fitting a smooth distribution to data (and generating future
observations from the smooth distribution) is to use the logspline package.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original
Look at the HSAUR package (and the book that it goes with). This may give you
(your students) enough to start on several topics. If you use these examples
then you should probably include the book as at least an optional text for the
class.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data
It is probably easier to do this without eval and parse (see fortune(106)).
Something like:
val - get(dataname)[[v1]]
hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From:
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: Frank Harrell [mailto:f.harr...@vanderbilt.edu]
Sent: Tuesday, July 27, 2010 4:54 PM
To: Greg Snow
Cc: xin wei; r-help@r-project.org
Subject: Re: [R] how to generate a random data from a empirical
distribition
In addition to the arrows function, look at the my.symbols and ms.arrows
functions in the TeachingDemos package, this is a wrapper around the arrows
function, but may be a more natural interface for what you want.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
Tufte discusses hash lines in his book The Visual Display of Quantitative
Information and does a better job of it than I can. The short version is that
the hashing can actually produce optical illusion effects that distort the
information. (and often don't copy well either).
Printing and
Do you mean like:
plot(1:10)
locator(2, type='l')
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Erin
It is possible that the plot function starts to plot before the new device is
fully in place, you could try sleeping for a second or 2 between the call to
dev.new and the call to plot.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
There are an infinite number of solutions for your example, so I hope you
really don't want to see all of them. In theory you could work up some code to
start showing them to you, but the sun will go nova and atomize you and your
computer before it shows all of them.
Expressing the infinite
?scale
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of leepama
Sent: Tuesday, August 03, 2010 10:55 PM
To:
Do ?'for' to learn about for loops. Look at FAQ 7.21 for the other part of the
question (the most important part of the answer is the end where it tells you
to use lists instead like Patrick suggests).
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
The warning (with an error you would not see any results) means that there are
ties in your data, the theory behind the ks test says that the probability of
seeing ties is 0, so your data and the theory do not match, therefore the
p-value is suspect (though an ok approximation for some uses).
It is not clear what question you are trying to answer. Perhaps if you can
give us an explanation of your overall goal then we can be more helpful.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
?sweep
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Maurits Aben
Sent: Thursday, August 05, 2010 2:00 PM
fortune(106)
If the answer is parse() you should usually rethink the question.
-- Thomas Lumley
R-help (February 2005)
Here is one approach that seems to be working:
for (meanCol in paste(Mean_, 1:3, sep=)) {
cat('\n##',meanCol,'\n\n')
f - formula( paste(
Look at the TkPredict and Predict.Plot functions in the TeachingDemos package
as a couple of options.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org
Look at the my.symbols and subplot functions in the TeachingDemos package, one
of those may work for you.
Note however that the author of those functions is one of the advocates against
the use of pie charts and if there were a free (as in speech) license that
would allow for excluding any use
What if you change your function to:
mdlChooser - function(type=c(one,two)) {
type - match.arg(type)
switch(type,
one={ function(x,N0,r) N0*exp(x*r) },
two={ function(x,N0,r,K) (N0*K)/(N0+(K-N0)*exp(-x*r)) },
)
}
Does that work for you?
--
Gregory (Greg) L. Snow Ph.D.
Statistical
this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: Panos Hadjinicolaou [mailto:p.hadjinicol...@cyi.ac.cy]
Sent: Tuesday, August 10, 2010 6:07 AM
To: Greg Snow; r-help@r-project.org
I don't know much about pvclust itself, but you might consider the technique in
this paper:
Buja, A., Cook, D. Hofmann, H., Lawrence, M. Lee, E.-K., Swayne,
D.F and Wickham, H. (2009) Statistical Inference for exploratory
data analysis and model diagnostics Phil. Trans. R. Soc. A
What is wrong with using a loop?
It used to be that loops were much slower than some of the alternatives, but
now days a well crafted loop runs almost as fast (sometime faster) than the
apply functions. So if the loop is working for you, use it and don't worry
about it (though there may be
The simplest thing to do is just recreate the plot(s) from scratch at each
iteration with all the accumulated data. Most graphics devices are fast enough
now that you will not notice the redraw. If you really just want to add to the
plots, you can save and restore the graphics parameters,
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Joshua Wiley
Sent: Wednesday, August 11, 2010 6:31 PM
To: Lorenzo Cattarino
Cc: r-help@r-project.org
Subject: Re: [R] storing the results of an apply call
What follows is
If you want a grid of hexagons, look at the examples in the my.symbols function
(TeachingDemos package), one of those gives a way to create the grid of
hexagons (not as efficient as the hexbin package, but allows you to set your
own colors).
For choosing colors you may want to look at the
-Original Message-
From: Marc Schwartz [mailto:marc_schwa...@me.com]
Sent: Thursday, August 12, 2010 3:32 PM
To: Greg Snow; Joshua Wiley
Cc: r-help@r-project.org Forum
Subject: Re: [R] storing the results of an apply call
P.S. Pardon me while I go visit with the Emacs
-Original Message-
From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Thursday, August 12, 2010 3:13 PM
To: Greg Snow
Cc: Joshua Wiley; r-help@r-project.org
Subject: Re: [R] storing the results of an apply call
On Aug 12, 2010, at 5:07 PM, Greg Snow wrote:
[1
How about:
tmp - expand.grid(one = 1:11, two = 1:11)
tmp$week - ( ( tmp$one + tmp$two ) %% 11 ) + 1
# reformat for simplicity
tmp2 - tmp[ order(tmp$week), ]
tmp3 - tmp2[ tmp2$one tmp2$two , ]
### do some checks to make sure everyone plays everyone
###exactly once and each team plays at
R/S does all of that automatically for you, you do not need to manually create
the indicator variables.
If you do something like:
fit - lm( Sepal.Width ~ Species, data=iris, x=TRUE)
Then look at the matrix actually used:
fit$x
Or the output:
summary(fit)
You will see that Species was
If you just want to visualize the effect on one variable on the response from
some different models then you might try Predict.Plot from the TeachingDemos
package. It takes a little tweaking to get it to work with cph objects, but
here is a basic example (partly stolen from the help page for
Why would you want to do this? Confidence intervals tell you about the
uncertainty of the mean of y give x, not the individual data points. It may
make more sense to use prediction intervals that tell you about individuals
rather than means, but that still means throwing away alpha% of
you suggest I read? Thanks.
data(InsectSprays)
lm(InsectSprays$count ~ 0 + InsectSprays$spray)
On Aug 13, 2010, at 10:34 AM, Greg Snow wrote:
R/S does all of that automatically for you, you do not need to manually
create the indicator variables.
If you do something like:
fit - lm
The playSudoku function in the Sudoku package reacts to keypresses using
windows or Tk, you can use that as an example.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From:
?missing
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of vo...@cbox.cz
Sent: Tuesday, August 17, 2010 6:22 AM
What do you plan to do with those vectors?
Creating a set of vectors and 'asign'ing them as global variables will likely
make future tasks harder than they need to be. In the long run it will
probably work better for you to either keep them as a matrix (and just access
the row/column you
Well you already have the correlation matrix, so you can just work from there.
One of the profound equations in statistics is that r^2=r^2, meaning that to
get r2 (as you call it, assuming you mean the coefficient of determination)
just square the elements of the correlation matrix.
To get
Do a search for multidimensional scaling and that should give some ideas (use
1-cor or something like that as the distance measure).
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
It would help us help you if you could give a description of what your ultimate
goal is here. Is it to simulate the dice? Then you may want to just use the
dice function in the TeachingDemos package (or you can animate the rolling with
plot.rgl.die and roll.rgl.die in the same package). Or
Here is a quick example:
c1 - cor(iris[,-5])
s1 - sqrt(diag(var(iris[,-5])))
betas - diag( s1 ) %*% c1 %*% diag( 1/s1 )
# now compare:
coef( lm( Sepal.Length ~ Sepal.Width, data=iris ) )[2]
betas[1,2]
But if you cannot work that out on your own, then you really should review
linear algebra
Your question brings up a bit of a philosophical issue (or possibly economic
theory). The idea is the contrast between specialization and generalization.
A purely specialized program will only do one thing (but hopefully do that one
thing well), the ultimate generalized program will do
You can look at the code for mean.default and see how it does the trimming,
then you can use that to create your own trimmed version to pass to other
functions.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original
?pairs
?lattice::splom
?lattice::panel.xyplot
pairs( state.x77, panel=function(x,y){
points(x,y)
abline(lm(y~x), col='red')
})
library(lattice)
splom( ~state.x77, type=c('p','r') )
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
A couple of additional examples of when asp is important to use:
The command abline(0,1) adds a line to the current plot, this line is often
referred to as the 45 degree line, but the angle with the axes is only 45
degrees when asp==1, setting asp=1 will enforce this.
There are multiple
How about:
x - 1 2 -5, 3- 6 4 8 5-7 10; x
library(gsubfn)
strapply( x, '(([0-9]+) *- *([0-9]+))|([0-9]+)',
function(one,two,three,four) {
if( nchar(four) 0 ) return(as.numeric(four) )
return( seq( from=as.numeric(two), to=as.numeric(three) ) )
In addition to the other suggestions you may also want to look at the subplot
function in the TeachingDemos package (the version in Hmisc is a copy of a
prior version of this one) as well as the my.symbols or panel.my.symbols
functions in the same package.
--
Gregory (Greg) L. Snow Ph.D.
If you find yourself doing things like this often, but don't want to explicitly
set the seed, or save seeds before simulating, then you can run the following
code (or put it into .Rprofile or similar):
.Last.Random.seed - .Random.seed
addTaskCallback( function(expr, val, ok, visible){
Put the line:
cat(z1,'\n')
in your function. You may also want to put the flush.console() command right
after that.
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From:
Using the barplot function in base graphics you just set space=0, but that
function does not have a box.ratio argument which would imply that you are
using something else. If you let us know which function (and which package it
is in) then it is easier (possible) for us to help you, even
1 - 100 of 2155 matches
Mail list logo