Quantcast

negatively skewed data; reflecting

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

negatively skewed data; reflecting

z.dalton
Hi,

This problem may be very easy, but I can't think of how to do it.  I have constructed histograms of various variables in my dataset.  Some of them are negatively skewed, and hence need data transformations applied.  I know that you first need to reflect the negatively skewed data and then apply another transformation such as log, square root etc to bring it towards normailty. How is it that I reflect data in R?  I'm sorry if this seems a very simple task, I think it involves going back to Maths GCSE and relearning reflection, rotation, translation etc!  I have searched the internet, but cannot come up with anything useful on how to reflect data.

> hist(Lsoc)  #how do I reflect Lsoc in R?

I am grateful for any help regarding this matter, it is just a very small part of my analysis and doesn't seem worth agonising hours over.  I will probably kick myself when someone tells me the answer!

Thank you very much,

Zoe

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: negatively skewed data; reflecting

Jon Minton
I'm new to R myself, but am wondering whether the t() (transpose) function
would work?

> hist(t(Lsoc))

Jon

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
[hidden email]
Sent: 23 August 2006 13:08
To: [hidden email]
Subject: [R] negatively skewed data; reflecting

Hi,

This problem may be very easy, but I can't think of how to do it.  I have
constructed histograms of various variables in my dataset.  Some of them are
negatively skewed, and hence need data transformations applied.  I know that
you first need to reflect the negatively skewed data and then apply another
transformation such as log, square root etc to bring it towards normailty.
How is it that I reflect data in R?  I'm sorry if this seems a very simple
task, I think it involves going back to Maths GCSE and relearning
reflection, rotation, translation etc!  I have searched the internet, but
cannot come up with anything useful on how to reflect data.

> hist(Lsoc)  #how do I reflect Lsoc in R?

I am grateful for any help regarding this matter, it is just a very small
part of my analysis and doesn't seem worth agonising hours over.  I will
probably kick myself when someone tells me the answer!

Thank you very much,

Zoe

______________________________________________
[hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: negatively skewed data; reflecting

Duncan Murdoch
In reply to this post by z.dalton
On 8/23/2006 8:08 AM, [hidden email] wrote:
> Hi,
>
> This problem may be very easy, but I can't think of how to do it.  I have constructed histograms of various variables in my dataset.  Some of them are negatively skewed, and hence need data transformations applied.  I know that you first need to reflect the negatively skewed data and then apply another transformation such as log, square root etc to bring it towards normailty. How is it that I reflect data in R?  I'm sorry if this seems a very simple task, I think it involves going back to Maths GCSE and relearning reflection, rotation, translation etc!  I have searched the internet, but cannot come up with anything useful on how to reflect data.
>
>> hist(Lsoc)  #how do I reflect Lsoc in R?

Reflected <- -Lsoc

will reflect about zero.

> I am grateful for any help regarding this matter, it is just a very small part of my analysis and doesn't seem worth agonising hours over.  I will probably kick myself when someone tells me the answer!

Please don't kick yourself :-)

Duncan Murdoch

>
> Thank you very much,
>
> Zoe
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: negatively skewed data; reflecting

Frank Harrell
In reply to this post by z.dalton
[hidden email] wrote:

> Hi,
>
> This problem may be very easy, but I can't think of how to do it.  I have constructed histograms of various variables in my dataset.  Some of them are negatively skewed, and hence need data transformations applied.  I know that you first need to reflect the negatively skewed data and then apply another transformation such as log, square root etc to bring it towards normailty. How is it that I reflect data in R?  I'm sorry if this seems a very simple task, I think it involves going back to Maths GCSE and relearning reflection, rotation, translation etc!  I have searched the internet, but cannot come up with anything useful on how to reflect data.
>
>> hist(Lsoc)  #how do I reflect Lsoc in R?
>
> I am grateful for any help regarding this matter, it is just a very small part of my analysis and doesn't seem worth agonising hours over.  I will probably kick myself when someone tells me the answer!
>
> Thank you very much,
>
> Zoe

To add further complication, if the transformation to normality is
empirically based, the true variance of resulting estimates will inherit
the variance from the empirical assessment.  For example, if you use a
histogram or empirical CDF to find the transformation, the imprecision
of the empirical CDF will add a good deal of true variance to the final
estimates so that they are no more precise than sample quantiles on the
original scale.  To put it another way, the sample median seems to be
inefficient (efficiency 2/pi) compared to the sample mean if normality
holds, but that relative efficiency rises if normality were "rigged".
--
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________
[hidden email] 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.
Frank Harrell
Department of Biostatistics, Vanderbilt University
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: negatively skewed data; reflecting

Eik Uni
In reply to this post by z.dalton
a simple reflection (on the y-axis) of x is -x, but you have to ensure  
that there are only nonnegative numbers if you want to use the log  
transformation. So you should reflect on a postive number z greater than  
abs(min(x)), if min(x)<0. This is done by z-x.
Why don't you simply shift your data by this amount z or use a  
box-cox-transformation at all?

Am Wed, 23 Aug 2006 14:08:08 +0200 schrieb <[hidden email]>:

> Hi,
>
> This problem may be very easy, but I can't think of how to do it.  I  
> have constructed histograms of various variables in my dataset.  Some of  
> them are negatively skewed, and hence need data transformations  
> applied.  I know that you first need to reflect the negatively skewed  
> data and then apply another transformation such as log, square root etc  
> to bring it towards normailty. How is it that I reflect data in R?  I'm  
> sorry if this seems a very simple task, I think it involves going back  
> to Maths GCSE and relearning reflection, rotation, translation etc!  I  
> have searched the internet, but cannot come up with anything useful on  
> how to reflect data.
>
>> hist(Lsoc)  #how do I reflect Lsoc in R?
>
> I am grateful for any help regarding this matter, it is just a very  
> small part of my analysis and doesn't seem worth agonising hours over.  
> I will probably kick myself when someone tells me the answer!
>
> Thank you very much,
>
> Zoe
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: negatively skewed data; reflecting

Michael Kubovy
In reply to this post by z.dalton
On Aug 23, 2006, at 8:08 AM, [hidden email] wrote:

> I have constructed histograms of various variables in my dataset.  
> Some of them are negatively skewed, and hence need data  
> transformations applied.  I know that you first need to reflect the  
> negatively skewed data and then apply another transformation such  
> as log, square root etc to bring it towards normailty. How is it  
> that I reflect data in R?
>
>> hist(Lsoc)  #how do I reflect Lsoc in R?

To reflect the vector Lsoc, assuming the numbers are positive, and  
keep them positive in order to take (e.g.) logs,
log(-Lsoc + max(Lsoc) + 1).

But if you do a Google search on 'ladder powers negative skew' you'll  
find another answer. The idea of the ladder of powers is due to J W  
Tukey.
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/

______________________________________________
[hidden email] 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.
Loading...