piecewiseSEM
piecewiseSEM copied to clipboard
`stdCoefs` not returning values for transformed variables when in formula
data <- data.frame(
y = runif(50),
x = runif(50),
z = runif(50),
a = runif(50)
)
modelList <- psem(lm(log10(y+1) ~ sqrt(x), data),
lm(z ~ log10(y + 1), data))
coefs(modelList)
Hypothetical question related to this. Say you have several non-normal responses, and a couple that are normal within your psem. Most of my variables are highly right skewed biomass data. Glmer is an option, but psem won’t return standardized residuals for the appropriate family/link for my data. Transformation is an option, but unsure whether it’s better to universally transform all the variables in the same way, or tailor transformations for individual variables. If transforming variables, is it okay to interpret standardized coefficients as-is, or is some sort of back transformation necessary? Thank you
If you transform the response, then the standardized coefficients will be in units of SD of the transformed response. Same goes for predictors
GLMER is a special case since the link function linearizes the response, but there are additional sources of variance depending on the error distribution. So you will not get the same values if you, say, log-transform the response vs. if you fit a GLMER
HTH,
Jon
Jonathan S. Lefcheck, Ph.D. Tennenbaum Coordinating Scientist MarineGEO: https://marinegeo.si.edu/ Smithsonian Institution Phone: +1 (443) 482-2443 www.jonlefcheck.nethttp://www.jonlefcheck.net
From: @.>
Sent: Friday, September 16, 2022 9:01 PM
To: @.>
Cc: Lefcheck, @.>; @.>
Subject: Re: [jslefche/piecewiseSEM] stdCoefs
not returning values for transformed variables when in formula (Issue #256)
External Email - Exercise Caution
Hypothetical question related to this. Say you have several non-normal responses, and a couple that are normal within your psem. Most of my variables are highly right skewed biomass data. Glmer is an option, but psem won’t return standardized residuals for the appropriate family/link for my data. Transformation is an option, but unsure whether it’s better to universally transform all the variables in the same way, or tailor transformations for individual variables. If transforming variables, is it okay to interpret standardized coefficients as-is, or is some sort of back transformation necessary? Thank you
— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjslefche%2FpiecewiseSEM%2Fissues%2F256%23issuecomment-1249965220&data=05%7C01%7Clefcheckj%40si.edu%7C315c449080f748d719e008da98482c0e%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637989733007568718%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=gP8EihnKcGTMlKqzruYb63po5AWNc7zOjtb6R%2BWKpEo%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAR4AV3QWL4D36CEF5C5MHTV6UJ7BANCNFSM5Z4KBKHA&data=05%7C01%7Clefcheckj%40si.edu%7C315c449080f748d719e008da98482c0e%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637989733007568718%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=B%2BHMXND%2BAwkCcz9DaNjssGvRrIILLnIUm%2F2%2BzW20oFE%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>
Not sure what was happening here: code was stripping transformations from vector of coefficients and then couldn't match with the summary table from the model. So I took it out...hope it doesn't break something