JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for GENSTAT Archives


GENSTAT Archives

GENSTAT Archives


GENSTAT@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

GENSTAT Home

GENSTAT Home

GENSTAT  November 2012

GENSTAT November 2012

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Regression with errors in both variables

From:

David Baird <[log in to unmask]>

Reply-To:

Open discussion list for the statistical system Genstat <[log in to unmask]>

Date:

Thu, 8 Nov 2012 10:11:43 +1300

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (122 lines)

Dear Brian,

The errors in variables analysis does just allow for one level of variation
in the analysis. If you mean the replicates you will have this situation.
However, the replicates do allow you to look at the level of variation
in X and Y to estimate the value of VRATIO. Note that averaging the 
observations also reduces the problem with the bias in the 
ordinary least squares estimator. Below is some code that simulates
your situation using made up data. Note how the mean OLS slope
is biased downwards, and that this is improved when you mean the
replicates for subjects (OLS_MSlope). The mean slopes of the error in 
variables regression is about the same whether meaned or not, so
there is no bias in this, but the standard deviation of the slopes is
slightly less for the meaned case, which is repeatable suggests taking
the means is a good thing. 

SCALAR NSim; 1000
VARIATE [NV=NSim] OLS_Slope,EIV_Slope,OLS_MSlope,EIV_MSlope

FOR [NTIMES=NSim;INDEX=i]
   FACTOR [LEVELS=10] Subject; !(4(1...10))
   CALC X = !(4(1...10))/10
   CALC XE = X + GRUNIFORM(40;0;1) "Add random variation"
   CALC YE = X + GRUNIFORM(40;0;1) "True slope is 1 and VRATIO is 1"
   MODEL YE "Ordinary LS estimate"
   FIT [PRINT=*] XE
   RKEEP EST=Est
   RLFUNC [PRINT=*;METHOD=errorsinvariables;VRATIO=1;PLOT=*] YE; XE;
SLOPE=Slp
   CALC (OLS_Slope,EIV_Slope)$[i] = Est$[2],Slp "Save estimates from all
points"
   TABULATE [CLASS=Subject] XE,YE; MEANS=TX,TY "Mean by subject"
   VTABLE TX,TY; XM,YM "Copy tables into variates"
   MODEL YM "Ordinary LS estimate on means"
   FIT [PRINT=*] XM
   RKEEP EST=Est
   RLFUNC [PRINT=*;METHOD=errorsinvariables;VRATIO=1;PLOT=*] YM; XM;
SLOPE=Slp
   CALC (OLS_MSlope,EIV_MSlope)$[i] = Est$[2],Slp "Save estimates from
means"
   PRINT [IP=*;SQ=Yes] i; DEC=0 "Track simulations"
ENDFOR

PRINT MEAN(OLS_Slope,EIV_Slope,OLS_MSlope,EIV_MSlope)
PRINT SD(OLS_Slope,EIV_Slope,OLS_MSlope,EIV_MSlope)

Which on a run on my PC gives:

MEAN(OLS_Slope)	 MEAN(EIV_Slope)	 MEAN(OLS_MSlope)
MEAN(EIV_MSlope)
0.5132	 		1.038	 		0.8477
1.034
 
SD(OLS_Slope)	 SD(EIV_Slope)	 SD(OLS_MSlope)	 SD(EIV_MSlope)
0.1202	 		0.3083	 		0.1896
0.2507

NB. A quick way of getting a spreadsheet of means and standard deviations
or variances per subject is to use the Spread | Calculate | Summary Stats
menu and put subjects as groups and chose the statistics for each variable
you want.
  
Regards, David. 
______________________________________________ 
Dr David Baird      Statistical Consultant and GenStat Developer 
VSN (NZ) Limited ([log in to unmask]) 
8 Mariposa Crescent, Aidanfield, Christchurch 8025, New Zealand
Ph +64 3 3350588 Cell +64 21 1160803

> From: GENSTAT-Request [mailto:[log in to unmask]] On Behalf Of Brian
> Glasberg
> Sent: 7 November 2012 2:50 a.m.
> To: [log in to unmask]
> Subject: Regression with errors in both variables
> 
> Dear List,
> 
> Regression with errors in both variable
> with repeated measures
> 
> I have a set of data from 51 subjects each of whom
> were tested in two conditions, Noise and Speech.
> There were four replicates in each condition giving
> 51 by 4 pairs of results
> 
> The data look like this:
> 
> subject  replicate   Noise   Speech
>    1       1         -7.8     -5.8
>    1       2         -7.2     -8.2
>    1       3         -6.5    -21.7
>    1       4        -13.8    -22.1
>    2       1         -2.5     -9.3
> .......
> 
> for all 51 subjects.
> 
> 
> I would like to carry out a regression with
> errors in both variables. My understanding
> is that this can be done on the mean values of
> each subjects' 4 replicates as long as the
> standard deviations of each mean value is
> taken into account.
> (Numerical Recipes in C 2nd ed).
> 
> Using Genstat 15's Linear Functional Relationship menu
> and selecting "Errors in variables" as the model
> I can get an overall fit to the 4 X 51 pairs of data
> where I don't know how to tell Genstat that there
> are four replicates.
> Or can just use the 51 mean values which ignores the
> variability across each of the four repeats.
> 
> Hope this makes sense!
> Any advice would be welcome.
> 
> Brian Glasberg
> Dept Experimental Psychology, Cambridge University, Downing Street
> Cambridge CB2 3EB, England
> Tel: 01223 333652

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

May 2024
April 2024
January 2024
December 2023
November 2023
October 2023
August 2023
June 2023
May 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
September 2020
July 2020
June 2020
April 2020
March 2020
February 2020
December 2019
November 2019
October 2019
September 2019
August 2019
June 2019
May 2019
April 2019
March 2019
February 2019
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
February 2017
January 2017
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998
1997
1996
1995


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager