Re: [R] Counting things in a time series.

2010-11-21 Thread Daniel Malter
Hi, these are pretty basic questions. You might want to pick up an introductory manual. Lets assume you have a time stamp that already indicates the hours. Assume you have 300 observations, each of which falls in one of 24 hours of observation. You easily get the number of obs in each hour with

[R] grep with search terms defined by a variable

2010-08-02 Thread Daniel Malter
Hi, I have a good grasp of grep() and gsub() for finding and extracting character strings. However, I cannot figure out how to use a search term that is stored in a variable when the search string is more complex. #Say I have a string, and want to know whether the last name Jannings is in the

Re: [R] grep with search terms defined by a variable

2010-08-02 Thread Daniel Malter
A beauty. Works a charm. Many many thanks. Daniel -- View this message in context: http://r.789695.n4.nabble.com/grep-with-search-terms-defined-by-a-variable-tp2311294p2311307.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] lme4 + R 2.11.0 + mac unavailable

2010-08-24 Thread Daniel Malter
Hi, has there been a solution to this issue? I am encountering the same problem on a Mac with OSX 10.6.4. The problem persists when I try to install lme4 from the source (see below), and my R version is up to date according to R's update check. Thanks for any help, Daniel --

Re: [R] how to fill out the empty spots when using rbind or cbind?

2009-10-02 Thread Daniel Malter
Fill the respective empty spots in the vectors with NAs. Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von tke...@msn.com Gesendet:

Re: [R] Urgently needed Exercise solutions related to PracticalData Analysis Using R Statisctial Software

2009-10-03 Thread Daniel Malter
This person has probably mistaken expelsior for excelsior. However, be that as it may, I am personally annoyed by your statement, David, in which you indicate that you believe this to be an MBA/business school problem, especially since the delinquent clearly indicates in his post - for which YOU

Re: [R] offlist Re: AW: Urgently needed Exercise solutions related to PracticalData Analysis Using R Statisctial Software

2009-10-03 Thread Daniel Malter
- cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: David Winsemius [mailto:dwinsem...@comcast.net] Gesendet: Saturday, October 03, 2009 11:56 PM An: Daniel Malter Betreff: offlist Re: AW: [R] Urgently needed Exercise solutions related

Re: [R] The nature of evidence (was Re: Urgently needed Exercisesolutions related to PracticalData)

2009-10-05 Thread Daniel Malter
Connolly [mailto:p_conno...@slingshot.co.nz] Gesendet: Monday, October 05, 2009 1:56 AM An: Daniel Malter Cc: 'David Winsemius'; r-help@r-project.org Betreff: [R] The nature of evidence (was Re: [R] Urgently needed Exercisesolutions related to PracticalData) On Sat, 03-Oct-2009 at 11:35PM -0400

Re: [R] Problem with na.omit when using length()

2009-10-05 Thread Daniel Malter
This looks buggish to me (though at least non-intuitive), but I am almost sure there is an explanation for why the b==0 condition includes the NAs. You find a way to circumvent it in the last two lines of the example below. a=c(1,1,1,0,0,0) b=c(1,NA,0,1,NA,0) sno=rnorm(6) na.omit(length(sno[a==1

Re: [R] sort (all columns of) a matrix

2009-10-08 Thread Daniel Malter
I assume you want to sort the whole dataset (matrix) by ordering one column in ascending order (and order all other columns appropriately). a-matrix(a-c(1,3,4,6,6,4,6,56,4,64,86,39,4,2),length(a),2) a #sort by first column a[order(a[,1]),] #sort by second column a[order(a[,2]),] #both give

Re: [R] lm output

2009-10-09 Thread Daniel Malter
That comes out as an NA because X'X is not invertible because it is not full rank (one row/column is a linear combination of the other(s)). And that means there is no unique solution to the system. y=c(10,12,17) x=c(5,5,5) X=cbind(1,x) X t(X)%*%X solve(t(X)%*%X) Therefore, nope, there is now

Re: [R] lm output

2009-10-09 Thread Daniel Malter
. Overall, I would say the output makes sense. Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: Brecknock, Peter [mailto:peter.breckn...@bp.com] Gesendet: Friday, October 09, 2009 5:45 PM An: Daniel Malter; r-help@r

Re: [R] add=TRUE function not working

2009-10-11 Thread Daniel Malter
x1=rnorm(100) x2=rnorm(100) e=rnorm(100) y=1.5*x1+x2+e plot(y~x1,pch=1,xlim=c(min(x1,x2),max(x1,x2))) points(y~x2,pch=16) HTH Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org

Re: [R] plot() point names ?

2009-10-13 Thread Daniel Malter
I think you are looking for this: x=rnorm(6,10,1) e=rnorm(6,0,1) y=x+e plot(y~x,xlim=c(min(x)-2,max(x)+2),ylim=c(min(y)-2,max(y)+2)) text(x,y,pos=1,labels=c(Prof,CEO,Janitor,Admin,Farmer,Fire Chief)) HTH, Daniel - cuncta stricte discussurus -

Re: [R] descriptive statistics qn

2009-10-20 Thread Daniel Malter
Type ?mean ?sd in the R prompt. For your specific goal, type mean(r[1:25]) in the prompt. Proceed analogously for sd Just download one of the very many beginner's manuals or introductory course materials that you get for free on the internet, and get Ricci's R-refcard. Daniel

Re: [R] How to clear colnames?

2009-10-27 Thread Daniel Malter
x=rnorm(100) y=rnorm(100) mydata=data.frame(x,y) names(mydata)=(I.am.x,I.am.y) head(mydata) names(mydata)=c(NULL,NULL) head(mydata) names(mydata) They technically don't exist if you null them. Daniel - cuncta stricte discussurus -

Re: [R] re gression with multiple dependent variables?

2009-10-27 Thread Daniel Malter
Hi, cbind the dependent variables such as in: x=rnorm(100) e1=rnorm(100) e2=rnorm(100) e3=rnorm(100) y1=2*x+e1 y2=-1*x+e2 y3=0.7*x+e3 reg=lm(cbind(y1,y2,y3)~x) summary(reg) Cheers, Daniel - cuncta stricte discussurus - -Ursprüngliche

Re: [R] prcomp - principal components in R

2009-11-09 Thread Daniel Malter
In the first PCA you ask how much variance of the EIGHT (!) variables is captured by the first, second,..., eigth principal component. In the second PCA you ask how much variance of the THREE (!) variables is captured by the first, second, and third principal component. Of course you need only

Re: [R] Percentage effects in logistic regression

2009-11-09 Thread Daniel Malter
Somebody might have done this, but in fact it's not difficult to compute the marginal effects yourself (which is the beauty of R). For a univariate logistic regression, I illustrate two ways to compute the marginal effects (one corresponds to the mfx, the other one to the margeff command in

Re: [R] Percentage effects in logistic regression

2009-11-09 Thread Daniel Malter
)) mean(probs-fitted(reg)) HTH, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: Roberto Patuelli [mailto:roberto.patue...@usi.ch] Gesendet: Monday, November 09, 2009 1:54 PM An: Daniel Malter; r-help@r-project.org Betreff

Re: [R] Percentage effects in logistic regression

2009-11-09 Thread Daniel Malter
far away from the 0.00126 change based on direct predictions of the regression model that assume a one-percent increase in x for each x. Daniel Daniel Malter wrote: Yes, it is the marginal effect. The marginal effect (dy/dx) is the slope of the gradient at x. It is thus NOT for a 1 unit

Re: [R] lm and levels

2009-11-10 Thread Daniel Malter
Hi, your problem is that you run a regression on three observations with independent variables. This is obviously nonsense as two independent variables plus intercept MUST perfectly explain all variable. This you can see from the fact that the r-squared in the regression is 1, and that the

Re: [R] how to use # in a rd doc in url address

2009-11-11 Thread Daniel Malter
x=\url{http://www..org/myfolder/#myanchor}; print(x,quote=F) Does this work for you? Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag

Re: [R] redundant factor levels after subsetting a dataset

2009-11-11 Thread Daniel Malter
[mailto:dwinsem...@comcast.net] Gesendet: Wednesday, November 11, 2009 9:21 PM An: Daniel Malter Cc: r-h...@stat.math.ethz.ch Betreff: Re: [R] redundant factor levels after subsetting a dataset On Nov 11, 2009, at 9:00 PM, Daniel Malter wrote: #I have a data frame with a numeric and a character

Re: [R] Regression using R

2010-04-15 Thread Daniel Malter
I think this requires you to just pick up a manual / introductory book on R/regression in R, of which there are many on the internet / in the bookstores, respectively. Every manual I have seen has at least examples for quadratics. And extensions to other functional forms are straightforward.

Re: [R] histogram breaks

2010-04-16 Thread Daniel Malter
?hist shows you the options - cuncta stricte discussurus - -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of casperyc Sent: Friday, April 16, 2010 3:56 PM To: r-help@r-project.org

Re: [R] plotting pca of samples in different colors

2010-04-18 Thread Daniel Malter
Amit, how to color or label your pca plot has been answered before. Look at this post: http://n4.nabble.com/PCA-analysis-td861508.html#a861509 As for your problem, it's hard to say what went wrong without having the data. You write, there is nothing plotted in the graph. Does that mean you get a

Re: [R] Help: coxph() in {survival} package

2010-04-19 Thread Daniel Malter
Hi Xin, to answer your question: say you have your regression reg = coxph(... Then you can assess the log likelihood by reg$loglik This vector contains typically two values, the null log likelihood of the restricted model that excludes the fixed effects and the log likelihood of the

Re: [R] how to select the first observation only?

2010-04-21 Thread Daniel Malter
Gallon, your question looks very homeworky. People on this list are not likely to help you unless you can demonstrate own effort (even if it failed), and the list is not for homework questions in case it is one. Where exactly are you stuck? Daniel - cuncta stricte

Re: [R] multiple paired t-tests without loops

2010-04-28 Thread Daniel Malter
Hi Matt, see the example below. It took me a while to figure it out. I suggest you carefully examine the example step by step. It computes t-values for dataset with 3 variables and 8 unique combinations of two binning variables. The code should extend easily to larger datasets. Also, it uses the

Re: [R] advice?

2010-05-03 Thread Daniel Malter
Hi, on the one hand, you write fairly large, on the other hand, you write should be readable by anything. The warnings indicate that you are plain out of memory at some point. Not too surprising, given that your dataset has about 45 rows and 720 columns. You may search the r-help files first

Re: [R] multiple correlation coefficient R

2010-05-04 Thread Daniel Malter
Hi, type ?cor and hit ENTER. More generally, since you seem to be a newbie to R, I would suggest that you pick-up one of the many manuals to R that are available online and that you make yourself familiar with the posting guide for this list. Best, Daniel - cuncta

Re: [R] Regressions with fixed-effect in R

2010-05-10 Thread Daniel Malter
There is the plm package for linear panel models. Further, since estimation of fixed effects models rests on the within-subject or -object variance, the R-squared of interest is typically the within R-squared, not the overall or between R-squared. Read up about it before you use it though.

Re: [R] Advice needed on awkward tables

2010-05-10 Thread Daniel Malter
Hi, even after rereading, I have little of a clue what it is exactly that you are trying to do. It'd help if you provided a more concise, step-by-step description and/or the smallest unambiguous example of the two tables AND of what should come out at the end. Also, unless for relatively trivial

Re: [R] Panel data with binary dependent variable

2010-05-11 Thread Daniel Malter
RE models are available in the lme4 and MASS packages in the glmer and glmmPQL functions, respectively. -- View this message in context: http://r.789695.n4.nabble.com/Panel-data-with-binary-dependent-variable-tp2156043p2184223.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Regressions with fixed-effect in R

2010-05-11 Thread Daniel Malter
if the plm function only puts out one r-squared, it should be the within r-squared, but I could be wrong. Stata, for example, gives you a within, a between, and an overall r-squared. Here is what they do. set.seed(1) x=rnorm(100) fe=rep(rnorm(10),each=10) id=rep(1:10,each=10) ti=rep(1:10,10)

Re: [R] function

2010-05-12 Thread Daniel Malter
There is too little information to answer your question definitively. However, an obvious reason is that you want to apply the function over columns of a data.frame, which is done with apply(), but you try to apply the function over elements of a list using lapply(). A list is not a data.frame

Re: [R] what the problem could be if i am suddenly unable to add abline to the scatter plot?

2010-05-12 Thread Daniel Malter
Xin, you plot the scatterplot wrongly. Note that the lm (your OLS regression) has a wiggle, whereas you plot command has a comma. The plot command also should have a wiggle so that you plot y against x and not x against y. See example below: x=rnorm(100);e=rnorm(100) y=2*x+e reg=lm(y~x)

Re: [R] what the problem could be if i am suddenly unable to add abline to the scatter plot?

2010-05-12 Thread Daniel Malter
Just a quick addendum: You actually plot the line. If it is not in the graph then just because it is outside the limits of the plotting region. But since it's the right line on the wrong plot, it does not matter anyway. You need to get the plot right first, which you do in the way I described

Re: [R] function

2010-05-12 Thread Daniel Malter
Fair enough, my mistake. However, I am quite fascinated how that focuses everybody else on picking on the intitial answer and diverts everybody away from anwering the actual question. All the more it points to the second paragraph of my reply, namely that all modular components of the function

Re: [R] Split data frame by conditional and column at the same time

2010-05-13 Thread Daniel Malter
Does anything speak against selecting only x where x$B20 and then splitting it by x$C? split(x[!x$B20,],x$C) HTH, Daniel -- View this message in context: http://r.789695.n4.nabble.com/Split-data-frame-by-conditional-and-column-at-the-same-time-tp2197908p2216072.html Sent from the R help

Re: [R] More complex historgram

2010-05-13 Thread Daniel Malter
Are you asking us to do your homework? This is not a homework list. For the t-test look in any introductory R manual. For the histograms, look in the lattice library. HTH Daniel -- View this message in context: http://r.789695.n4.nabble.com/More-complex-historgram-tp2197823p2216076.html Sent

Re: [R] How to draw a graphic using data with coordinates and production rate?

2010-05-13 Thread Daniel Malter
Hi, assuming your production figures are in a square matrix, where points with no production take zero and points with production take the production figure, you could use image() This is the most basic approach I would think. Daniel -- View this message in context:

Re: [R] How to draw a graphic using data with coordinates and production rate?

2010-05-14 Thread Daniel Malter
Oh, if plot does the thing, then you just want to specify the color argument accordingly, where the color argument is given by your production figure. x=seq(1:100) y=seq(1:100) x.coord=sample(x,100) y.coord=sample(y,100) production=sample(1:100, 100) plot(y.coord~x.coord) #now lets say we

Re: [R] Generating all possible models from full model

2010-05-19 Thread Daniel Malter
Hi, one approach is document below. The function should work with any regression function that follows the syntax of lm (others will need adjustments). Note that you would have to create the interactions terms by hand (which is no big deal if there are just few). Note also that this approach can

Re: [R] random effects correlation in lmer

2009-11-24 Thread Daniel Malter
It implies that the random intercept is perfectly collinear with the random slope, as you suggested. I attach an example. The data generating process of y1 has a random intercept, but no random slope. When you fit a model with random intercept and random slope, the correlation between the two

Re: [R] random effects correlation in lmer

2009-11-24 Thread Daniel Malter
PM, Daniel Malter dan...@umd.edu wrote: It implies that the random intercept is perfectly collinear with the random slope, as you suggested. I attach an example. The data generating process of y1 has a random intercept, but no random slope. When you fit a model with random intercept and random

Re: [R] help with repeated values

2009-12-06 Thread Daniel Malter
college=c(Columbia,Columbia,Harvard,Harvard,NYU) unique(college) table(college) unique(college)[table(college)1] HTH Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org

Re: [R] random effects in mixed model not that 'random'

2009-12-13 Thread Daniel Malter
Hi, you are unlikely to (or lucky if you) get a response to your question from the list. This is a question that you should ask your local statistician with knowledge in stats and, optimally, your area of inquiry. The list is (mostly) concerned with solving R rather than statistical problems.

Re: [R] Supressing Scientific Notation

2009-12-14 Thread Daniel Malter
Example: x=rnorm(1000) terc.cut.x=cut(x,breaks=quantile(x,probs=c(0,1/3,2/3,1)),labels=c(L,M,H ),include.lowest=T) HTH, Daniel - cuncta stricte discussurus - -Original Message- From: r-help-boun...@r-project.org

Re: [R] Random Number Generation in a Loop

2009-12-16 Thread Daniel Malter
Hi, does this do what you want to do? I take the first six lines of the data you provided. Note that letters corresponds to your Name, and number corresponds to your Numbers variable. letters=rep(c(A,B,C),2) letters number=c(25,3,13,5,7,0) number letters2=rep(letters,number) letters2

Re: [R] Testing equality of regression model on multiple groups

2009-12-18 Thread Daniel Malter
Hi, your question is unclear. It is not clear whether you want to compare a.) whether two subsets of data have the same coefficients for an identical model or b.) whether a couple of coefficients are different once you include additional regressors. The reason for this confusion is that your

Re: [R] Signif. codes

2009-12-21 Thread Daniel Malter
No, it does not mean that the numbers have zero chance of being wrong. The extent to which the estimate can be wrong (which is a very bad and imprecise expression) is indicated by the standard error. The p-value close to zero implies that the intercept of the underlying population from which your

Re: [R] how can generate h(u)=min{a,log(u)} for 0u1 in R ?

2009-12-21 Thread Daniel Malter
Hi, see the example below. There must be a way to do this with apply or tapply, but it always returned an error incorrect number of dimensions. At least the code below works n=100 a=rnorm(n) u=runif(n) f=function(x){min(x[,1],log(x[,2]))} x=data.frame(a,u) apply(x,1,f) #does not work #this

Re: [R] how can generate h(u)=min{a,log(u)} for 0u1 in R ?

2009-12-22 Thread Daniel Malter
, December 21, 2009 3:33 PM To: Daniel Malter Subject: RE: [R] how can generate h(u)=min{a,log(u)} for 0u1 in R ? Hello Dear thank you for your answer, but I need to generate a sample from the function h(u) not compute the h(u). best khazaei Hi, see the example below. There must be a way to do

Re: [R] how can generate h(u)=min{a,log(u)} for 0u1 in R ?

2009-12-22 Thread Daniel Malter
replacement with the sample function. Daniel - cuncta stricte discussurus - -Original Message- From: khaz...@ceremade.dauphine.fr [mailto:khaz...@ceremade.dauphine.fr] Sent: Tuesday, December 22, 2009 7:15 AM To: Daniel Malter Subject

Re: [R] use of lm() and poly()

2009-12-22 Thread Daniel Malter
Hi, if I see it correctly, the nls you run is a linear model. It will probably give you the same (or virtually identical) result as lm(dP~U0+I(U0^2)+I(U0^3)+I(U0^4)). Your lm model, by contrast, creates orthogonal polynomials such that all orders of the polynomials are uncorrelated with the

Re: [R] aggregate binary response data

2009-12-25 Thread Daniel Malter
?tapply - cuncta stricte discussurus - -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Graham Leask Sent: Thursday, December 24, 2009 7:57 AM To: r-help@r-project.org Subject: [R]

Re: [R] Scaling error

2009-12-27 Thread Daniel Malter
If out is what you want to achieve, why don't you multiply sca (called m below) with the transpose of x and then transpose the resulting matrix? x=c(1,2,3,4,5,6,7,8,9) dim(x)=c(3,3) x=t(x) x m=c(2.5,1.7,3.6) x*m #returns what you don't want t(t(x)*m) #returns what you want HTH Daniel

[R] apply loop - using/providing a data frame to loop over

2009-12-28 Thread Daniel Malter
Hi, I want to extract individual names from a single string that contains all names. My problem is not the extraction itself, but the looping over the extraction start and end points, which I try to realize with apply. #Say, I have a string with names. authors=c(Schleyer T, Spallek H, Butler BS,

Re: [R] apply loop - using/providing a data frame to loop over

2009-12-28 Thread Daniel Malter
H Butler BSubramanian S [5] Weiss D Poythress M Rattanathikun P Mueller G You might need to adjust the regular expression slightly depending on what the general case is. See http://gsubfn.googlecode.com for more. On Mon, Dec 28, 2009 at 7:46 AM, Daniel Malter dmal

Re: [R] A better way to Rank Data that considers ties

2010-01-08 Thread Daniel Malter
Type ?rank in the prompt and look at the ties.method argument. Best, Daniel - cuncta stricte discussurus - -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of MRKidd Sent: Friday,

Re: [R] Very OT: World Cup Statistics

2010-06-07 Thread Daniel Malter
these websites seem to have the data. though I have not checked for completeness. the rsssf in particular is seems to be concerned with collecting and archiving these kinds of football data: http://www.rsssf.com/tablesw/worldcup.html http://wapedia.mobi/en/1930_FIFA_World_Cup_Group_1 hope that

Re: [R] summary stats on continuous data

2010-06-15 Thread Daniel Malter
Hi, you should be able to do most of your summaries using tapply() or aggregate(). for your example, tapply(d$Acc,list(d$Sample),table) Here tapply takes Acc, splits it by Sample, and then tables Acc (which returns how many 0s/1s were observed in variable Acc for each stratum of Sample).

Re: [R] Calculation of r squared from a linear regression

2010-06-15 Thread Daniel Malter
Hi, as pointed out previously, the problem is in using the canned routine (lm) without including an intercept term. Here is a working, generic example with commented code. #Simulate data x=rnorm(100) e=rnorm(100) y=x+e #Create X matrix with intercept X=cbind(1,x) #Projection matrix

Re: [R] summary stats on continuous data

2010-06-15 Thread Daniel Malter
You can define a function that does just that: sum the 1s in Acc and divide by the length of Acc. Then use tapply to apply the function for each subject. f=function(x){sum(as.numeric(as.character(x)))/length(x)} tapply(d$Acc,list(d$S),f) HTH, Daniel -- View this message in context:

[R] Spatial: number of independent components?

2010-06-20 Thread Daniel Malter
Hi all, I am sorry if this is a very basic quesion, but I have no experience with analyzing spatial data and could not find the right function/package quickly. Any hints would be much appreciated. I have a matrix of spatial point patterns like the one below and want to find the number of

Re: [R] Spatial: number of independent components?

2010-06-20 Thread Daniel Malter
Hi, thanks much. This works in principle. The corrected code is below: a - nb2mat(cell2nb(nrow(x),ncol(x),torus=T), style=B) g - delete.vertices(graph.adjacency(a), which(x!=1)-1) plot(g) clusters(g) the $no argument of the clusters(g) function is the sought after number. However, the function

Re: [R] Spatial: number of independent components?

2010-06-21 Thread Daniel Malter
as.spam.listw is an unknown function. Is it in a different package? Daniel other attached packages: [1] spdep_0.5-11coda_0.13-5 deldir_0.0-12 maptools_0.7-34 foreign_0.8-38 nlme_3.1-96 MASS_7.3-3 [8] Matrix_0.999375-31 lattice_0.17-26

Re: [R] Spatial: number of independent components?

2010-06-21 Thread Daniel Malter
I was missing the spam library. I did some testing with m x m matrices (see below). Computing 'a' is the villain. The computation time for 'a' is exponential in m. For a 100 by 100 matrix, the predicted time is about 20 seconds. Thus, 100,000 runs, would take about 23 days. library(igraph)

Re: [R] rbind with different columns

2010-06-21 Thread Daniel Malter
Works wonderfully. I am very happy that I eventually found this post :) Daniel. -- View this message in context: http://r.789695.n4.nabble.com/rbind-with-different-columns-tp907370p2263588.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] help in pael data analysis

2010-06-22 Thread Daniel Malter
Hi, the way it is asked you are not likely to receive an answer to your question. The reasons are: 1. Your question is way to unspecific. What kind of panel data analysis? How should we know? A package for linear panel data models and packages for random (mixed) effects models are implemented

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-25 Thread Daniel Malter
Atte, I would not wonder if you got lost and confused by the certainly interesting methodological discussion that has been going on in this thread. Since the helpers do not seem to converge/agree, I propose to you to use a different nonparametric approach: The bootstrap. The important thing

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-26 Thread Daniel Malter
Atte, note the similarity between what Greg described and a bootstrap. The difference to a true bootstrap is that in Greg's version you subsample the population (or in other instances the data). This is known as subsampling bootstrap and discussed in Politis, Romano, and Wolf (1999). HTH, Daniel

Re: [R] sampling one random frame from each unique trial?

2010-06-27 Thread Daniel Malter
Hi, take the following example and proceed accordingly. Name=c(Miller,Miller,Miller,Miller,Smith,Smith,Smith,Smith) X=rnorm(8) Year=rep(2000:2003,2) d=data.frame(Name,X,Year) #Row indices rows=1:dim(d)[1] #Which Name occupies which rows? #Name would be your file

Re: [R] Method for reduction of independent variables

2010-01-13 Thread Daniel Malter
Hi, please read the posting guide. You are not likely to get an extensive answer to your question from this list. Your question is a please solve/explain my statistical problem for me question. There are two things problematic with that. First, statistical, and second please solve for me. First,

Re: [R] object 'xxx' not found

2010-02-08 Thread Daniel Malter
The for loop tries to write into an object that does not yet exist. Do month.observed=NULL prior to the loop. HTH, Daniel - cuncta stricte discussurus - -Original Message- From: r-help-boun...@r-project.org

Re: [R] Problem with retreaving numeric data

2010-02-11 Thread Daniel Malter
My guess is that you cannot keep it numeric, but that you have to convert it to a string (the gurus may know better). x=001 x x=001 x Daniel - cuncta stricte discussurus - -Original Message- From: r-help-boun...@r-project.org

Re: [R] Question about rank() function

2010-02-11 Thread Daniel Malter
To follow up on Moshe's post, do rank(fmodel) rank(round(fmodel,4)) rank(fmodel)==rank(round(fmodel,4)) If the two are not identical, you have the explanation Moshe suggested, just that this approach is somewhat more comprehensive as it works on the entire fmodel vector. See the example below:

Re: [R] for loop function output

2010-02-11 Thread Daniel Malter
Hi, sorry, but I cannot figure out where the five values come from. However, generally you can define an n x 5 matrix (let's call it MATRIX), where n is the number of simulations and 5 is the assumed number of values that each round of the simulation returns. Then assign the five values to the

Re: [R] lm function in R

2010-02-13 Thread Daniel Malter
It seems to me that your question is more about the econometrics than about R. Any introductory econometric textbook or compendium on econometrics will cover this as it is a basic. See, for example, Greene 2006 or Wooldridge 2002. Say X is your data matrix, that contains columns for each of the

Re: [R] Survival analysis

2010-02-17 Thread Daniel Malter
There a numerous issues, some of which David has pointed out. I will add some and address some: 1. As far as I understand, you look at only one population. For a survival model, you would need an indicator when the species was extinguished (rather than a probability). However, with only one

Re: [R] Survival analysis

2010-02-17 Thread Daniel Malter
This implies that you have indeed a time series. You cannot run a survival model on a single unit of obvservation (i.e., one population) unless you can do the things (or similar things) that David suggested to create a larger dataset by disaggregating information. However, your initial approach

Re: [R] Solve equation using R

2010-02-17 Thread Daniel Malter
Exact to the degree that real numbers can be exactly expressed. Look into ?uniroot You want to specify the function in a one-sided way, i.e., x/(1-exp(-x))-2.2 HTH, Daniel - cuncta stricte discussurus - -Original Message- From:

Re: [R] inverse lexicographical ordering

2010-02-19 Thread Daniel Malter
Hi, see the code below. Next time, please provide self-contained code to generate the matrix (read the posting guide) so that we can just copy-paste it into R to get the matrix. x=rep(c(0,1),4) y=rep(c(0,0,1,1),2) z=rep(c(0,1),each=4) m=cbind(z,y,x) w=rowSums(m) m=cbind(m,w) m

[R] Siegel-Tukey test for equal variability (code)

2010-02-22 Thread Daniel Malter
Hi, I recently ran into the problem that I needed a Siegel-Tukey test for equal variability based on ranks. Maybe there is a package that has it implemented, but I could not find it. So I programmed an R function to do it. The Siegel-Tukey test requires to recode the ranks so that they express

[R] Survival model (time to event data)

2007-09-15 Thread Daniel Malter
High all, I would appreciate input about how the following survival model can be modeled in R and how competing risk models can generally be modeled. Also I would appreciate hints about resources that you are aware of that explain the use of survival models in R in greater detail. The data

Re: [R] Who uses R?

2007-09-25 Thread Daniel Malter
Hi, although this is a guess, I would dare to say that it is probably used in at least some schools/departments of any research university. Yet, universities/schools often have a plethora of statistical softwares available (in our school, for instance, SAS, Stata, SPSS, S-Plus) so it is not THE

[R] Drop / Reshape

2007-10-05 Thread Daniel Malter
Hi all, I have to reshape a dataset with many variables. Not all variables should be included in the new dataset. Is it possible to NOT specify the drop-vector of the reshape function explicitly? Instead I would like to drop all variables that have not been used in one of the other arguments.

[R] coxph | anova results

2007-10-18 Thread Daniel Malter
Hi, I ran a coxph model and in the summary the independent variables are reported highly significant. However, if I run anova() on that model, some of the variables are reported to explain basically no deviance and other variables which are reported insignificant in the model summary are

[R] suppress y-axis in a dotplot (lattice)

2007-11-13 Thread Daniel Malter
Hi, I want to illustrate when individuals had an event over time. I am using dotplot from the lattice library. The plot itself works well, but as I have many individuals, the labels on the y-axis for these individuals overlap. So the y-axis is unreadable. Therefore, I want to suppress the labels

[R] LMER

2008-02-14 Thread Daniel Malter
Hi, I run the following models: 1a. lmer(Y~X+(1|Subject),family=binomial(link=logit)) and 1b. lmer(Y~X+(1|Subject),family=binomial(link=logit),method=PQL) Why does 1b produce results different from 1a? The reason why I am asking is that the help states that PQL is the default of GLMMs and 2.

Re: [R] LMER

2008-02-15 Thread Daniel Malter
stricte discussurus - -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Douglas Bates Gesendet: Friday, February 15, 2008 7:29 AM An: Daniel Malter Cc: [EMAIL PROTECTED] Betreff: Re: [R] LMER Could you send us the output

Re: [R] clarification about glm

2008-02-23 Thread Daniel Malter
Hi Sigalit, yes, you can see this from the fact that the table says unit1 meaning that it compares 1 to 0 and not vice versa. Everytime you regress on dummies the label will have added this to the original variable name. Say you have gender male and female. Then gendermale in the label of your

[R] OLS standard errors

2008-02-25 Thread Daniel Malter
Hi, the standard errors of the coefficients in two regressions that I computed by hand and using lm() differ by about 1%. Can somebody help me to identify the source of this difference? The coefficient estimates are the same, but the standard errors differ. Simulate data

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Daniel Malter
Does the code below solve your problem? If you have NAs in the same rows, you have to use c or p as use= parameters. Otherwise you get the error you described. a=c(1,2,3,4,NA,6) b=c(2,4,3,5,NA,7) which(is.na(a))==which(is.na(b)) cor(a,b) Error cor(a,b,use=all.obs) Error

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Daniel Malter
Sorry, I overlooked the = integer(0) result to which(is.na(x1))==which(is.na(x2)). So that's not it. Cheers. - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: Daniel Malter [mailto:[EMAIL PROTECTED] Gesendet: Wednesday

Re: [R] p-value in Spearman rank order

2008-02-28 Thread Daniel Malter
Has your question been answered yet? x=c(1,2,4,3,6,8) y=c(3,2,5,7,4,6) cor.test(x,y,method=spearman) And that's how you extract the p-value: cor.test(x,y,method=s)$p.value Cheers, Daniel -- Abstrakthelfer helfen wenig --

Re: [R] I need to buy a book in R

2008-03-03 Thread Daniel Malter
Hi, I would first look into the many manuals that you can get in the Manuals section of the cran-project page. Click the link contributed documentations and explore from there. There are also quite a few websites that give more insight into using R which you may google. If you have a better idea

Re: [R] transforming column of a dataframe by var- and median-functions

2008-03-09 Thread Daniel Malter
I think tapply does the job you want: tapply(C,B,mean,na.rm=TRUE) tapply(C,B,var,na.rm=TRUE) Cheers, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von

  1   2   3   4   5   >