Watts-College / paf-510-template

https://watts-college.github.io/paf-510-template/
0 stars 0 forks source link

Part II, Q 4 #86

Open ElvisYoh opened 2 days ago

ElvisYoh commented 2 days ago

@nickmcmullen @AntJam-Howell I am having problems running this chunk. Is there something lacking from the code?

m <- lm( log(SALARY) ~ log(REVENUE), data=d2 )
stargazer( m, type="html",
           omit.stat = c("rsq","f","ser"),
           notes.label = "Standard errors in parentheses" )

Does the regression table provide a clue to the solutions ? Please, I will like to get more explanations on how using logarithms permit to resolve specification issues in regressions. Does the reduction of large values to small ones explain relationships between variables?

nickmcmullen commented 1 day ago

@ElvisYoh this is the log regression you need to answer the question. The lab instructions also provide the formula for you, so you can simply plug in the value for log(revenue) to get log(salary) and convert that number back to a dollar value to get the answer here.

Out of curiosity, what error are you getting when you run this chunk?

AntJam-Howell commented 1 day ago

The code look correct to me. You will have to show the error you are receiving.

Regarding your question on using logarithms to address specification issues in regressions:

Log transformations can help linearize relationships that are multiplicative or exponential in nature. For instance, if the relationship between salary and revenue is more proportional or scaling, using log(SALARY) and log(REVENUE) can help express that as a linear relationship.

Log transformations also reduce the influence of large values by compressing the range of the data. In regressions with highly skewed data (where some values are significantly larger than others), the log transformation can help make the data more normally distributed, which often leads to better model fit and more reliable estimates.

Also, when both the dependent and independent variables are logged (as in our case), the coefficients can be interpreted as elasticities. That means a 1% change in REVENUE is associated to a percentage change in SALARY equal to the coefficient of log(REVENUE).

The use of logs can also sometimes resolve specification issues by making relationships between variables by reducing heteroscedasticity (non-constant variance in residuals). This improves the assumptions of the linear regression model and can lead to more reliable statistical inferences.

In other words, the reduction of large values into smaller ones via the log transformation doesn’t necessarily “explain” relationships but allows for better model fit when relationships between variables are not strictly linear. It essentially helps to stabilize variance and make patterns clearer in the data.

-- Anthony Howell Director, Center for Technology, Data, and Society, Associate Professor, Public Policy Arizona State University

On Wed, Oct 2, 2024 at 12:53 PM nickmcmullen @.***> wrote:

@ElvisYoh https://urldefense.com/v3/__https://github.com/ElvisYoh__;!!IKRxdwAv5BmarQ!b22Q5qiEK-crRoKIXBmF7xZrlgcNzvOh1pK5LA3wx7VvDPCBXNiAyvbBPFGxCl2k0dBs-nRMux0fjY8szh5uX-4h9aKyaw$ this is the log regression you need to answer the question. The lab instructions also provide the formula for you, so you can simply plug in the value for log(revenue) to get log(salary) and convert that number back to a dollar value to get the answer here.

Out of curiosity, what error are you getting when you run this chunk?

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/Watts-College/paf-510-template/issues/86*issuecomment-2389558332__;Iw!!IKRxdwAv5BmarQ!b22Q5qiEK-crRoKIXBmF7xZrlgcNzvOh1pK5LA3wx7VvDPCBXNiAyvbBPFGxCl2k0dBs-nRMux0fjY8szh5uX-7pWFTHbQ$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AMK2Y7YRHY6MFSS2PSJJJ3DZZRFJ5AVCNFSM6AAAAABPIEFRGCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBZGU2TQMZTGI__;!!IKRxdwAv5BmarQ!b22Q5qiEK-crRoKIXBmF7xZrlgcNzvOh1pK5LA3wx7VvDPCBXNiAyvbBPFGxCl2k0dBs-nRMux0fjY8szh5uX-5VBJqA2w$ . You are receiving this because you were mentioned.Message ID: @.***>

ElvisYoh commented 1 day ago

@nickmcmullen @AntJam-Howell Sorry for getting back this late. I am presently in Cameroon and my network is not the best. Thank you for the explanations. This is the error that appears after running the chunk.

Error in stargazer(m, type = "html", omit.stat = c("rsq", "f", "ser"), : could not find function "stargazer"

nickmcmullen commented 1 day ago

@ElvisYoh check that you've loaded the stargazer package before running this chunk.

ElvisYoh commented 1 day ago

@nickmcmullen Thank you Sir! I got where the problem was coming from. I appreciate your inputs.