1.1 Installation

1.1 Installation#

For the upcoming semester, we need to use functions from the R programming languae, which we will use within Python through the rpy2 package.

You should have the following installed from last semester already:

  • Anaconda (miniconda)

  • Code editor (e.g. Visual Studio code)

If not, please re-visit the installation instructions from the psy111 module.

As we need many new packages (and even a new programming language) this semester, we start by setting up a new conda environment for the course.

In the Miniconda prompt (later, we’ll see how to access Conda from the VS Code terminal), let’s first ensure that we install the necessary dependencies from an up-to-date and reliable source. We’ll do this by adding the conda-forge channel and setting it as the default with strict priority.

conda config --add channels conda-forge
conda config --set channel_priority strict

Now we can create a new Conda environment, which this time not only contains Python but also R:

conda create -n psy126 python=3.11 r
conda activate psy126

If the environment now shows up as (psy126), you are ready to install the required Python packages for the semester:

pip install matplotlib pandas numpy rpy2==3.5.7 ipykernel statsmodels seaborn

Finally, we can install the required R packages.

R.exe -e "install.packages(c('Gifi', 'mirt', 'future', 'psych', 'MPsychoR', 'polycor', 'lavaan', 'semTools', 'lordif', 'admisc', 'ltm', 'eRm'), repos='https://cran.uni-muenster.de')"
R -e "install.packages(c('Gifi', 'mirt', 'future', 'psych', 'MPsychoR', 'polycor', 'lavaan', 'semTools', 'lordif', 'admisc', 'ltm', 'eRm'), repos='https://cran.uni-muenster.de')"

Once these installations are succesful, you are ready to start. Link to the script testing the environment psy126.