Johanna von Bahr
2015-Oct-01 19:15 UTC
[R] Regressing the residuals on the country dummies
I?m trying to estimate a model regressing the residuals on the country dummies as follows; model.resC <- lm(model2$res ~ as.factor(Country)) summary(model.resC) As I call the model I get the following results regarding the residuals: "ALL 90 residuals are 0: no residual degrees of freedom!" What has gone wrong?
Hi: You'd have to provide a dput of "model2" and "Country" for anyone to give a definitive answer but my guess is that you have an orthogonal X matrix which is causing you to fit the model perfectly which causes the model residuals to be zero. Also, you didn't explain what you're doing but modelling residuals by using purely factors doesn't sound like something one would want to do ? I could be mistaken since I don't know the context but you should explain what exactly what your goal is and your reasoning for doing what you're doing. On Thu, Oct 1, 2015 at 3:15 PM, Johanna von Bahr <johanna.vonbahr at gmail.com> wrote:> I?m trying to estimate a model regressing the residuals on the country > dummies as follows; > model.resC <- lm(model2$res ~ as.factor(Country)) > summary(model.resC) > > As I call the model I get the following results regarding the residuals: > > "ALL 90 residuals are 0: no residual degrees of freedom!" > > What has gone wrong? > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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]]
Linus Holtermann
2015-Oct-02 19:31 UTC
[R] Regressing the residuals on the country dummies
Hi, You have panel data or cross-sectional data? In the case you use cross-sectional data and "countries" are your observations (no repeated measure of them) and you regress the country-dummies on your residuals of the forgone regression, then there are as many regressors as observations. Consequently, is it not possible to estimate such a model since there are no degrees of freedom left. Mit freundlichen Gr??en Linus Holtermann Hamburgisches WeltWirtschaftsInstitut gemeinn?tzige GmbH (HWWI) Heimhuder Stra?e 71 20148 Hamburg Tel +49-(0)40-340576-336 Fax+49-(0)40-340576-776 Internet: www.hwwi.org Email: holtermann at hwwi.org ? Amtsgericht Hamburg HRB 94303 Gesch?ftsf?hrer: Prof. Dr. Henning V?pel Prokura: Dipl. Kauffrau Alexis Malchin Umsatzsteuer-ID: DE 241849425 -----Urspr?ngliche Nachricht----- Von: R-help [mailto:r-help-bounces at r-project.org] Im Auftrag von Johanna von Bahr Gesendet: Donnerstag, 1. Oktober 2015 21:15 An: r-help at r-project.org Betreff: [R] Regressing the residuals on the country dummies I?m trying to estimate a model regressing the residuals on the country dummies as follows; model.resC <- lm(model2$res ~ as.factor(Country)) summary(model.resC) As I call the model I get the following results regarding the residuals: "ALL 90 residuals are 0: no residual degrees of freedom!" What has gone wrong? ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Dear All, I am wondering if someone knows an R equivalent of the following API call in python. "-----" import time import pandas as pd start_time = time.clock() timer =time.clock() import pkg_resources pkg_resources.require("pysimplesoap==1.05a") from pysimplesoap.client import SoapClient import os import numpy as np client = SoapClient(wsdl=" https://solardata.com/service.asmx?wsdl") result = client.GetCsvWeatherData8( userName='alex at solardata.com',password='passw at word1 ',licenseNumber='X1952c9wv', latitude=lati, longitude=loni, startDate='2013-02-10T00:00:00', endDate='2014-11-28T00:00:00', dataVersionId=8, spatialResolutionId='High1km', timeResolution='Minute', missingDataHandling='Blank', WindTemp=1, timeshift = 'No') weather ={} weather['csvWeather']result['GetCsvWeatherData8Result']['csvWeather'] Thanks, Alemu On Fri, Oct 2, 2015 at 12:31 PM, Linus Holtermann <holtermann at hwwi.org> wrote:> Hi, > > You have panel data or cross-sectional data? In the case you use > cross-sectional data and "countries" are your observations (no repeated > measure of them) and you regress the country-dummies on your residuals of > the forgone regression, then there are as many regressors as observations. > Consequently, is it not possible to estimate such a model since there are > no degrees of freedom left. > > Mit freundlichen Gr??en > > > Linus Holtermann > Hamburgisches WeltWirtschaftsInstitut gemeinn?tzige GmbH (HWWI) > Heimhuder Stra?e 71 > 20148 Hamburg > Tel +49-(0)40-340576-336 > Fax+49-(0)40-340576-776 > Internet: www.hwwi.org > Email: holtermann at hwwi.org > > Amtsgericht Hamburg HRB 94303 > Gesch?ftsf?hrer: Prof. Dr. Henning V?pel > Prokura: Dipl. Kauffrau Alexis Malchin > Umsatzsteuer-ID: DE 241849425 > > > -----Urspr?ngliche Nachricht----- > Von: R-help [mailto:r-help-bounces at r-project.org] Im Auftrag von Johanna > von Bahr > Gesendet: Donnerstag, 1. Oktober 2015 21:15 > An: r-help at r-project.org > Betreff: [R] Regressing the residuals on the country dummies > > I?m trying to estimate a model regressing the residuals on the country > dummies as follows; model.resC <- lm(model2$res ~ as.factor(Country)) > summary(model.resC) > > As I call the model I get the following results regarding the residuals: > > "ALL 90 residuals are 0: no residual degrees of freedom!" > > What has gone wrong? > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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]]