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
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
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.
__
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
--
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:
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
-
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
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
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
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
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
.
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
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
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
-
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
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
-
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
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
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
))
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
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
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
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
[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
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.
?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
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
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
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
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
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
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
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.
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 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.
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)
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
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)
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
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
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
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
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:
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
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
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
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
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
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.
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
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
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
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
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
, 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
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
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
?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]
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
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,
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
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,
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
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).
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
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:
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
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
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
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)
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.
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
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
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
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
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,
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
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
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:
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
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
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
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
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:
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
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
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
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
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.
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
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
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.
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
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
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
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
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
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
--
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
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 - 100 of 457 matches
Mail list logo