Re: [R] sd help

2011-09-04 Thread GlenB
The sd function is doing *exactly* what it should. the sd of 5 is "NA", and the sd of 7 is "NA" try looking at "a" itself. My guess is that you didn't intend to have two columns each with one value. Did you instead intend to have 5 and 7 in one vector, like so: a<-c(5,7) sd(a) Glen __

Re: [R] Analyzing non-numerical data

2010-05-03 Thread GlenB
This is not really the correct forum, but very briefly, and in rough order of complexity, you can do a summary (which counts the occurences of the categories in a factor), you could look at crosstabulations of questions (e.g ?table, ?tabulate, ?chisq.test), and also measures of association in tabl

Re: [R] Jonckheere-Terpstra test using coin package?

2010-04-22 Thread GlenB
I am unfamiliar with how to use coin, but it looks like it should be doable - the vignette in coin.pdf does a Page test. The wikipedia page for Page's test explains how this is related to the Jonckheere-Terpstra test, which seems to suggest if it can do one it should be able to do the other. Add t

Re: [R] Help me with writing function sort()

2010-04-11 Thread GlenB
http://lmgtfy.com/?q=sort+algorithm -- View this message in context: http://n4.nabble.com/Help-me-with-writing-function-sort-tp1836063p1836181.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://s

Re: [R] bootstrap confidence intervals, non iid

2010-04-08 Thread GlenB
It's possible I have failed to understand your situation (it's not clearly described). If your model captures the dependence structure (e.g. that induced by a common-but-unknown block effect), then in many cases it could be set up to work. If the dependence is of some form not captured in the mod

Re: [R] changing column names in a dataframe

2010-04-06 Thread GlenB
jda wrote: > > I have imported data from an Excel spreadsheet. Columns in that > spreadsheet are named "name", "x", and "y", and several sets of those > columns appear in the worksheet. For example: > > name x y name x y > test1 1 3 test2 4 4 > test1 2 2 test2 5 5 > test1 3 1 test2 6 6

Re: [R] bootstrap confidence intervals, non iid

2010-04-06 Thread GlenB
Kay Cichini wrote: > > i need to calculate ci's for each of 4 groups within a dataset, to be able > to infere about differences in the variable "similarity". the problem is > that data within groups is dependent, as assigned by the blocking-factor > "site". my guess was to use a block bootstrap

Re: [R] generating samples by Monte Carlo

2010-03-29 Thread GlenB
> 5000 samples, Exponential distribution (f(x), lambda=0.0005, 0<=x<=360) If you don't need the truncation at 360 you can just use rgamma to generate the exponentials rgamma(5000,shape=1,rate=0.0005) (It's not 100% clear but I assume your lambda is an inverse of a scale parameter) Why are y

Re: [R] I have a question on nomograms.

2010-03-26 Thread GlenB
GlenB wrote: > > > R Heberto Ghezzo, Dr wrote: >> >> Does anybody knows anything about constructing LAN? Any books or already >> rograms to do it? >> > A list of good references is available here: http://www.projectrho.com/nomogram/reading.html -- View

Re: [R] I have a question on nomograms.

2010-03-26 Thread GlenB
R Heberto Ghezzo, Dr wrote: > > On the same topic but from a different perspective. A Nomogram or better > a Line Aligned Nomogram is a graph with 2 or more scales, maybe linear > where by alignig values in each scale you can read values in the other > scale. The relationship can be linear, the

Re: [R] OUTPUT the row

2010-03-19 Thread GlenB
> a<-read.table(stdin(),header=TRUE) 0: id kAgeHeight 1: 23 2 23 60 2: 12 3 28 58 3: 19 4 18 55 4: 37 5 22 54 5: > with(a,k[Age==min(Age)]) [1] 4 -- View this message in context: http://n4.nabble.com/OUTPUT-the-row-tp1644200p

Re: [R] A complex case of distribution fitting

2010-03-15 Thread GlenB
Are you referring to a truncated normal? (http://en.wikipedia.org/wiki/Truncated_normal_distribution) Glen -- View this message in context: http://n4.nabble.com/A-complex-case-of-distribution-fitting-tp1593273p1594311.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Help! I need to use R to calculate a recursive function!

2010-03-09 Thread GlenB
Please show your attempt that didn't work. What do you do for Z(1)? (You could try looking at the help on filter) -- View this message in context: http://n4.nabble.com/Help-I-need-to-use-R-to-calculate-a-recursive-function-tp1586189p1586777.html Sent from the R help mailing list archive at Na

Re: [R] two questions for R beginners

2010-02-26 Thread GlenB
Lazy and impatient? That's me! I find it hard to say what my biggest misconceptions were. Here's one thing: What I realized very early on: - many data analysis functions return a bunch of stuff, not all of which you see when you print() it what I *failed* to realize: - The bunch of stuff

Re: [R] linear predictors and survreg function

2010-02-09 Thread GlenB
Note that the first set of coefficients minus the second set of coefficients is constant (12.78262) -- View this message in context: http://n4.nabble.com/linear-predictors-and-survreg-function-tp1474388p1475332.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] If then test

2010-01-27 Thread GlenB
Do you actually need the intermediate result (the vector of 1's and 0's), or just the result - the total number of columns? Is the number you're comparing to different for each column? Assuming the answers are "just the result" and "comparing to the same number" x <- matrix(c(4,5,7,2),nc=2) n

[R] plotting additive ns components

2010-01-27 Thread GlenB
I have an additive model of the following form : zmdlfit <- lm(z~ns(x,df=6)+ns(y,df=6)) I can get the fitted values and plot them against z easily enough, but I also want to both obtain and plot the two additive components (the estimates of the two additive terms on the RHS) I've been looking

Re: [R] Newton method

2010-01-26 Thread GlenB
your problem is because f is a vector of the same length as runi as a result, the thing you're trying to assign to z[i+1] is also a vector of that length -- View this message in context: http://n4.nabble.com/Newton-method-tp1311057p1311228.html Sent from the R help mailing list archive at Nabbl

Re: [R] Matching a character in a string

2010-01-25 Thread GlenB
See also ?unlist (you can unlist(strsplit(...)) for the same effect -- View this message in context: http://n4.nabble.com/Matching-a-character-in-a-string-tp1289795p1290011.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pro

Re: [R] Matching a character in a string

2010-01-25 Thread GlenB
The output from strsplit("hello","") is not suitable as input for the second argument for charmatch. compare with: charmatch("o",strsplit("hello","")[[1]]) -- View this message in context: http://n4.nabble.com/Matching-a-character-in-a-string-tp1289795p1289976.html Sent from the R help maili

Re: [R] Printing RVector

2010-01-20 Thread GlenB
Does *cat(v[0])* produce what you need? -- View this message in context: http://n4.nabble.com/Printing-RVector-tp1018770p1025909.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/m

Re: [R] Merge and join data

2010-01-20 Thread GlenB
Specifically, your setup of the data makes all the columns factors, so to make Peter's code work you need to make the relevant columns numeric first. -- View this message in context: http://n4.nabble.com/Merge-and-join-data-tp1018729p1025642.html Sent from the R help mailing list archive at Nabb

Re: [R] Matrices with randomly generated entries

2010-01-20 Thread GlenB
Why not just use matrix(runif(9),nrow=3) ? -- View this message in context: http://n4.nabble.com/Matrices-with-randomly-generated-entries-tp1018777p1024617.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org ma

Re: [R] How to detect and exclude outliers in R?

2010-01-18 Thread GlenB
What makes an outlier an outlier depends on the model. A highly discrepant observation under one model is entirely typical under another. Even given a model, criteria for what consititutes an outlier vary by application area and user. Even given all of that, exclusion is only one of many possib

Re: [R] does any package have the functionality of ace() from old acepack?

2010-01-18 Thread GlenB
I tried to use transace but it tried to call ace from acepack. So I re-downloaded Hmisc to make sure I had the latest version (Warning message: "package 'Hmisc' was built under R version 2.10.1" - I am running 2.10.0, Windows version running under XP). looking at transace, it has this: > if (.

Re: [R] does any package have the functionality of ace() from old acepack?

2010-01-18 Thread GlenB
Thanks very much, it looks to be an implementation the same algorithm with slightly different form of inputs and some useful extras. It should do nicely. Jonathan Baron wrote: A similar function is transace from the Hmisc package: http://finzi.psych.upenn.edu/library/Hmisc/html/transace.html

[R] does any package have the functionality of ace() from old acepack?

2010-01-18 Thread GlenB
I found the old ace function (from acepack) valuable a couple of years ago in helping to find a transformation of the response to approximate additivity in smooth functions of the predictors. ace used alternating conditional expectations, but I'm not overly fixated on algorithms as long as it wo

Re: [R] Mixtures of Discrete Uniforms

2010-01-13 Thread GlenB
Jim Silverton wrote: > > I want to create the mixture formulation of a discrete uniform ie, say > f(x) = 1/10, for i = 1,2,3,4,5,6,7,8,9 and 10 and > another discrete distribution which has the same values of x, but he > probabilities can vary. Can this be done on any package in R? an if so, >

Re: [R] Formula for normal distribution with know mean and standard error and n terms

2010-01-13 Thread GlenB
steve_fried...@nps.gov wrote: > > I am searching for a method to calculate a normal distribution. > > For example this equation is used to calculate the normal curve when the > mean and standard deviation are know. > p(x) = (1/σ*sqrt(2π)) x exp (- (x-μ)2/2σ2) > > However, some of the literatu

Re: [R] Accessing members

2009-12-28 Thread GlenB
This is a result of how R treats factors. There's more than one way to do what I think you're asking for. I've constructed a smaller version of your data frame to illustrate one quick way if that's all you need: > smdat<- > data.frame(V1=c("AB","AB.C","ABF10"),V2=rep("20091224",3),V3=rep(156.0

Re: [R] [ how can sample from f(x)~x^(a-1)

2009-12-26 Thread GlenB
khazaei said: > how can sample from f(x)~x^(a-1)*ind(0,min(b,-log(u)) in R? > where a and b is positive constand and 0http://n4.nabble.com/how-can-sample-from-f-x-x-a-1-tp978822p979342.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Multiple regression script

2009-12-07 Thread GlenB
Joel Fürstenberg-Hägg said: "Multiple linear regression [...] I would like to check every possible combination of factors, evalute the results based for instance on their p values, and then choose the best regression model." By "every possible combination of factors", I assume you mean that for

Re: [R] Normal tests disagree?

2009-12-03 Thread GlenB
And now some advice: I'm of the opinion that one should only in very rare circumstances be doing hypothesis testing of distributions. For example, the most common reason people give for doing a hypothesis test of the distribution of a sample is that they want to check the appropriateness of the

Re: [R] Normal tests disagree?

2009-12-03 Thread GlenB
rkevinburton wrote: > > If I have data that I feed into shapio.test and jarque.bera.test yet they > seem to disagree. What do I use for a decision? > > For my data set I have p.value of 0.05496421 returned from the > shapiro.test and 0.882027 returned from the jarque.bera.test. I have > includ