[R] help with statistics in R - how to measure the effect of users in groups
Petr PIKAL
petr.pikal at precheza.cz
Mon Oct 10 12:17:08 CEST 2011
>
> Hi Petr,
>
> It's not an equation. It's my mistake; the * are meant to be field
> separators for the example data. I should have just use blank spaces as
> follows:
>
> users Group1 Group2 Group3
> u1 10 5 N/A
> u2 6 N/A 4
> u3 5 2 3
>
>
> Regards
> Gawesh
OK. You shall transform your data to long format to use lm
test <- read.table("clipboard", header=T, na.strings="N/A")
test.m<-melt(test)
Using users as id variables
fit<-lm(value~variable, data=test.m)
summary(fit)
Call:
lm(formula = value ~ variable, data = test.m)
Residuals:
1 2 3 4 6 8 9
3.0 -1.0 -2.0 1.5 -1.5 0.5 -0.5
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7.000 1.258 5.563 0.00511 **
variableGroup2 -3.500 1.990 -1.759 0.15336
variableGroup3 -3.500 1.990 -1.759 0.15336
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.179 on 4 degrees of freedom
(2 observations deleted due to missingness)
Multiple R-squared: 0.525, Adjusted R-squared: 0.2875
F-statistic: 2.211 on 2 and 4 DF, p-value: 0.2256
No difference among groups, but I am not sure if this is the correct way
to evaluate.
library(ggplot2)
p<-ggplot(test.m, aes(x=variable, y=value, colour=users))
p+geom_point()
There is some sign that user3 has lowest value in each group. However for
including users to fit there is not enough data.
Regards
Petr
>
>
> On Mon, Oct 10, 2011 at 9:32 AM, Petr PIKAL <petr.pikal at precheza.cz>
wrote:
>
> > Hi
> >
> > I do not understand much about your equations. I think you shall look
to
> > Practical Regression and Anova Using R from J.Faraway.
> >
> > Having data frame DF with columns - users, groups, results you could
do
> >
> > fit <- lm(results~groups, data = DF)
> >
> > Regards
> > Petr
> >
> >
> >
> >
> > >
> > > Hi,
> > >
> > > I'm a newbie to R. My knowledge of statistics is mostly self-taught.
My
> > > problem is how to measure the effect of users in groups. I can
calculate
> > a
> > > particular attribute for a user in a group. But my hypothesis is
that
> > the
> > > user's attribute is not independent of each other and that the
user's
> > > attribute depends on the group ie that user's behaviour change based
on
> > the
> > > group.
> > >
> > > Let me give an example:
> > >
> > > users*Group 1*Group 2*Group 3
> > > u1*10*5*n/a
> > > u2*6*n/a*4
> > > u3*5*2*3
> > >
> > > For example, I want to be able to prove that u1 behaviour is
different
> > in
> > > group 1 than other groups and the particular thing about Group 1 is
that
> > > users in Group 1 tend to have a higher value of the attribute under
> > > measurement.
> > >
> > >
> > > Hence, can use R to test my hypothesis. I'm willing to learn; so if
this
> > is
> > > very simple, just point me in the direction of any online resources
> > about
> > > it. At the moment, I don't even how to define these class of
problems?
> > That
> > > will be a start.
> > >
> > > Regards
> > > Gawesh
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > R-help at r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list