Standardized regression coefficients aka β

40 views
Skip to first unread message

eric porges

unread,
Dec 22, 2016, 2:26:57 PM12/22/16
to Deducer
I tried search, but didn't find anything on this.

When using multiple regression in Deducer is there way to get Standardized regression coefficients aka β output in the table?

Thanks!

rudolf....@gmail.com

unread,
Jan 7, 2017, 3:02:15 AM1/7/17
to Deducer
To get the beta coefficients I export the linear model with Deducer. Then, I type "lm.beta(model)" using the added package lm.beta. Or alternatively, the package Betas can be used.

uabdav...@gmail.com

unread,
Aug 16, 2017, 12:37:42 PM8/16/17
to Deducer
Hello!
How do you export ·export the linear model with Deducer."
Thanks from Barcelona!

Ian Fellows

unread,
Aug 16, 2017, 1:28:16 PM8/16/17
to ded...@googlegroups.com
You can export residuals and predictions using the export sub dialog in the regression dialog. You can export the output of the regression using the file -> save. The actual model object can be saved by exporting in the export sub dialog and saving your workspace in workspace -> save as.


Ian


--

---
You received this message because you are subscribed to the Google Groups "Deducer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deducer+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bruce Miller

unread,
Oct 10, 2017, 8:15:28 AM10/10/17
to ded...@googlegroups.com
Hi all,

I have an issue with running a linear model.  It used to work fine and as with other repetitive tasks I have saved the steps and code.

Below are the steps used (had no problem with previous version fo Deducer)
+++++++++++++++++++

Add data set as tab or cvs format.

Go to:

·         Analysis
·         Linear Model
·         Add Fc as outcome
·         FA or Ear as Factor
 
·         Click continue
·         Click continue

·         Click EXPORT button on right
·         Check Predicted box
·         Click RUN

 

The data Viewer will have a new column inserted Predicted

Note this is not the completed model.

Copy and paste the code below in the Console window.  Make sure to edit Predicted on 5th line so it is labeled in data Viewer table.


model.lm <- lm(formula=FCmin ~ FA,data=Bats,na.action=na.omit)
Anova(model.lm,type='II')
summary(model.lm)
tmp<-predict(model.lm,Bats)
Bats[names(tmp),"Fcmin_predicted"]<-tmp
rm('tmp')
rm('model.lm')

This will provide predicted values.
+++++++++++++++++++++++

This is not working.

Data set is very simple:
I only needed to "Predict" the Fc for the first row that is not available.
as an FYI the

Variable view
SPEC_CODE Character
FA Double
Fc Double


SPEC_CODE FA Fc
Lasatr 46.3
Lasblo 40 43
Lasbor 40.5 40.6
Lascas 44.5 30.72
Lascin 53.5 21
Lasega 45 31.4
Lasint 53 30.8
Lassem 53.5 40.35


Here is paste from console when I complete the above first steps.  No predicted value is added tot he data frame as it has been in the past.
Seems to be some error as the goal is to predict the missing value and the notice NAs are not allowed...is puzzling???

> Lasiurus2 <- dget('E:/Acoustic Parameters/Predicted and genera summaries/Vespertilionids/Lasiurus/Lasiurus2.robj')
> Bats<-Lasiurus2
>
Error in text.default(x, y, labels.id[ind], cex = cex.id, xpd = TRUE,  :
  invalid 'pos' value
In addition: Warning message:
not plotting observations with leverage one:
  1, 2, 3, 5, 6
Error in plot.lm(.gui.working.env$model.lm, c(1, 4, 3, 5), sub.caption = "") :
  NAs are not allowed in subscripted assignments
In addition: Warning messages:
1: not plotting observations with leverage one:
  1, 2, 3, 5, 6
2: not plotting observations with leverage one:
  1, 2, 3, 5, 6
model.lm <- lm(formula=Fc ~ as.factor(FA),data=Bats,na.action=na.omit)
> Anova(model.lm,type='II')
Anova Table (Type II tests)

Response: Fc
              Sum Sq Df F value Pr(>F)
as.factor(FA) 174.43  5  0.1863 0.9317
Residuals     187.21  1              
> summarylm(model.lm)

Call:
lm(formula = Fc ~ as.factor(FA), data = Bats, na.action = na.omit)

Residuals:
         2          3          4          5          6          7
-2.389e-15 -7.562e-18 -1.818e-17 -9.675e+00  9.392e-16  1.010e-15
         8
 9.675e+00

Coefficients:
                  Estimate Std. Error t value Pr(>|t|)
(Intercept)          43.00      13.68   3.143    0.196
as.factor(FA)40.5    -2.40      19.35  -0.124    0.921
as.factor(FA)44.5   -12.28      19.35  -0.635    0.640
as.factor(FA)45     -11.60      19.35  -0.599    0.656
as.factor(FA)53     -12.20      19.35  -0.630    0.642
as.factor(FA)53.5   -12.32      16.76  -0.735    0.596

Residual standard error: 13.68 on 1 degrees of freedom
  (1 observation deleted due to missingness)
Multiple R-squared:  0.4823,    Adjusted R-squared:  -2.106
F-statistic: 0.1863 on 5 and 1 DF,  p-value: 0.9317

> Bats[["predicted.link"]] <- predict(model.lm, newdata=Bats)
Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) :
  factor as.factor(FA) has new levels 46.3
> rm('model.lm')
>

So what am I now doing incorrectly?
Seems no point in pasting the second step of code since the "Predicted" values are no created.

Bruce

Ian Fellows

unread,
Oct 10, 2017, 12:18:47 PM10/10/17
to ded...@googlegroups.com
Hi Bruce,

You are modeling FA as a factor. Since “46.3” doesn’t exist in your dataset except for the row with a missing outcome, predict won’t work. Predict can only do predictions on factor levels it has seen before. I’d think about treating FA as numeric in your model.


Best,
Ian



Bruce Miller

unread,
Oct 20, 2017, 11:10:06 AM10/20/17
to ded...@googlegroups.com
Just installed a new package red to use IUCN red list data.
When I went to Package Manager this popped up.

Puzzled.

Re-install R-Java???
Bruce

> JGR::package.manager()
java.lang.OutOfMemoryError: unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Unknown Source)
    at org.rosuda.JGR.MonitoredEval.run(JGR.java:968)
    at org.rosuda.JGR.JGR.timedEval(JGR.java:330)
    at org.rosuda.JGR.JGR.timedEval(JGR.java:322)
    at org.rosuda.JGR.RController.refreshPackages(RController.java:563)
    at org.rosuda.JGR.JGRPackageManager.refresh(JGRPackageManager.java:263)
    at
org.rosuda.JGR.JGRPackageManager.showInstance(JGRPackageManager.java:244)
    at org.rosuda.JRI.Rengine.rniRunMainLoop(Native Method)
    at org.rosuda.JRI.Rengine.run(Rengine.java:640)
> Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError:
unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Unknown Source)
    at org.rosuda.JGR.JGRConsole.execute(JGRConsole.java:337)
    at org.rosuda.JGR.JGRConsole.actionPerformed(JGRConsole.java:855)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
    at
javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
    at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)


Bruce Miller

unread,
Oct 21, 2017, 9:29:09 AM10/21/17
to ded...@googlegroups.com
Hi all,

Happened again! I updated packages and now can no longer find/run Deducer.


When I use my  normal list of commands in the R console

unlink(".RData")

rm(list=ls())

#Open R then paste

library(JGR)

JGR()

I am getting the below list.

I somehow recall this is related to the R path crap that was reset on updating from what I have been using for my library and location of Deducer/JGR

> JGR()

SET "PATH=C:\R\R-3.2.5\library\rJava\jri\i386;C:\R\R-3.2.5\bin\i386;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\R\R-3.2.5\library\rJava\libs\i386;C:\Program Files (x86)\Java\jre1.8.0_91\bin;C:\Program Files (x86)\Java\jre1.8.0_91\bin\client;C:\Program Files (x86)\Java\jre1.8.0_91\bin\client;C:\PROGRAMDATA\ORACLE\JAVA\JAVAPATH;C:\PROGRAM FILES\IMAGEMAGICK-6.9.1-Q16;C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\WINDOWS LIVE;C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT SHARED\WINDOWS LIVE;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WBEM;C:\WINDOWS\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\PROGRAM FILES (X86)\WINDOWS LIVE\SHARED;C:\PROGRAM FILES (X86)\COMMON FILES\ROXIO SHARED\DLLSHARED\;C:\PROGRAM FILES (X86)\COMMON FILES\ROXIO SHARED\OEM\DLLSHARED\;C:\PROGRAM FILES (X86)\COMMON FILES\ROXIO SHARED\OEM\DLLSHARED\;C:\PROGRAM FILES (X86)\COMMON FILES\ROXIO SHARED\OEM\12.0\DLLSHARED\;C:\PROGRAM FILES (X86)\ROXIO\OEM\AUDIOCORE\;C:\PROGRAM FILES (X86)\ACRONIS\TRUEIMAGEHOME\;C:\PROGRAM FILES (X86)\QUICKTIME\QTSYSTEM\;C:\PROGRAM FILES (X86)\MICROSOFT SQL SERVER\100\TOOLS\BINN\;C:\PROGRAM FILES\MICROSOFT SQL SERVER\100\TOOLS\BINN\;C:\PROGRAM FILES\MICROSOFT SQL SERVER\100\DTS\BINN\;C:\PROGRAM FILES (X86)\ARCGIS\ESRIPRODUCTIONMAPPING\DESKTOP10.2\BIN;C:\PROGRAM FILES (X86)\ARCGIS\BIN;;C:\PROGRAM FILES\MICROSOFT SQL SERVER\110\TOOLS\BINN\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile64\;C:\Program Files (x86)\Common Files\Acronis\FileProtector\;C:\Program Files (x86)\Common Files\Acronis\FileProtector64\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;.;C:\R\R-3.2.5\bin"
SET "R_HOME=C:/R/R-3.2.5"
SET "R_ARCH=/i386"
SET "R_LIBS=C:/R/R-3.2.5/library"
SET "R_LIBS_USER=C:\Bruce\Documents/R/win-library/3.2"
"C:\Program Files (x86)\Java\jre1.8.0_91/bin/java.exe" -cp "C:\R\R-3.2.5\library\rJava\java\boot" -Drjava.class.path="C:\R\R-3.2.5\library\rJava\jri\JRI.jar;C:\R\R-3.2.5\library\JGR\java\JGR.jar;C:\R\R-3.2.5\etc\classes;C:\R\R-3.2.5\etc\classes\classes.jar" -Drjava.path="C:\R\R-3.2.5\library\rJava" -Dmain.class=org.rosuda.JGR.JGR  -Djgr.load.pkgs=yes  -Dr.arch=/i386 -Xss3m RJavaClassLoader
>
In order to complete an urgent  task this morning I re-installed the old legacy Deducer based on the old R 2.15.0.

Bruce

Bruce Miller

unread,
Oct 21, 2017, 9:57:55 AM10/21/17
to ded...@googlegroups.com
Hi all,

OK I just removed all the old directories related to R and Deducer/JGR
and re-installed R using the most recent version 3.4.2 and installed
Deducer from there.
All is working again.

I will never again simply "UPDATE" packages and always do fresh install.
Bruce
Reply all
Reply to author
Forward
0 new messages