Generally speaking, statistical questions are O/T here, but sometimes they
intersect with on-topic R programming issues and do get responses. So if
you do not get a response here, try a statistics forum, like
stats.stackexchange.com .
Cheers,
Bert
Bert Gunter
"The trouble with having an open
Hi everyone,
I am doing panel data analysis using the 'plm' package. However, I have
noticed that the plm() function reports a different value of R-squared from
the R-squared of the lm() function with time-demeaned data. To be clear, I
have tried to compute the within model both manually (run an O
Hi,
You may also try:
set.seed(425)
##your code
tmp <- data.frame(
#
tmp1 <- tmp
str(tmp1)
#'data.frame': 1000 obs. of 3 variables:
# $ X1: Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
# $ X2: Factor w/ 127 levels "1","10","100",..: 1 1 1 1 1 1 1 1 2 2 ...
# $ X3: Factor w/
Jennifer:
a) Don't post in HTML... read the Posting Guide.
b) Don't make data frames by first making matrices... you rarely create
what you think you are creating. In your case, your code creates a bunch
of factor columns... use the str() function to verify that your data are
sensible before
On 04/26/2014 12:42 PM, Jennifer Sabatier wrote:
So, I know that's a confusing Subject header.
Here's similar data:
tmp<- data.frame(matrix(
c(rbinom(1000, 1, .03),
array(1:127, c(1000,1)),
array(format(seq(ISOdate(
So, I know that's a confusing Subject header.
Here's similar data:
tmp <- data.frame(matrix(
c(rbinom(1000, 1, .03),
array(1:127, c(1000,1)),
array(format(seq(ISOdate(1990,1,1), by='month',
length=56), format='%d.%m.%Y')
“Within is working or not in loop”
for(j in 1:10){
card_bal <- as.numeric(segment_cuts$card_bal[[j]])
insurance_bal <- as.numeric(segment_cuts$insurance_bal[[j]])
data$segment_rank <-
within(data,segment_rank[ data$Total_Balance >= total_bal &
data$Insurance_Balance >= insurance_bal] <-
e:
Esteemed UseRs and DevelopeRs,
Apologies if this question belongs else where, but it does concern R's
package installation/maintenance.
How does one start R within Emacs/ESS with root privileges?
I tried without success:
M-x sudo R
Why i'm motivated to do so:
It seems logical
appropriate
forum at: ess-h...@stat.math.ethz.ch
Karl
On 2011-09-07 11:02, Paul Hiemstra wrote:
On 09/07/2011 08:54 AM, Karl Brand wrote:
Esteemed UseRs and DevelopeRs,
Apologies if this question belongs else where, but it does concern R's
package installation/maintenance.
How does
.ch
Karl
On 2011-09-07 11:02, Paul Hiemstra wrote:
On 09/07/2011 08:54 AM, Karl Brand wrote:
Esteemed UseRs and DevelopeRs,
Apologies if this question belongs else where, but it does concern R's
package installation/maintenance.
How does one start R within Emacs/ESS with root privileg
On 09/07/2011 08:54 AM, Karl Brand wrote:
> Esteemed UseRs and DevelopeRs,
>
> Apologies if this question belongs else where, but it does concern R's
> package installation/maintenance.
>
> How does one start R within Emacs/ESS with root privileges?
>
> I tried with
Esteemed UseRs and DevelopeRs,
Apologies if this question belongs else where, but it does concern R's
package installation/maintenance.
How does one start R within Emacs/ESS with root privileges?
I tried without success:
> M-x sudo R
Why i'm motivated to do so:
It seems logi
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Coghlan, Avril
> Sent: 25 August 2011 16:02
> To: r-help@r-project.org
> Cc: Coghlan, Avril
> Subject: [R] within-groups variance and between-groups varian
#Here is I think an easier way of coding all the components you need.
#The within-group variances, you get with this function:
apply(iris[,1:4],2,function(x) tapply(x,iris$Species,var))
#You can get what you computed by taking the column means.
apply(apply(iris[,1:4],2,function(x) tapply(x,iri
Hello,
I have been looking for functions for calculating the within-groups
variance and between-groups variance, for the case where you have
several numerical variables describing samples from a number of groups.
I didn't find such functions in R, so wrote my own versions myself (see
below). I ca
On May 19, 2011, at 9:32 AM, Timothy Bates wrote:
Likewise it would help reduce confusion when
plot(~Source, data=Df) # works
# but
boxplot(~Source, data=Df)
# Error in boxplot.formula(~Source, data = Df) :
# 'formula' missing or incorrect
The formula isn’t missing or illformed, it’s that bo
On 19/05/2011 9:32 AM, Timothy Bates wrote:
The most interesting thing in this thread for me was "within()" - that is what
I want 99% of the time, but I had only ever heard of with()
A real boon! Thanks Bill V!
The help for within gives this example for with(), which seems unnecessary, as
glm
The most interesting thing in this thread for me was "within()" - that is what
I want 99% of the time, but I had only ever heard of with()
A real boon! Thanks Bill V!
The help for within gives this example for with(), which seems unnecessary, as
glm supports data=
with(anorexia, {
anorex.1
Try this:
> data$diff <- ave(as.numeric(data$date_obs), data$group, FUN=function(x)c(NA,
> diff(x)))
> data
group date_obs diff
1 IND1 1987-09-17 NA
2 IND1 1989-05-04 595
3 IND2 1997-04-30 NA
4 IND2 2008-11-03 4205
5 IND2 2009-05-08 186
6 IND3 1984-01-17 NA
7 IND4 1996-
Dear Natalie,
I am sure there are other ways, but one way you can do this is by
applying diff() to each group using tapply() or by(). Because those
return lists, if you want to add it back into your data frame, you can
wrap the whole call in unlist(). Here is an example:
dat <- structure(list(g
Hi Everyone,
I would like to do sequential subtractions within a group so that I know the
time between separate observations for a group of individuals.
My data:
data <- structure(list(group = c("IND1", "IND1", "IND2",
"IND2", "IND2", "IND3", "IND4", "IND5",
"IND6", "IND6"), date_obs = struc
Hi Greg,
When you are running R from a script, you want to divert the output
somewhere. Depending exactly how you run it, R may nicely push the
text output to a file, but you should specify where you want the
graphics to go yourself. For example:
## use the PDF graphics device
pdf(file = "boxpl
I will confess to being very wet behind the ears when it comes to scripting, so
with that as a backdrop, here is my question. I can create a box and whisker
plot without any problem from the command line, but incorporating that process
into a bash script has proved problematic. Below is the port
t;Problem calling R
from within perl script on Windows
..", from there I picked up the system command to call R from within
PERL. Thanks barrry !
I am hoping that somebody from that thread could help me.. !
Thanks
Chakri
--
View this message in context:
http://r.789695.n4.nabble.com/Exec
you should save your 3 variables into a new *dataframe*
d<-mydata[,c("iq","education","achievement")]
and then the command would be
by(d,d$sex,function(df) cor.test(df$educ,df$achiev))
but you could also just use
by(mydata,mydata$sex,function(df) cor.test(df$educ,df$achiev))
david freedman
I'm trying to obtain within-group correlations on a subset of variables. I
first selected my variables using the following command:
mydata$x<-mydata[c("iq","education","achievement")]
I'd like to look at correlations among those variables separately for men
and women. My gender variable in mydata
On 9/2/2009 1:31 PM, Peter Ehlers wrote:
Heinrich,
You could create your own function mywithin()
by inserting a couple of rev()'s in within.data.frame().
In within.data.frame(), replace the two commented lines
with those immediately following:
mywithin <-
function (data, expr, ...)
{
pare
On Wed, Sep 2, 2009 at 9:27 AM, RINNER
Heinrich wrote:
> Dear R community,
>
> I am using function 'within' in R.2.9.1 to add variables to an existing
> data.frame. This works wonderful, except for one minor point: The new
> variables are added to the data in reverse order.
>
> For example:
> x <
Heinrich,
You could create your own function mywithin()
by inserting a couple of rev()'s in within.data.frame().
In within.data.frame(), replace the two commented lines
with those immediately following:
mywithin <-
function (data, expr, ...)
{
parent <- parent.frame()
#e <- evalq(enviro
On 9/2/2009 9:27 AM, RINNER Heinrich wrote:
Dear R community,
I am using function 'within' in R.2.9.1 to add variables to an existing
data.frame. This works wonderful, except for one minor point: The new variables
are added to the data in reverse order.
For example:
x <- data.frame(a = 1:3, b
Try this:
transform(transform(x, c = a ^ 2, d = b ^2), e = c + d)
On Wed, Sep 2, 2009 at 10:27 AM, RINNER Heinrich <
heinrich.rin...@tirol.gv.at> wrote:
> Dear R community,
>
> I am using function 'within' in R.2.9.1 to add variables to an existing
> data.frame. This works wonderful, except for
Dear R community,
I am using function 'within' in R.2.9.1 to add variables to an existing
data.frame. This works wonderful, except for one minor point: The new variables
are added to the data in reverse order.
For example:
x <- data.frame(a = 1:3, b = 4:6)
y <- within(x, {
c = a^2
d =
Let's say that location defined a group, and observations may
be more similar in a group. You could account for this similarity
with the following model.
model1 <-lme(X~CorP,random=~1|location,data=mydata,method="ML")
This fits a random intercept model grouped by location. This would
assume that
Hi,
I am quite new to R and trying to analyze the following data. I have 28
controls and 25 patients. I measured X values of 4 different locations
(A,B,C,D) in the brain image of each subject. And X ranges from 0 to 1.
I think "control or patient" is a between subject factor and location is
a wi
tsunhin wong wrote:
Dear R users,
I have copied for following table from an article on "Using confidence
intervals in within-subject designs":
Subject 1sec 2sec 5sec
1 10 13 13 12.00
2 6 8 8 7.33
3 11 14 14 13.00
4 22 23 25 23.33
5 16 18 20 18.00
6 15 17 17 16.33
7 1 1 4 2.00
8 12 15 17 14.67
9
str() is again your friend.
> str(asummary)
List of 2
$ Error: subject :List of 1
..$ :Classes ‘anova’ and 'data.frame':1 obs. of 5 variables:
.. ..$ Df : num 9
.. ..$ Sum Sq : num 943
.. ..$ Mean Sq: num 105
.. ..$ F value: num NA
.. ..$ Pr(>F) : num NA
..- at
As another follow-up related to aov, I want to extract values
(Residual interaction mean square & interaction DF) from the results:
asummary<-summary(aov.recall)
The results are in a list() format with 3 lists, and contents within
each list are without "names".
I am not able to do something like i
On Mon, Jun 1, 2009 at 7:50 PM, tsunhin wong wrote:
> But I have some follow-up questions:
> 1. In aov, why IVs (subject & condition) cannot be in number format?
Put simply, because that's the only way to obtain the values you
observe in the paper you're reading. :Op Factorizing tells the ANOVA
Although you factorized subject and condition when you created them as
separate objects, this didn't survive cbind() then as.data.frame(),
thus
> example<-data.frame(cbind(subject,condition,recall))
> str(example)
'data.frame': 30 obs. of 3 variables:
$ subject : int 1 2 3 4 5 6 7 8 9 10 ...
I have reformatted the data input in the following ways, and I get the
normal results:
>subject<-factor(c("s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s1","s2","s3","s4","s5","s6","s7","s8","s9","s10"))
>condition<-factor(c("c1","c1","c1","c
Dear R users,
I have copied for following table from an article on "Using confidence
intervals in within-subject designs":
Subject 1sec 2sec 5sec
1 10 13 13 12.00
2 6 8 8 7.33
3 11 14 14 13.00
4 22 23 25 23.33
5 16 18 20 18.00
6 15 17 17 16.33
7 1 1 4 2.00
8 12 15 17 14.67
9 9 12 12 11.00
10 8 9
Hi the list...
I am working on cluster analysis, more precisely on Calinski and
Harabasz criterion
( C(g)=Trace(between)/Trace(Within)*(n-g)/(g-1)) )
Is there a package for calculating within and between matrix?
Morever, when we are using matrix with missing value, how do they
handle it? On a mo
Dear R Users,
I am having trouble using R from within Excel. I've installed R(D) Com
Client and then try to open up the first sample sheet.
As Excel executes auto_open, it stops at function "ExcelVersionMajor"
and complaines that a certain type library is missing:
missing rcom 1.0 type libra
43 matches
Mail list logo